state

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 4 Imported by: 4

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 NewPersistentSyncState added in v0.0.26

func NewPersistentSyncState(db *sql.DB) *sqliteSyncState

func NewSyncState

func NewSyncState() *memorySyncState

Types

type GroupID

type GroupID [32]byte

type MessageID

type MessageID [32]byte

type PeerID

type PeerID [65]byte

PeerID is the ID for a specific peer.

type RecordType added in v0.0.16

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