Documentation ¶
Overview ¶
Package messagestore implements storage for messages.
Index ¶
- Constants
- Variables
- type Store
- func (store Store) ExpireFromFS()
- func (store Store) ExpireFromIndex(cycles int)
- func (store Store) Fetch(messageID *[message.MessageIDSize]byte) ([]byte, error)
- func (store Store) GetGlobalIndex(start int64, count int64) ([][]byte, int, error)
- func (store Store) GetIndex(index *message.Curve25519Key, start int64, count int64) ([][]byte, int, error)
- func (store Store) GetPeerStat(pubkey *[ed25519.PublicKeySize]byte) *structs.PeerStruct
- func (store Store) MessageExists(messageID [message.MessageIDSize]byte) bool
- func (store Store) PreExpire(messageID *[message.MessageIDSize]byte, pubkey *message.Curve25519Key) error
- func (store Store) Put(msgStruct *structs.MessageStruct, signerStruct *structs.SignerStruct, ...) error
- func (store Store) PutNotify(msgStruct *structs.MessageStruct, signerStruct *structs.SignerStruct, ...) error
- func (store Store) TouchPeer(pubkey *[ed25519.PublicKeySize]byte)
- func (store Store) UpdatePeerAuthToken(senderPubKey *[ed25519.PublicKeySize]byte, ...)
- func (store Store) UpdatePeerFetchStat(pubkey *[ed25519.PublicKeySize]byte, lastFetch, lastPos, lastErrors uint64)
- func (store Store) UpdatePeerNotification(pubkey *[ed25519.PublicKeySize]byte, hasError bool)
Constants ¶
const Version = "0.0.1 very alpha"
Version of this release
Variables ¶
var ( // ErrDuplicate is returned if a message is a duplicate ErrDuplicate = errors.New("messagestore: Duplicate message") // ErrPostLimit is returned when a signer has posted more messages than allowed by calculation ErrPostLimit = errors.New("messagestore: Signer has reached post limit") // ErrNotFound is returned when a message was fetched that didn't exist ErrNotFound = errors.New("messagestore: Message not found") // MaxMessageSize is the size of an encoded repbin message MaxMessageSize = 87776 )
var CurrentTime = func() int64 { return time.Now().UTC().Unix() }
CurrentTime returns the current time in UTC
var MaxAgeRecipients = int64(31536000)
MaxAgeRecipients defines when to delete recipients that are not active anymore
var MaxAgeSigners = int64(31536000)
MaxAgeSigners defines when to delete signers that are not active anymore
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements a message store
func New ¶
New Create a new message store at directory dir. Workers is the maximum concurrent access to an index
func (Store) ExpireFromFS ¶
func (store Store) ExpireFromFS()
ExpireFromFS expires data based on filesystem last change
func (Store) ExpireFromIndex ¶
ExpireFromIndex reads the expire index and expires messages as they are recorded
func (Store) GetGlobalIndex ¶
GetGlobalIndex returns the global index
func (Store) GetIndex ¶
func (store Store) GetIndex(index *message.Curve25519Key, start int64, count int64) ([][]byte, int, error)
GetIndex returns the index for a key
func (Store) GetPeerStat ¶
func (store Store) GetPeerStat(pubkey *[ed25519.PublicKeySize]byte) *structs.PeerStruct
GetPeerStat returns the last entry of peer statistics for pubkey
func (Store) MessageExists ¶
func (store Store) MessageExists(messageID [message.MessageIDSize]byte) bool
MessageExists returns true if the message exists
func (Store) PreExpire ¶
func (store Store) PreExpire(messageID *[message.MessageIDSize]byte, pubkey *message.Curve25519Key) error
PreExpire expires a message in the next expire run
func (Store) Put ¶
func (store Store) Put(msgStruct *structs.MessageStruct, signerStruct *structs.SignerStruct, message []byte) error
Put stores a message in the message store WITHOUT notifying the notify backend
func (Store) PutNotify ¶
func (store Store) PutNotify(msgStruct *structs.MessageStruct, signerStruct *structs.SignerStruct, message []byte, notifyChan chan bool) error
PutNotify runs Put and notifies the backend if no error occured
func (Store) TouchPeer ¶
func (store Store) TouchPeer(pubkey *[ed25519.PublicKeySize]byte)
TouchPeer creates a peer entry if it does not exist yet
func (Store) UpdatePeerAuthToken ¶
func (store Store) UpdatePeerAuthToken(senderPubKey *[ed25519.PublicKeySize]byte, signedToken *[keyproof.ProofTokenSignedSize]byte)
UpdatePeerAuthToken updates the peer record when a new auth token has been received
func (Store) UpdatePeerFetchStat ¶
func (store Store) UpdatePeerFetchStat(pubkey *[ed25519.PublicKeySize]byte, lastFetch, lastPos, lastErrors uint64)
UpdatePeerFetchStat writes fetch-specific data
func (Store) UpdatePeerNotification ¶
func (store Store) UpdatePeerNotification(pubkey *[ed25519.PublicKeySize]byte, hasError bool)
UpdatePeerNotification updates the peer stat after notification send