21 lines
431 B
Go
21 lines
431 B
Go
|
package rep
|
||
|
|
||
|
import (
|
||
|
"encoding/binary"
|
||
|
)
|
||
|
|
||
|
type localState struct {
|
||
|
SeqNum int64
|
||
|
TimestampMS int64
|
||
|
}
|
||
|
|
||
|
func (h localState) writeTo(b []byte) {
|
||
|
binary.LittleEndian.PutUint64(b[0:8], uint64(h.SeqNum))
|
||
|
binary.LittleEndian.PutUint64(b[8:16], uint64(h.TimestampMS))
|
||
|
}
|
||
|
|
||
|
func (h *localState) readFrom(b []byte) {
|
||
|
h.SeqNum = int64(binary.LittleEndian.Uint64(b[0:8]))
|
||
|
h.TimestampMS = int64(binary.LittleEndian.Uint64(b[8:16]))
|
||
|
}
|