state

package
v0.0.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2019 License: MIT Imports: 4 Imported by: 7

Documentation

Overview

Package state contains everything related to the synchronization state for MVDS.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStateNotFound = errors.New("state not found")
)

Functions

func NewMemorySyncState added in v0.0.25

func NewMemorySyncState() *memorySyncState

func NewPersistentSyncState added in v0.0.21

func NewPersistentSyncState(db *sql.DB) *sqliteSyncState

Types

type GroupID

type GroupID [32]byte

func ToGroupID added in v0.0.25

func ToGroupID(b []byte) GroupID

ToGroupID converts a byte array to a GroupID.

type MessageID

type MessageID [32]byte

func ToMessageID added in v0.0.25

func ToMessageID(b []byte) MessageID

ToMessageID converts a byte array to a MessageID.

type PeerID

type PeerID [65]byte

PeerID is the ID for a specific peer.

type RecordType

type RecordType int

RecordType is the type for a specific record, either `OFFER`, `REQUEST` or `MESSAGE`.

const (
	OFFER RecordType = iota
	REQUEST
	MESSAGE
)

type State

type State struct {
	Type      RecordType
	SendCount uint64
	SendEpoch int64
	// GroupID is optional, thus nullable
	GroupID   *GroupID
	PeerID    PeerID
	MessageID MessageID
}

State is a struct used to store a records state(https://github.com/status-im/bigbrother-specs/blob/master/data_sync/mvds.md#state).

type SyncState

type SyncState interface {
	Add(newState State) error
	Remove(id MessageID, peer PeerID) error
	All(epoch int64) ([]State, error)
	Map(epoch int64, process func(State) State) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL