syncmanager

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MilestoneIndexDelta

type MilestoneIndexDelta = uint32

MilestoneIndexDelta is a the type used to describe an amount of Milestones that should be used to offset a certain Index.

type SyncManager

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

func New

func New(ledgerIndex iotago.MilestoneIndex, protocolManager *protocol.Manager) (*SyncManager, error)

func (*SyncManager) ConfirmedMilestoneIndex

func (s *SyncManager) ConfirmedMilestoneIndex() iotago.MilestoneIndex

ConfirmedMilestoneIndex returns the confirmed milestone index.

func (*SyncManager) IsNodeAlmostSynced

func (s *SyncManager) IsNodeAlmostSynced() bool

IsNodeAlmostSynced returns whether the node is synced within "isNodeAlmostSyncedThreshold".

func (*SyncManager) IsNodeSynced

func (s *SyncManager) IsNodeSynced() bool

IsNodeSynced returns whether the node is synced.

func (*SyncManager) IsNodeSyncedWithThreshold

func (s *SyncManager) IsNodeSyncedWithThreshold(threshold MilestoneIndexDelta) bool

IsNodeSyncedWithThreshold returns whether the node is synced within a given threshold.

func (*SyncManager) IsNodeSyncedWithinBelowMaxDepth

func (s *SyncManager) IsNodeSyncedWithinBelowMaxDepth() bool

IsNodeSyncedWithinBelowMaxDepth returns whether the node is synced within "belowMaxDepth".

func (*SyncManager) LatestMilestoneIndex

func (s *SyncManager) LatestMilestoneIndex() iotago.MilestoneIndex

LatestMilestoneIndex returns the latest milestone index.

func (*SyncManager) OverwriteConfirmedMilestoneIndex

func (s *SyncManager) OverwriteConfirmedMilestoneIndex(index iotago.MilestoneIndex)

OverwriteConfirmedMilestoneIndex is used to set older confirmed milestones (revalidation).

func (*SyncManager) ResetMilestoneIndexes

func (s *SyncManager) ResetMilestoneIndexes()

func (*SyncManager) SetConfirmedMilestoneIndex

func (s *SyncManager) SetConfirmedMilestoneIndex(index iotago.MilestoneIndex, updateSynced ...bool) error

SetConfirmedMilestoneIndex sets the confirmed milestone index.

func (*SyncManager) SetLatestMilestoneIndex

func (s *SyncManager) SetLatestMilestoneIndex(index iotago.MilestoneIndex, updateSynced ...bool) bool

SetLatestMilestoneIndex sets the latest milestone index.

func (*SyncManager) SyncState

func (s *SyncManager) SyncState() *SyncState

func (*SyncManager) WaitForNodeSynced

func (s *SyncManager) WaitForNodeSynced(timeout time.Duration) bool

WaitForNodeSynced waits at most "timeout" duration for the node to become fully sync. if it is not at least synced within threshold, it will return false immediately. this is used to avoid small glitches of IsNodeSynced when the sync state is important, but a new milestone came in lately.

type SyncState

type SyncState struct {
	NodeSynced                    bool
	NodeAlmostSynced              bool
	NodeSyncedWithinBelowMaxDepth bool
	LatestMilestoneIndex          iotago.MilestoneIndex
	ConfirmedMilestoneIndex       iotago.MilestoneIndex
}

Jump to

Keyboard shortcuts

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