Documentation
¶
Index ¶
- Variables
- type StatefulSyncer
- func (s *StatefulSyncer) Block(ctx context.Context, network *types.NetworkIdentifier, ...) (*types.Block, error)
- func (s *StatefulSyncer) BlockAdded(ctx context.Context, block *types.Block) error
- func (s *StatefulSyncer) BlockRemoved(ctx context.Context, blockIdentifier *types.BlockIdentifier) error
- func (s *StatefulSyncer) EndAtTipLoop(ctx context.Context, tipDelay int64)
- func (s *StatefulSyncer) EndDurationLoop(ctx context.Context, duration time.Duration)
- func (s *StatefulSyncer) NetworkStatus(ctx context.Context, network *types.NetworkIdentifier) (*types.NetworkStatusResponse, error)
- func (s *StatefulSyncer) Sync(ctx context.Context, startIndex int64, endIndex int64) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // EndAtTipCheckInterval is the frequency that EndAtTip condition // is evaludated // // TODO: make configurable EndAtTipCheckInterval = 10 * time.Second )
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, concurrency uint64, ) *StatefulSyncer
New returns a new *StatefulSyncer.
func (*StatefulSyncer) Block ¶
func (s *StatefulSyncer) Block( ctx context.Context, network *types.NetworkIdentifier, block *types.PartialBlockIdentifier, ) (*types.Block, error)
Block is called by the syncer to fetch a block.
func (*StatefulSyncer) BlockAdded ¶
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) EndAtTipLoop ¶
func (s *StatefulSyncer) EndAtTipLoop( ctx context.Context, tipDelay int64, )
EndAtTipLoop runs a loop that evaluates end condition EndAtTip
func (*StatefulSyncer) EndDurationLoop ¶
func (s *StatefulSyncer) EndDurationLoop( ctx context.Context, duration time.Duration, )
EndDurationLoop runs a loop that evaluates end condition EndDuration
func (*StatefulSyncer) NetworkStatus ¶
func (s *StatefulSyncer) NetworkStatus( ctx context.Context, network *types.NetworkIdentifier, ) (*types.NetworkStatusResponse, error)
NetworkStatus is called by the syncer to get the current network status.
Click to show internal directories.
Click to hide internal directories.