This commit is contained in:
decanus
2019-07-16 01:07:10 +02:00
parent b48d92297c
commit ec87e4ab5e
3 changed files with 7 additions and 3 deletions

View File

@@ -25,7 +25,8 @@ const (
BATCH
)
type calculateNextEpoch func(count uint64, epoch int64) int64
// CalculateNextEpoch is a function used to calculate the next `SendEpoch` for a given message.
type CalculateNextEpoch func(count uint64, epoch int64) int64
// Node represents an MVDS node, it runs all the logic like sending and receiving protocol messages.
type Node struct {
@@ -41,7 +42,7 @@ type Node struct {
payloads payloads
nextEpoch calculateNextEpoch
nextEpoch CalculateNextEpoch
ID state.PeerID
@@ -56,7 +57,7 @@ func NewNode(
ms store.MessageStore,
st transport.Transport,
ss state.SyncState,
nextEpoch calculateNextEpoch,
nextEpoch CalculateNextEpoch,
currentEpoch int64,
id state.PeerID,
mode Mode,

View File

@@ -1,3 +1,4 @@
package state
// PeerID is the ID for a specific peer.
type PeerID [65]byte

View File

@@ -1,6 +1,7 @@
// 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 (
@@ -9,6 +10,7 @@ const (
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