package octez-shell-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/octez-shell-libs.shell/Tezos_shell/Synchronisation_heuristic/Bootstrapping/index.html
Module Synchronisation_heuristic.Bootstrapping
Source
Bootstrapping
This module inherits from Core
and handle a bootstrapped flag as well as Lwt
callbacks when the status of heuristic or the bootstrap flag changes.
The bootstrap flag is set to true
in two cases:
- When the core heuristic status is
Synchronised
for the first time
- When
force_bootstrapped state b
is called withb = true
Only the function force_bootstrapped
can set the boolean flag to false
.
val create :
?when_bootstrapped_changes:(bool -> unit Lwt.t) ->
?when_status_changes:(status -> unit Lwt.t) ->
threshold:int ->
latency:int ->
unit ->
t
create ?when_bootstrapped_changes ?when_status_changes ~threshold ~latency ()
is a wrapper around Core.create ~threshold ~latency ()
.
when_status_changes
is a callback called immediately when the status changes (as a result of some calls toupdate
) and when the status is first set (as a result of callingactivate
).
when_bootstrapped_changes
is a callback called immediately when the bootstrap flagged changes (as a result of some calls toupdate
or toforce_bootstrapped
) or when the flag is first set (as a result of callingactivate
).
activate state
activates the heuristics. It sets the status and the bootstrap flag to their initial values (which depend on the initial value of threshold
) and calls the when_status_changes
and when_bootstrapped_changes
callbacks with these initial values.
This function is intended to be used once, after the call to create
and before the first call to update
.
update state candidate
is a wrapper around Core.update
. If an update
changes the status of the core heuristic, the when_status_changes
callback is called. Similarly, if an update
changes the bootstrap flag, the when_bootstrapped_changes
callback is called.
force_bootstrapped state b
forces the status of the bootstrap flag. If the value of the flag changes as a result, the callback when_bootstrapped_changes
is called.