Documentation ¶
Index ¶
- type Configuration
- type Syncer
- func (s *Syncer) Await() chan struct{}
- func (s *Syncer) Close()
- func (s *Syncer) FetchAtx(ctx context.Context, ID types.ATXID) error
- func (s *Syncer) FetchAtxReferences(ctx context.Context, atx *types.ActivationTx) error
- func (s *Syncer) FetchBlock(ctx context.Context, ID types.BlockID) error
- func (s *Syncer) FetchPoetProof(ctx context.Context, poetProofRef []byte) error
- func (s *Syncer) ForceSync()
- func (s *Syncer) GetAtxs(ctx context.Context, IDs []types.ATXID) error
- func (s *Syncer) GetBlocks(ctx context.Context, blockIds []types.BlockID) error
- func (ms Syncer) GetExit() chan struct{}
- func (s *Syncer) GetPoetProof(ctx context.Context, hash types.Hash32) error
- func (ms Syncer) GetTimeout() time.Duration
- func (s *Syncer) GetTxs(ctx context.Context, IDs []types.TransactionID) error
- func (s *Syncer) IsSynced(ctx context.Context) bool
- func (s *Syncer) ListenToGossip() bool
- func (s *Syncer) Start(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { LayersPerEpoch uint16 Concurrency int // number of workers for sync method LayerSize int RequestTimeout time.Duration SyncInterval time.Duration ValidationDelta time.Duration AtxsLimit int Hdist int AlwaysListen bool GoldenATXID types.ATXID }
Configuration represents all config params needed by syncer
type Syncer ¶
type Syncer struct { log.Log Configuration *mesh.Mesh // contains filtered or unexported fields }
Syncer is used to sync the node with the network periodically the Syncer will check if the node is synced with the rest of the network and will follow the sync protocol in order to fetch all missing data and become synced again
func NewSync ¶
func NewSync(ctx context.Context, srv service.Service, layers *mesh.Mesh, txpool txMemPool, atxDB atxDB, bv blockEligibilityValidator, poetdb poetDb, conf Configuration, clock ticker, logger log.Log) *Syncer
NewSync fires a sync every sm.SyncInterval or on force space from outside
func NewSyncWithMocks ¶ added in v0.1.11
func NewSyncWithMocks(atxdbStore *database.LDBDatabase, mshdb *mesh.DB, txpool *state.TxMempool, atxpool *activation.AtxMemDB, swarm service.Service, poetDb *activation.PoetDb, conf Configuration, goldenATXID types.ATXID, expectedLayers types.LayerID) *Syncer
NewSyncWithMocks returns a syncer instance that is backed by mocks of other modules for use in testing
func (*Syncer) Await ¶
func (s *Syncer) Await() chan struct{}
Await returns a channel that blocks until the node is synced
func (*Syncer) FetchAtxReferences ¶ added in v0.1.15
FetchAtxReferences fetches positioning and prev atxs from peers if they are not found in db
func (*Syncer) FetchBlock ¶ added in v0.1.16
FetchBlock fetches a single block from peers
func (*Syncer) FetchPoetProof ¶
FetchPoetProof fetches a poet proof from network peers
func (*Syncer) ForceSync ¶
func (s *Syncer) ForceSync()
ForceSync signals syncer to run the synchronise flow
func (*Syncer) GetAtxs ¶ added in v0.1.16
GetAtxs fetches list of atxs from remote peers if possible
func (*Syncer) GetPoetProof ¶ added in v0.1.16
GetPoetProof fetches a poet proof from network peers
func (Syncer) GetTimeout ¶
func (*Syncer) ListenToGossip ¶
ListenToGossip enables other modules to check if they should listen to gossip