Documentation ¶
Index ¶
- type MilestoneIndexDelta
- type SyncManager
- func (s *SyncManager) ConfirmedMilestoneIndex() iotago.MilestoneIndex
- func (s *SyncManager) IsNodeAlmostSynced() bool
- func (s *SyncManager) IsNodeSynced() bool
- func (s *SyncManager) IsNodeSyncedWithThreshold(threshold MilestoneIndexDelta) bool
- func (s *SyncManager) IsNodeSyncedWithinBelowMaxDepth() bool
- func (s *SyncManager) LatestMilestoneIndex() iotago.MilestoneIndex
- func (s *SyncManager) OverwriteConfirmedMilestoneIndex(index iotago.MilestoneIndex)
- func (s *SyncManager) ResetMilestoneIndexes()
- func (s *SyncManager) SetConfirmedMilestoneIndex(index iotago.MilestoneIndex, updateSynced ...bool) error
- func (s *SyncManager) SetLatestMilestoneIndex(index iotago.MilestoneIndex, updateSynced ...bool) bool
- func (s *SyncManager) SyncState() *SyncState
- func (s *SyncManager) WaitForNodeSynced(timeout time.Duration) bool
- type SyncState
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 }