syncer

package
v0.2.7-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	SyncInterval time.Duration
	AlwaysListen bool
}

Configuration is the config params for syncer.

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(ctx context.Context, conf Configuration, ticker layerTicker, beacons system.BeaconGetter, mesh *mesh.Mesh, fetcher layerFetcher, patrol layerPatrol, logger log.Log) *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) ForceSync

func (s *Syncer) ForceSync(ctx context.Context) bool

ForceSync manually starts a sync process outside the main sync loop. If the node is already running a sync process, ForceSync will be ignored.

func (*Syncer) IsSynced

func (s *Syncer) IsSynced(ctx context.Context) bool

IsSynced returns true if the node is in synced state.

func (*Syncer) ListenToGossip

func (s *Syncer) ListenToGossip() bool

ListenToGossip returns true if the node is listening to gossip for blocks/TXs/ATXs data.

func (*Syncer) RegisterChForSynced

func (s *Syncer) RegisterChForSynced(ctx context.Context, ch chan struct{})

RegisterChForSynced registers ch for notification when the node enters synced state.

func (*Syncer) Start

func (s *Syncer) Start(ctx context.Context)

Start starts the main sync loop that tries to sync data for every SyncInterval.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL