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