Module Distributed_db.Protocol

Index of protocol sources.

include Mavryk_requester.Requester.REQUESTER with type t := db and type key := Mavryk_base.TzPervasives.Protocol_hash.t and type value := Mavryk_base.Protocol.t and type param := unit
val known : db -> Mavryk_base.TzPervasives.Protocol_hash.t -> bool Lwt.t

know t k returns true iff the key is present in the memory table or the disk.

Return value if it is found in-memory, or else on disk. Otherwise fail with error Missing_data.

Same as read but returns None if not found.

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

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).

val clear_or_cancel : db -> Mavryk_base.TzPervasives.Protocol_hash.t -> unit

Remove the data from the memory table if present. Otherwise decrements the number of watcher to this data. If their is only one watcher any pending fetch promises are resolved with the error Canceled.