mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 22:02:46 +00:00
Add type field to DeviceMessage, allow fields to be nullable (#1969)
This commit is contained in:
parent
b1377d991a
commit
125ea75b24
7 changed files with 41 additions and 14 deletions
|
@ -53,9 +53,17 @@ func (k *KeyError) Error() string {
|
|||
return k.Err
|
||||
}
|
||||
|
||||
type DeviceMessageType int
|
||||
|
||||
const (
|
||||
TypeDeviceKeyUpdate DeviceMessageType = iota
|
||||
TypeCrossSigningUpdate
|
||||
)
|
||||
|
||||
// DeviceMessage represents the message produced into Kafka by the key server.
|
||||
type DeviceMessage struct {
|
||||
DeviceKeys
|
||||
Type DeviceMessageType `json:"Type,omitempty"`
|
||||
*DeviceKeys `json:"DeviceKeys,omitempty"`
|
||||
// A monotonically increasing number which represents device changes for this user.
|
||||
StreamID int
|
||||
}
|
||||
|
@ -76,7 +84,7 @@ type DeviceKeys struct {
|
|||
// WithStreamID returns a copy of this device message with the given stream ID
|
||||
func (k *DeviceKeys) WithStreamID(streamID int) DeviceMessage {
|
||||
return DeviceMessage{
|
||||
DeviceKeys: *k,
|
||||
DeviceKeys: k,
|
||||
StreamID: streamID,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue