syncer

package
v0.2.1-beta.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 13 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, mesh *mesh.Mesh, fetcher layerFetcher, 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

Jump to

Keyboard shortcuts

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