Documentation ¶
Index ¶
Constants ¶
const DefaultAdvancementThreshold = 0.0
DefaultAdvancementThreshold is the default threshold at which a checkpoint advancement is done. Per default an advancement is always done as soon the solid milestone enters the range between the previous and current checkpoint.
Variables ¶
This section is empty.
Functions ¶
func CheckpointCaller ¶
func CheckpointCaller(handler interface{}, params ...interface{})
func SyncDoneCaller ¶
func SyncDoneCaller(handler interface{}, params ...interface{})
func SyncStartCaller ¶
func SyncStartCaller(handler interface{}, params ...interface{})
Types ¶
type AdvanceCheckpointCriteria ¶
type AdvanceCheckpointCriteria func(currentSolid, previousCheckpoint, currentCheckpoint milestone.Index) bool
AdvanceCheckpointCriteria is a function which determines whether the checkpoint should be advanced.
func AdvanceAtPercentageReached ¶
func AdvanceAtPercentageReached(threshold float64) AdvanceCheckpointCriteria
AdvanceAtPercentageReached is an AdvanceCheckpointCriteria which advances the checkpoint when the current one was reached by >=X% by the current solid milestone in relation to the previous checkpoint.
type Events ¶
type Events struct { // Fired when a new set of milestones should be requested. CheckpointUpdated *events.Event // Fired when the target milestone is updated. TargetUpdated *events.Event // Fired when warp synchronization starts. Start *events.Event // Fired when the warp synchronization is done. Done *events.Event }
Events holds WarpSync related events.
type WarpSync ¶
type WarpSync struct { Events Events // The starting point of the synchronization. Init milestone.Index // The current solid milestone of the node. CurrentSolidMs milestone.Index // The target milestone to which to synchronize to. TargetMs milestone.Index // The previous checkpoint of the synchronization. PreviousCheckpoint milestone.Index // The current checkpoint of the synchronization. CurrentCheckpoint milestone.Index // The used advancement range per checkpoint. AdvancementRange int // contains filtered or unexported fields }
WarpSync is metadata about doing a synchronization via STING messages.
func New ¶
func New(advRange int, advanceCheckpointCriteriaFunc ...AdvanceCheckpointCriteria) *WarpSync
New creates a new WarpSync instance with the given advancement range and criteria func. If no advancement func is provided, the WarpSync uses AdvanceAtPercentageReached with DefaultAdvancementThreshold.
func (*WarpSync) UpdateCurrent ¶
UpdateCurrent updates the current solid milestone index state.
func (*WarpSync) UpdateTarget ¶
UpdateTarget updates the synchronization target if it is higher than the current one and triggers a synchronization start if the target was set for the first time.