package octez-shell-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=55ea1fb8bb3273a7fc270ca8f650d45c56449665619482aad9bc12f3ea736b7e
sha512=fec850fc2d17d7490bbabd5147d62aad13b3aaed8774270f8a38ab419670ed03e0fd30cf8642a97984eca5c2446726fe590ad99c015f7ec50919dc7652f25053
doc/octez-shell-libs.shell/Tezos_shell/Distributed_db/Block_header/index.html
Module Distributed_db.Block_header
Source
Index of block headers.
include Tezos_requester.Requester.REQUESTER
with type t := chain_db
and type key := Tezos_base.TzPervasives.Block_hash.t
and type value := Tezos_base.Block_header.t
and type param := unit
know t k
returns true iff the key is present in the memory table or the disk.
val read :
chain_db ->
Tezos_base.TzPervasives.Block_hash.t ->
Tezos_base.Block_header.t Tezos_base.TzPervasives.tzresult Lwt.t
Return value if it is found in-memory, or else on disk. Otherwise fail with error Missing_data
.
val read_opt :
chain_db ->
Tezos_base.TzPervasives.Block_hash.t ->
Tezos_base.Block_header.t option Lwt.t
Same as read
but returns None
if not found.
val inject :
chain_db ->
Tezos_base.TzPervasives.Block_hash.t ->
Tezos_base.Block_header.t ->
bool Lwt.t
inject t k v
returns false
if k
is already present in the memory table or in the disk, or has already been requested. Otherwise it updates the memory table and return true
val fetch :
chain_db ->
?peer:Tezos_base.TzPervasives.P2p_peer.Id.t ->
?timeout:Tezos_base.TzPervasives.Time.System.Span.t ->
Tezos_base.TzPervasives.Block_hash.t ->
unit ->
Tezos_base.Block_header.t Tezos_base.TzPervasives.tzresult Lwt.t
fetch t ?peer ?timeout k param
returns the value when it is known. It can fail with Timeout k
if timeout
is provided and the value isn't know before the timeout expires. It can fail with Cancel
if the request is canceled.
The key is first looked up in memory, then on disk. If not present and not already requested, it schedules a request, and blocks until the requester is notified with notify
. param
is used to validate the notified value once it is received. (see also PROBE
and notify
).
Requests are re-sent via a 1.5 exponential back-off, with initial delay set to Request.initial_delay
. If the function is called multiple time with the same key but with distinct peers, the internal scheduler randomly chooses the requested peer (at each retry).