Documentation ¶
Index ¶
- Variables
- type Config
- type DataFetch
- func (d *DataFetch) GetEpochATXs(ctx context.Context, epoch types.EpochID) error
- func (d *DataFetch) PollLayerData(ctx context.Context, lid types.LayerID, peers ...p2p.Peer) error
- func (d *DataFetch) PollLayerOpinions(ctx context.Context, lid types.LayerID) ([]*fetch.LayerOpinion, error)
- func (d *DataFetch) PollMaliciousProofs(ctx context.Context) error
- type ForkFinder
- func (ff *ForkFinder) AddResynced(lid types.LayerID, hash types.Hash32)
- func (ff *ForkFinder) FindFork(ctx context.Context, peer p2p.Peer, diffLid types.LayerID, ...) (types.LayerID, error)
- func (ff *ForkFinder) NeedResync(lid types.LayerID, hash types.Hash32) bool
- func (ff *ForkFinder) NumPeersCached() int
- func (ff *ForkFinder) Purge(all bool, toPurge ...p2p.Peer)
- func (ff *ForkFinder) UpdateAgreement(peer p2p.Peer, lid types.LayerID, hash types.Hash32, created time.Time)
- type Option
- type Syncer
Constants ¶
This section is empty.
Variables ¶
var ( ErrPeerMeshChangedMidSession = errors.New("peer mesh changed mid session") ErrNodeMeshChangedMidSession = errors.New("node mesh changed mid session") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Interval time.Duration EpochEndFraction float64 HareDelayLayers uint32 SyncCertDistance uint32 MaxStaleDuration time.Duration Standalone bool }
Config is the config params for syncer.
type DataFetch ¶
type DataFetch struct {
// contains filtered or unexported fields
}
DataFetch contains the logic of fetching mesh data.
func NewDataFetch ¶
func NewDataFetch(msh meshProvider, fetch fetcher, ids idProvider, cache activeSetCache, lg log.Log) *DataFetch
NewDataFetch creates a new DataFetch instance.
func (*DataFetch) GetEpochATXs ¶
GetEpochATXs fetches all ATXs published in the specified epoch from a peer.
func (*DataFetch) PollLayerData ¶
PollLayerData polls all peers for data in the specified layer.
func (*DataFetch) PollLayerOpinions ¶
func (d *DataFetch) PollLayerOpinions(ctx context.Context, lid types.LayerID) ([]*fetch.LayerOpinion, error)
PollLayerOpinions polls all peers for opinions in the specified layer.
type ForkFinder ¶
type ForkFinder struct {
// contains filtered or unexported fields
}
func NewForkFinder ¶
func (*ForkFinder) AddResynced ¶
func (ff *ForkFinder) AddResynced(lid types.LayerID, hash types.Hash32)
func (*ForkFinder) FindFork ¶
func (ff *ForkFinder) FindFork(ctx context.Context, peer p2p.Peer, diffLid types.LayerID, diffHash types.Hash32) (types.LayerID, error)
FindFork finds the point of divergence in layer opinions between the node and the specified peer from a given disagreed layer.
func (*ForkFinder) NeedResync ¶
func (*ForkFinder) NumPeersCached ¶
func (ff *ForkFinder) NumPeersCached() int
NumPeersCached returns the number of peer agreement cached.
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer is responsible to keep the node in sync with the network.
func NewSyncer ¶
func NewSyncer( cdb *datastore.CachedDB, ticker layerTicker, beacon system.BeaconGetter, mesh *mesh.Mesh, cache activeSetCache, fetcher fetcher, patrol layerPatrol, ch certHandler, opts ...Option, ) *Syncer
NewSyncer creates a new Syncer instance.
func (*Syncer) Close ¶
func (s *Syncer) Close()
Close stops the syncing process and the goroutines syncer spawns.
func (*Syncer) ListenToATXGossip ¶
ListenToATXGossip returns true if the node is listening to gossip for ATXs data.
func (*Syncer) ListenToGossip ¶
ListenToGossip returns true if the node is listening to gossip for blocks/TXs data.
func (*Syncer) RegisterForATXSynced ¶
func (s *Syncer) RegisterForATXSynced() chan struct{}
RegisterForATXSynced returns a channel for notification when the node enters ATX synced state.