123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* Copyright (c) 2020 Nomadic Labs. <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)moduleRequest=structtypeview=HashofBlock_hash.t|PeerIdofP2p_peer.Id.tletencoding=letopenData_encodinginunion[case(Tag0)~title:"Hash"(obj1(req"hash"Block_hash.encoding))(functionHashh->Someh|_->None)(funh->Hashh);case(Tag1)~title:"Peer_id"(obj1(req"peer_id"P2p_peer.Id.encoding))(functionPeerIdpid->Somepid|_->None)(funpid->PeerIdpid);]letppppf=function|Hashh->Block_hash.ppppfh|PeerIdpid->P2p_peer.Id.ppppfpidendtypesynchronisation_status=|Synchronisedof{is_chain_stuck:bool}|Not_synchronisedletsync_status_encoding=letopenData_encodingindef"chain_status"~description:"If 'unsynced', the node is not currently synchronized with of its peers \
(it is probably still bootstrapping and its head is lagging behind the \
chain's).\n\
If 'synced', the node considers itself synchronized with its peers and \
the current head timestamp is recent.\n\
If 'stuck', the node considers itself synchronized with its peers but \
the chain seems to be halted from its viewpoint."(string_enum[("synced",Synchronised{is_chain_stuck=false});("unsynced",Not_synchronised);("stuck",Synchronised{is_chain_stuck=true});])letsync_status_ppfmt=function|Synchronised{is_chain_stuck=true}->Format.fprintffmt"stuck"|Synchronised{is_chain_stuck=false}->Format.fprintffmt"synced"|Not_synchronised->Format.fprintffmt"unsynced"typeupdate=Ignored_head|Branch_switch|Head_incrementletupdate_encoding=letopenData_encodingindef"chain_update"~description:"If 'ignored', the new validated block is ignored since the current head \
fitness is better. If 'branch', we have set our head to a new validated \
block which is not the direct successor of the previous head. If \
'increment', the new validated head is the direct successor of the \
previous head."(string_enum[("ignored",Ignored_head);("branch",Branch_switch);("increment",Head_increment);])moduleDistributed_db_state=structtypetable_scheduler={table_length:int;scheduler_length:int}typeview={p2p_readers_length:int;active_chains_length:int;operation_db:table_scheduler;operations_db:table_scheduler;block_header_db:table_scheduler;active_connections_length:int;active_peers_length:int;}lettable_scheduler_encoding=letopenData_encodinginconv(fun{table_length;scheduler_length}->(table_length,scheduler_length))(fun(table_length,scheduler_length)->{table_length;scheduler_length})(obj2(req"table_length"int31)(req"scheduler_length"int31))letencoding=letopenData_encodinginconv(fun{p2p_readers_length;active_chains_length;operation_db;operations_db;block_header_db;active_connections_length;active_peers_length;}->(p2p_readers_length,active_chains_length,operation_db,operations_db,block_header_db,active_connections_length,active_peers_length))(fun(p2p_readers_length,active_chains_length,operation_db,operations_db,block_header_db,active_connections_length,active_peers_length)->{p2p_readers_length;active_chains_length;operation_db;operations_db;block_header_db;active_connections_length;active_peers_length;})(obj7(req"p2p_readers"int31)(req"active_chains"int31)(req"operation_db"table_scheduler_encoding)(req"operations_db"table_scheduler_encoding)(req"block_header_db"table_scheduler_encoding)(req"active_connections"int31)(req"active_peers"int31))end