-
Notifications
You must be signed in to change notification settings - Fork 13
/
register.go
39 lines (29 loc) · 836 Bytes
/
register.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package tarantool
import "github.com/tinylib/msgp/msgp"
// Register is the REGISTER command
type Register struct {
UUID string
VClock VectorClock
}
var _ Query = (*Register)(nil)
func (q *Register) GetCommandID() uint {
return RegisterCommand
}
// MarshalMsg implements msgp.Marshaler
func (q *Register) MarshalMsg(b []byte) (o []byte, err error) {
o = b
o = msgp.AppendMapHeader(o, 2)
o = msgp.AppendUint(o, KeyInstanceUUID)
o = msgp.AppendString(o, q.UUID)
o = msgp.AppendUint(o, KeyVClock)
o = msgp.AppendMapHeader(o, uint32(len(q.VClock[1:])))
for i, lsn := range q.VClock[1:] {
o = msgp.AppendUint32(o, uint32(i))
o = msgp.AppendUint64(o, lsn)
}
return o, nil
}
// UnmarshalMsg implements msgp.Unmarshaler
func (q *Register) UnmarshalMsg([]byte) (buf []byte, err error) {
return buf, ErrNotSupported
}