package octez-shell-libs

  1. Overview
  2. Docs
Octez shell libraries

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/octez-shell-libs.shell/Tezos_shell/Synchronisation_heuristic/Bootstrapping/index.html

Module Synchronisation_heuristic.BootstrappingSource

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 with b = true

Only the function force_bootstrapped can set the boolean flag to false.

Sourcetype t
Sourceval 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 to update) and when the status is first set (as a result of calling activate).
  • when_bootstrapped_changes is a callback called immediately when the bootstrap flagged changes (as a result of some calls to update or to force_bootstrapped) or when the flag is first set (as a result of calling activate).
Sourceval activate : t -> unit Lwt.t

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.

Sourceval get_status : t -> status

get_status state is a wrapper around Core.get_status.

Sourceval is_bootstrapped : t -> bool

is_bootstrapped state returns the value of the bootstrap flag.

Sourceval force_bootstrapped : t -> bool -> unit Lwt.t

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.

Sourceval bootstrapped : t -> unit Lwt.t

bootstrapped state is a promise that becomes fulfilled when the current bootstrap flag becomes true. If the bootstrap flag is already true, the promise is already resolved.

OCaml

Innovation. Community. Security.