Documentation
¶
Overview ¶
Package commands provides commands used by the client and server.
Index ¶
Constants ¶
const ( // ResponseStatusOK is an ErrorCode value used in responses from the Reunion DB // to indicate there was no error with the received query command. ResponseStatusOK = 0 // ResponseStatusInvalidCommand is an ErrorCode value used in responses // from the Reunion DB to indicate the command was not accepted. ResponseInvalidCommand = 0xFF )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command interface { // ToBytes serializes the command and returns the resulting slice. ToBytes() []byte }
Command interface represents query and response Reunion DB commands.
type FetchState ¶
type FetchState struct { // Epoch specifies the current Reunion epoch. Epoch uint64 // T1Hash is the hash of the T1 message which is linked with a set of received messages. T1Hash [sha256.Size]byte }
FetchState command is used by clients to fetch the current Reunion DB state.
func (*FetchState) ToBytes ¶
func (s *FetchState) ToBytes() []byte
ToBytes serializes the SendT1 command and returns the resulting slice.
type MessageResponse ¶
type MessageResponse struct { // ErrorCode indicates a specific error or status OK. ErrorCode uint8 }
MessageResponse command is used by the server to send clients the status of the previously received send command (SendT1, SendT2 and, SendT3).
func (*MessageResponse) ToBytes ¶
func (s *MessageResponse) ToBytes() []byte
ToBytes serializes the MessageResponse command and returns the resulting slice.
type SendT1 ¶
type SendT1 struct { // Epoch specifies the current Reunion epoch. Epoch uint64 // Payload contains the T1 message. Payload []byte }
SendT1 command is used by clients to send their T1 message to the Reunion DB.
type SendT2 ¶
type SendT2 struct { // Epoch specifies the current Reunion epoch. Epoch uint64 // SrcT1Hash is the hash of the T1 message sent by this sender. SrcT1Hash [sha256.Size]byte // DstT1Hash is the hash of the T1 message which this T2 message is replying. DstT1Hash [sha256.Size]byte // Payload contains the T2 message. Payload []byte }
SendT2 command is used by clients to send their T2 message to the Reunion DB.
type SendT3 ¶
type SendT3 struct { // Epoch specifies the current Reunion epoch. Epoch uint64 // SrcT1Hash is the hash of the T1 message sent by this sender. SrcT1Hash [sha256.Size]byte // DstT1Hash is the hash of the T1 message which this T2 message is replying. DstT1Hash [sha256.Size]byte // Payload contains the T3 message. Payload []byte }
SendT3 command is used by clients to send their T3 message to the Reunion DB.
type StateResponse ¶
type StateResponse struct { // ErrorCode indicates a specific error or status OK. ErrorCode uint8 // Truncated indicates if the payload was truncated or not. Truncated bool // LeftOverChunksHint is the number of left over chunks if // the payload is truncated. LeftOverChunksHint uint32 // Payload contains the Reunion DB state. Payload []byte }
StateResponse is sent to clients in response to a FetchState command.
func (*StateResponse) ToBytes ¶
func (s *StateResponse) ToBytes() []byte
ToBytes serializes the SendT1 command and returns the resulting slice.