cmpb/
sync.rs

1/// network message of synchronization module
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct SyncMsg {
5    /// sync message type
6    #[prost(enumeration = "sync_msg::MsgType", tag = "1")]
7    pub r#type: i32,
8    /// payload for the message
9    #[prost(bytes = "vec", tag = "2")]
10    pub payload: ::prost::alloc::vec::Vec<u8>,
11}
12/// Nested message and enum types in `SyncMsg`.
13pub mod sync_msg {
14    /// specific syncblockmessage types
15    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
16    #[repr(i32)]
17    pub enum MsgType {
18        NodeStatusReq = 0,
19        NodeStatusResp = 1,
20        BlockSyncReq = 2,
21        BlockSyncResp = 3,
22    }
23    impl MsgType {
24        /// String value of the enum field names used in the ProtoBuf definition.
25        ///
26        /// The values are not transformed in any way and thus are considered stable
27        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
28        pub fn as_str_name(&self) -> &'static str {
29            match self {
30                MsgType::NodeStatusReq => "NODE_STATUS_REQ",
31                MsgType::NodeStatusResp => "NODE_STATUS_RESP",
32                MsgType::BlockSyncReq => "BLOCK_SYNC_REQ",
33                MsgType::BlockSyncResp => "BLOCK_SYNC_RESP",
34            }
35        }
36        /// Creates an enum from field names used in the ProtoBuf definition.
37        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
38            match value {
39                "NODE_STATUS_REQ" => Some(Self::NodeStatusReq),
40                "NODE_STATUS_RESP" => Some(Self::NodeStatusResp),
41                "BLOCK_SYNC_REQ" => Some(Self::BlockSyncReq),
42                "BLOCK_SYNC_RESP" => Some(Self::BlockSyncResp),
43                _ => None,
44            }
45        }
46    }
47}
48/// response message for node status
49#[allow(clippy::derive_partial_eq_without_eq)]
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct BlockHeightBcm {
52    #[prost(uint64, tag = "1")]
53    pub block_height: u64,
54    #[prost(uint64, tag = "2")]
55    pub archived_height: u64,
56}
57/// block request message
58#[allow(clippy::derive_partial_eq_without_eq)]
59#[derive(Clone, PartialEq, ::prost::Message)]
60pub struct BlockSyncReq {
61    #[prost(uint64, tag = "1")]
62    pub block_height: u64,
63    #[prost(uint64, tag = "2")]
64    pub batch_size: u64,
65    #[prost(bool, tag = "3")]
66    pub with_rwset: bool,
67}
68/// batch blocks
69#[allow(clippy::derive_partial_eq_without_eq)]
70#[derive(Clone, PartialEq, ::prost::Message)]
71pub struct BlockBatch {
72    #[prost(message, repeated, tag = "1")]
73    pub batches: ::prost::alloc::vec::Vec<super::common::Block>,
74}
75/// information of batch blocks
76#[allow(clippy::derive_partial_eq_without_eq)]
77#[derive(Clone, PartialEq, ::prost::Message)]
78pub struct BlockInfoBatch {
79    #[prost(message, repeated, tag = "1")]
80    pub batch: ::prost::alloc::vec::Vec<super::common::BlockInfo>,
81}
82/// block response message
83#[allow(clippy::derive_partial_eq_without_eq)]
84#[derive(Clone, PartialEq, ::prost::Message)]
85pub struct SyncBlockBatch {
86    #[prost(bool, tag = "3")]
87    pub with_rwset: bool,
88    #[prost(oneof = "sync_block_batch::Data", tags = "1, 2")]
89    pub data: ::core::option::Option<sync_block_batch::Data>,
90}
91/// Nested message and enum types in `SyncBlockBatch`.
92pub mod sync_block_batch {
93    #[allow(clippy::derive_partial_eq_without_eq)]
94    #[derive(Clone, PartialEq, ::prost::Oneof)]
95    pub enum Data {
96        /// the response structure returned when requesting block data
97        #[prost(message, tag = "1")]
98        BlockBatch(super::BlockBatch),
99        /// when requesting a block and its read / write set data
100        #[prost(message, tag = "2")]
101        BlockinfoBatch(super::BlockInfoBatch),
102    }
103}