Shell: rename Distributed_db.state
-> net_state
This commit is contained in:
parent
16cc5b7ec8
commit
e5c931c6a3
@ -343,7 +343,9 @@ let noop_callback = {
|
||||
|
||||
type t = db
|
||||
|
||||
let state { net_state } = net_state
|
||||
let state { disk } = disk
|
||||
let net_state { net_state } = net_state
|
||||
let db { global_db } = global_db
|
||||
|
||||
module P2p_reader = struct
|
||||
|
||||
|
@ -16,11 +16,13 @@ module Metadata = Distributed_db_metadata
|
||||
type p2p = (Message.t, Metadata.t) P2p.net
|
||||
|
||||
val create: State.t -> p2p -> t
|
||||
val state: db -> State.t
|
||||
val shutdown: t -> unit Lwt.t
|
||||
|
||||
type net_db
|
||||
|
||||
val state: net_db -> State.Net.t
|
||||
val net_state: net_db -> State.Net.t
|
||||
val db: net_db -> db
|
||||
|
||||
type callback = {
|
||||
notify_branch: P2p.Peer_id.t -> Block_locator.t -> unit ;
|
||||
|
@ -441,7 +441,7 @@ module RPC = struct
|
||||
| None ->
|
||||
Lwt.return (Prevalidation.empty_result, Operation_hash.Set.empty)
|
||||
| Some (validator, net_db) ->
|
||||
let net_state = Distributed_db.state net_db in
|
||||
let net_state = Distributed_db.net_state net_db in
|
||||
let prevalidator = Validator.prevalidator validator in
|
||||
State.Block.read_exn net_state h >>= fun block ->
|
||||
Prevalidator.pending ~block prevalidator >|= fun ops ->
|
||||
@ -540,7 +540,7 @@ module RPC = struct
|
||||
match Validator.test_validator node.mainnet_validator with
|
||||
| None -> Lwt.return_nil
|
||||
| Some (_, net_db) ->
|
||||
Chain.known_heads (Distributed_db.state net_db)
|
||||
Chain.known_heads (Distributed_db.net_state net_db)
|
||||
end >>= fun test_heads ->
|
||||
Lwt_list.fold_left_s
|
||||
(fun map block ->
|
||||
|
@ -66,7 +66,7 @@ let merge _key a b =
|
||||
|
||||
let create net_db =
|
||||
|
||||
let net_state = Distributed_db.state net_db in
|
||||
let net_state = Distributed_db.net_state net_db in
|
||||
|
||||
let cancelation, cancel, _on_cancel = Lwt_utils.canceler () in
|
||||
let push_to_worker, worker_waiter = Lwt_utils.queue () in
|
||||
@ -351,7 +351,7 @@ let context pv = pv.context ()
|
||||
let shutdown pv = pv.shutdown ()
|
||||
|
||||
let inject_operation pv ?(force = false) (op: Operation.t) =
|
||||
let net_id = State.Net.id (Distributed_db.state pv.net_db) in
|
||||
let net_id = State.Net.id (Distributed_db.net_state pv.net_db) in
|
||||
let wrap_error h map =
|
||||
begin
|
||||
try return (Operation_hash.Map.find h map)
|
||||
|
@ -474,7 +474,7 @@ module Context_db = struct
|
||||
Lwt.return_unit
|
||||
|
||||
let process (v: net_validator) ~get_context ~set_context hash block =
|
||||
let net_state = Distributed_db.state v.net_db in
|
||||
let net_state = Distributed_db.net_state v.net_db in
|
||||
get_context v block.Block_header.shell.predecessor >>= function
|
||||
| Error _ as error ->
|
||||
Lwt_unix.yield () >>= fun () ->
|
||||
@ -561,7 +561,7 @@ module Context_db = struct
|
||||
| Some b -> Int64.to_float (Time.diff b.Block_header.shell.timestamp time)
|
||||
|
||||
let create net_db =
|
||||
let net_state = Distributed_db.state net_db in
|
||||
let net_state = Distributed_db.net_state net_db in
|
||||
let tbl = Block_hash.Table.create 50 in
|
||||
let canceler = Lwt_utils.Canceler.create () in
|
||||
let worker_trigger, worker_waiter = Lwt_utils.trigger () in
|
||||
|
Loading…
Reference in New Issue
Block a user