Documentation
¶
Index ¶
- Variables
- type Config
- type PeerSyncing
- func (p *PeerSyncing) Add(message SyncMessage) error
- func (p *PeerSyncing) AvailableMessages() ([]SyncMessage, error)
- func (p *PeerSyncing) AvailableMessagesByGroupID(groupID []byte, limit int) ([]SyncMessage, error)
- func (p *PeerSyncing) AvailableMessagesByGroupIDs(groupIDs [][]byte, limit int) ([]SyncMessage, error)
- func (p *PeerSyncing) MessagesByIDs(messageIDs [][]byte) ([]SyncMessage, error)
- func (p *PeerSyncing) OnOffer(messages []SyncMessage) ([]SyncMessage, error)
- type SyncMessage
- type SyncMessagePersistence
- type SyncMessageSQLitePersistence
- func (p *SyncMessageSQLitePersistence) Add(message SyncMessage) error
- func (p *SyncMessageSQLitePersistence) All() ([]SyncMessage, error)
- func (p *SyncMessageSQLitePersistence) ByGroupID(groupID []byte, limit int) ([]SyncMessage, error)
- func (p *SyncMessageSQLitePersistence) ByGroupIDs(ids [][]byte, limit int) ([]SyncMessage, error)
- func (p *SyncMessageSQLitePersistence) ByMessageIDs(ids [][]byte) ([]SyncMessage, error)
- func (p *SyncMessageSQLitePersistence) Complement(messages []SyncMessage) ([]SyncMessage, error)
- type SyncMessageType
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSyncMessageNotValid = errors.New("sync message not valid")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { SyncMessagePersistence SyncMessagePersistence Database *sql.DB Timesource common.TimeSource }
type PeerSyncing ¶
type PeerSyncing struct {
// contains filtered or unexported fields
}
func New ¶
func New(config Config) *PeerSyncing
func (*PeerSyncing) Add ¶
func (p *PeerSyncing) Add(message SyncMessage) error
func (*PeerSyncing) AvailableMessages ¶
func (p *PeerSyncing) AvailableMessages() ([]SyncMessage, error)
func (*PeerSyncing) AvailableMessagesByGroupID ¶
func (p *PeerSyncing) AvailableMessagesByGroupID(groupID []byte, limit int) ([]SyncMessage, error)
func (*PeerSyncing) AvailableMessagesByGroupIDs ¶
func (p *PeerSyncing) AvailableMessagesByGroupIDs(groupIDs [][]byte, limit int) ([]SyncMessage, error)
func (*PeerSyncing) MessagesByIDs ¶
func (p *PeerSyncing) MessagesByIDs(messageIDs [][]byte) ([]SyncMessage, error)
func (*PeerSyncing) OnOffer ¶
func (p *PeerSyncing) OnOffer(messages []SyncMessage) ([]SyncMessage, error)
type SyncMessage ¶
type SyncMessage struct { ID []byte Type SyncMessageType GroupID []byte Payload []byte Timestamp uint64 }
func (*SyncMessage) Valid ¶
func (s *SyncMessage) Valid() error
type SyncMessagePersistence ¶
type SyncMessagePersistence interface { Add(SyncMessage) error All() ([]SyncMessage, error) Complement([]SyncMessage) ([]SyncMessage, error) ByGroupID([]byte, int) ([]SyncMessage, error) ByGroupIDs([][]byte, int) ([]SyncMessage, error) ByMessageIDs([][]byte) ([]SyncMessage, error) }
type SyncMessageSQLitePersistence ¶
type SyncMessageSQLitePersistence struct {
// contains filtered or unexported fields
}
func NewSyncMessageSQLitePersistence ¶
func NewSyncMessageSQLitePersistence(db *sql.DB) *SyncMessageSQLitePersistence
func (*SyncMessageSQLitePersistence) Add ¶
func (p *SyncMessageSQLitePersistence) Add(message SyncMessage) error
func (*SyncMessageSQLitePersistence) All ¶
func (p *SyncMessageSQLitePersistence) All() ([]SyncMessage, error)
func (*SyncMessageSQLitePersistence) ByGroupID ¶
func (p *SyncMessageSQLitePersistence) ByGroupID(groupID []byte, limit int) ([]SyncMessage, error)
func (*SyncMessageSQLitePersistence) ByGroupIDs ¶
func (p *SyncMessageSQLitePersistence) ByGroupIDs(ids [][]byte, limit int) ([]SyncMessage, error)
func (*SyncMessageSQLitePersistence) ByMessageIDs ¶
func (p *SyncMessageSQLitePersistence) ByMessageIDs(ids [][]byte) ([]SyncMessage, error)
func (*SyncMessageSQLitePersistence) Complement ¶
func (p *SyncMessageSQLitePersistence) Complement(messages []SyncMessage) ([]SyncMessage, error)
type SyncMessageType ¶
type SyncMessageType int
const ( SyncMessageNoType SyncMessageType = iota SyncMessageCommunityType SyncMessageOneToOneType SyncMessagePrivateGroup )
Click to show internal directories.
Click to hide internal directories.