Files
dasy/vendor/github.com/vacp2p/mvds/state/state.go
Dean Eigenmann ae2fb13f53 feature/payloads (#7)
* started working on payload concept

* added crypto

* moved into new package, added feed

* added nicer feed stuff

* minor readme for now

* subscribe implemented badly

* doc

* doc block

* cleaned up a little

* making a mutex

* mock, empty test

* test wrapper

* started playing around

* updated mock

* formatted

* updated

* updated interface

* updated

* updated

* updated mock, rewrote test stuff

* todos

* added tests

* reuse

* dont need var
2019-08-07 14:31:32 +02:00

30 lines
750 B
Go

// Package state contains everything related to the synchronization state for MVDS.
package state
// RecordType is the type for a specific record, either `OFFER`, `REQUEST` or `MESSAGE`.
type RecordType int
const (
OFFER RecordType = iota
REQUEST
MESSAGE
)
// 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 State struct {
Type RecordType
SendCount uint64
SendEpoch int64
// GroupID is optional, thus nullable
GroupID *GroupID
PeerID PeerID
MessageID MessageID
}
type SyncState interface {
Add(newState State) error
Remove(id MessageID, peer PeerID) error
All() ([]State, error)
Map(epoch int64, process func(State) State) error
}