Documentation ¶
Index ¶
Constants ¶
const ( MessageIdLen = 32 TruncatedMessageIdLen = 8 )
Constants for data length.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buff ¶
type Buff struct {
// contains filtered or unexported fields
}
Buff is a circular buffer which containing Message's.
func LoadBuff ¶
LoadBuff loads the ring buffer from storage. It loads all messages from storage and repopulates the buffer.
func (*Buff) GetByMessageID ¶
GetByMessageID looks up and returns the message with MessageID ID from the lookup map. If the message does not exist, an error is returned.
type Conversation ¶
type Conversation struct {
// contains filtered or unexported fields
}
func LoadOrMakeConversation ¶
func LoadOrMakeConversation(kv *versioned.KV, partner *id.ID) *Conversation
LoadOrMakeConversation returns the Conversation with the given ID, if it can be found in KV. Otherwise, a new conversation with the given ID is generated, saved to KV, and returned.
func (*Conversation) GetNextSendID ¶
func (c *Conversation) GetNextSendID() (uint64, uint32)
GetNextSendID returns the next sendID in both full and truncated formats.
func (*Conversation) ProcessReceivedMessageID ¶
func (c *Conversation) ProcessReceivedMessageID(mid uint32) uint64
ProcessReceivedMessageID finds the full 64-bit message ID and updates the internal last message ID if the new ID is newer.
type Message ¶
type Message struct { MessageId MessageID // The ID of the message Timestamp time.Time // contains filtered or unexported fields }
Message is the structure held in a ring buffer. It represents a received message by the user, which needs its reception verified to the original sender of the message.
type MessageID ¶
type MessageID [MessageIdLen]byte
MessageID is the ID of a message stored in a Message.
func NewMessageIdFromBytes ¶
NewMessageIdFromBytes creates a MessageID from byte data.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}