Distributed_db: add an argument timeout
to 'prefetch`.
This commit is contained in:
parent
e5c931c6a3
commit
06873da197
@ -883,7 +883,11 @@ module type DISTRIBUTED_DB = sig
|
||||
val read_opt: t -> key -> value option Lwt.t
|
||||
val read_exn: t -> key -> value Lwt.t
|
||||
val watch: t -> (key * value) Lwt_stream.t * Watcher.stopper
|
||||
val prefetch: t -> ?peer:P2p.Peer_id.t -> key -> param -> unit
|
||||
val prefetch:
|
||||
t ->
|
||||
?peer:P2p.Peer_id.t ->
|
||||
?timeout:float ->
|
||||
key -> param -> unit
|
||||
val fetch:
|
||||
t ->
|
||||
?peer:P2p.Peer_id.t ->
|
||||
@ -909,7 +913,8 @@ module Make
|
||||
let read t k = Table.read (Kind.proj t) k
|
||||
let read_opt t k = Table.read_opt (Kind.proj t) k
|
||||
let read_exn t k = Table.read_exn (Kind.proj t) k
|
||||
let prefetch t ?peer k p = Table.prefetch (Kind.proj t) ?peer k p
|
||||
let prefetch t ?peer ?timeout k p =
|
||||
Table.prefetch (Kind.proj t) ?peer ?timeout k p
|
||||
let fetch t ?peer ?timeout k p =
|
||||
Table.fetch (Kind.proj t) ?peer ?timeout k p
|
||||
let clear_or_cancel t k = Table.clear_or_cancel (Kind.proj t) k
|
||||
|
@ -86,7 +86,11 @@ module type DISTRIBUTED_DB = sig
|
||||
val read_opt: t -> key -> value option Lwt.t
|
||||
val read_exn: t -> key -> value Lwt.t
|
||||
val watch: t -> (key * value) Lwt_stream.t * Watcher.stopper
|
||||
val prefetch: t -> ?peer:P2p.Peer_id.t -> key -> param -> unit
|
||||
val prefetch:
|
||||
t ->
|
||||
?peer:P2p.Peer_id.t ->
|
||||
?timeout:float ->
|
||||
key -> param -> unit
|
||||
val fetch:
|
||||
t ->
|
||||
?peer:P2p.Peer_id.t ->
|
||||
|
@ -26,7 +26,12 @@ module type DISTRIBUTED_DB = sig
|
||||
val read_opt: t -> key -> value option Lwt.t
|
||||
val read_exn: t -> key -> value Lwt.t
|
||||
|
||||
val prefetch: t -> ?peer:P2p.Peer_id.t -> key -> param -> unit
|
||||
val prefetch:
|
||||
t ->
|
||||
?peer:P2p.Peer_id.t ->
|
||||
?timeout:float ->
|
||||
key -> param -> unit
|
||||
|
||||
val fetch:
|
||||
t ->
|
||||
?peer:P2p.Peer_id.t ->
|
||||
@ -207,7 +212,8 @@ end = struct
|
||||
wrap s k ?timeout (Lwt.waiter_of_wakener data.wakener)
|
||||
| Found v -> return v
|
||||
|
||||
let prefetch s ?peer k param = Lwt.ignore_result (fetch s ?peer k param)
|
||||
let prefetch s ?peer ?timeout k param =
|
||||
try ignore (fetch s ?peer ?timeout k param) with _ -> ()
|
||||
|
||||
let notify s p k v =
|
||||
match Memory_table.find s.memory k with
|
||||
|
@ -24,7 +24,12 @@ module type DISTRIBUTED_DB = sig
|
||||
val read_opt: t -> key -> value option Lwt.t
|
||||
val read_exn: t -> key -> value Lwt.t
|
||||
|
||||
val prefetch: t -> ?peer:P2p.Peer_id.t -> key -> param -> unit
|
||||
val prefetch:
|
||||
t ->
|
||||
?peer:P2p.Peer_id.t ->
|
||||
?timeout:float ->
|
||||
key -> param -> unit
|
||||
|
||||
val fetch:
|
||||
t ->
|
||||
?peer:P2p.Peer_id.t ->
|
||||
|
@ -617,6 +617,8 @@ module Registred_protocol = struct
|
||||
val complete_b58prefix : Context.t -> string -> string list Lwt.t
|
||||
end
|
||||
|
||||
type t = (module T)
|
||||
|
||||
let build_v1 hash =
|
||||
let (module F) = Tezos_protocol_compiler.Registerer.get_exn hash in
|
||||
let module Name = struct
|
||||
@ -637,7 +639,8 @@ module Registred_protocol = struct
|
||||
VersionTable.create 20
|
||||
|
||||
let mem hash =
|
||||
VersionTable.mem versions hash || Tezos_protocol_compiler.Registerer.mem hash
|
||||
VersionTable.mem versions hash ||
|
||||
Tezos_protocol_compiler.Registerer.mem hash
|
||||
|
||||
let get_exn hash =
|
||||
try VersionTable.find versions hash
|
||||
@ -678,8 +681,6 @@ module Register_embedded_protocol
|
||||
let complete_b58prefix = Env.Context.complete
|
||||
end : Registred_protocol.T)
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
let read
|
||||
|
@ -202,10 +202,12 @@ module Registred_protocol : sig
|
||||
val complete_b58prefix : Context.t -> string -> string list Lwt.t
|
||||
end
|
||||
|
||||
type t = (module T)
|
||||
|
||||
val mem: Protocol_hash.t -> bool
|
||||
|
||||
val get: Protocol_hash.t -> (module T) option
|
||||
val get_exn: Protocol_hash.t -> (module T)
|
||||
val get: Protocol_hash.t -> t option
|
||||
val get_exn: Protocol_hash.t -> t
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user