progress

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainSyncType

type ChainSyncType string
const (
	ChainSyncRestore ChainSyncType = "restore"
	ChainSyncBulk    ChainSyncType = "bulk-sync"
)

type Progression

type Progression struct {
	// SyncType is indicating the sync method
	SyncType ChainSyncType

	// SyncingPeer is current syncing peer id
	SyncingPeer string

	// StartingBlock is the initial block that the node is starting
	// the sync from. It is reset after every sync batch
	StartingBlock uint64

	// CurrentBlock is the last written block from the sync batch
	CurrentBlock uint64

	// HighestBlock is the target block in the sync batch
	HighestBlock *atomic.Uint64
	// contains filtered or unexported fields
}

Progression defines the status of the sync progression of the node

func (*Progression) GetHighestBlock added in v1.2.4

func (p *Progression) GetHighestBlock() uint64

type ProgressionWrapper

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

func NewProgressionWrapper

func NewProgressionWrapper(syncType ChainSyncType) *ProgressionWrapper

func (*ProgressionWrapper) GetProgression

func (pw *ProgressionWrapper) GetProgression() *Progression

GetProgression returns the latest sync progression

func (*ProgressionWrapper) StartProgression

func (pw *ProgressionWrapper) StartProgression(
	syncingPeer string,
	startingBlock uint64,
	subscription blockchain.Subscription,
)

startProgression initializes the progression tracking

func (*ProgressionWrapper) StopProgression

func (pw *ProgressionWrapper) StopProgression()

StopProgression stops the progression tracking

func (*ProgressionWrapper) UpdateCurrentProgression

func (pw *ProgressionWrapper) UpdateCurrentProgression(currentBlock uint64)

UpdateCurrentProgression sets the currently written block in the bulk sync

func (*ProgressionWrapper) UpdateHighestProgression

func (pw *ProgressionWrapper) UpdateHighestProgression(highestBlock uint64)

UpdateHighestProgression sets the highest-known target block in the bulk sync

Jump to

Keyboard shortcuts

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