statefulsyncer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StatefulSyncer

type StatefulSyncer struct {
	// contains filtered or unexported fields
}

StatefulSyncer is an abstraction layer over the stateless syncer package. This layer handles sync restarts and provides fully populated blocks during reorgs (not provided by stateless syncer).

func New

func New(
	ctx context.Context,
	network *types.NetworkIdentifier,
	fetcher *fetcher.Fetcher,
	blockStorage *storage.BlockStorage,
	counterStorage *storage.CounterStorage,
	logger *logger.Logger,
	cancel context.CancelFunc,
	workers []storage.BlockWorker,
) *StatefulSyncer

New returns a new *StatefulSyncer.

func (*StatefulSyncer) BlockAdded

func (s *StatefulSyncer) BlockAdded(ctx context.Context, block *types.Block) error

BlockAdded is called by the syncer when a block is added.

func (*StatefulSyncer) BlockRemoved

func (s *StatefulSyncer) BlockRemoved(
	ctx context.Context,
	blockIdentifier *types.BlockIdentifier,
) error

BlockRemoved is called by the syncer when a block is removed.

func (*StatefulSyncer) Sync

func (s *StatefulSyncer) Sync(ctx context.Context, startIndex int64, endIndex int64) error

Sync starts a new sync run after properly initializing blockStorage.

Jump to

Keyboard shortcuts

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