Skip to main content

cmpb/
store.rs

1/// block structure used in serialization
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct SerializedBlock {
5    /// header of block
6    #[prost(message, optional, tag = "1")]
7    pub header: ::core::option::Option<super::common::BlockHeader>,
8    /// transaction execution sequence of the block, described by DAG
9    #[prost(message, optional, tag = "2")]
10    pub dag: ::core::option::Option<super::common::Dag>,
11    /// transaction id list within the block
12    #[prost(string, repeated, tag = "3")]
13    pub tx_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
14    /// block additional data, not included in block hash calculation
15    #[prost(message, optional, tag = "4")]
16    pub additional_data: ::core::option::Option<super::common::AdditionalData>,
17}
18/// Block and its read/write set information
19#[allow(clippy::derive_partial_eq_without_eq)]
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct BlockWithRwSet {
22    /// block data
23    #[prost(message, optional, tag = "1")]
24    pub block: ::core::option::Option<super::common::Block>,
25    /// transaction read/write set of blocks
26    #[prost(message, repeated, tag = "2")]
27    pub tx_rw_sets: ::prost::alloc::vec::Vec<super::common::TxRwSet>,
28    /// contract event info
29    #[prost(message, repeated, tag = "3")]
30    pub contract_events: ::prost::alloc::vec::Vec<super::common::ContractEvent>,
31}
32/// transaction info include transaction and its block height hash and tx index
33#[allow(clippy::derive_partial_eq_without_eq)]
34#[derive(Clone, PartialEq, ::prost::Message)]
35pub struct TransactionStoreInfo {
36    /// transaction raw data
37    #[prost(message, optional, tag = "1")]
38    pub transaction: ::core::option::Option<super::common::Transaction>,
39    /// block height
40    #[prost(uint64, tag = "2")]
41    pub block_height: u64,
42    /// Deprecated, block hash
43    #[prost(bytes = "vec", tag = "3")]
44    pub block_hash: ::prost::alloc::vec::Vec<u8>,
45    /// transaction index in block
46    #[prost(uint32, tag = "4")]
47    pub tx_index: u32,
48    /// block header timestamp
49    #[prost(int64, tag = "5")]
50    pub block_timestamp: i64,
51    /// transaction offset index in file
52    #[prost(message, optional, tag = "6")]
53    pub transaction_store_info: ::core::option::Option<StoreInfo>,
54}
55/// store data information
56#[allow(clippy::derive_partial_eq_without_eq)]
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct StoreInfo {
59    /// store type
60    #[prost(enumeration = "DataStoreType", tag = "1")]
61    pub store_type: i32,
62    /// file name
63    #[prost(string, tag = "2")]
64    pub file_name: ::prost::alloc::string::String,
65    /// offset in file
66    #[prost(uint64, tag = "3")]
67    pub offset: u64,
68    /// data length
69    #[prost(uint64, tag = "4")]
70    pub byte_len: u64,
71}
72/// xxx.fdb information
73#[allow(clippy::derive_partial_eq_without_eq)]
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct FileRange {
76    /// file name: 00000000000000000019.xxx
77    #[prost(string, tag = "1")]
78    pub file_name: ::prost::alloc::string::String,
79    /// file contains block start height
80    #[prost(uint64, tag = "2")]
81    pub start: u64,
82    /// file contains block end height
83    #[prost(uint64, tag = "3")]
84    pub end: u64,
85}
86/// archive status data
87#[allow(clippy::derive_partial_eq_without_eq)]
88#[derive(Clone, PartialEq, ::prost::Message)]
89pub struct ArchiveStatus {
90    /// store type
91    #[prost(enumeration = "StoreType", tag = "1")]
92    pub r#type: i32,
93    /// file range data
94    #[prost(message, repeated, tag = "2")]
95    pub file_ranges: ::prost::alloc::vec::Vec<FileRange>,
96    /// current archive pivot height
97    #[prost(uint64, tag = "3")]
98    pub archive_pivot: u64,
99    /// max allow archive height
100    #[prost(uint64, tag = "4")]
101    pub max_allow_archive_height: u64,
102    /// node archive process status
103    #[prost(enumeration = "ArchiveProcess", tag = "5")]
104    pub process: i32,
105}
106#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
107#[repr(i32)]
108pub enum DbType {
109    InvalidDb = 0,
110    BlockDb = 1,
111    BlockIndexDb = 2,
112    TxDb = 3,
113    TxIndexDb = 4,
114    SoftDb = 5,
115    StateDb = 6,
116    ReadWriteDb = 7,
117}
118impl DbType {
119    /// String value of the enum field names used in the ProtoBuf definition.
120    ///
121    /// The values are not transformed in any way and thus are considered stable
122    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
123    pub fn as_str_name(&self) -> &'static str {
124        match self {
125            DbType::InvalidDb => "INVALID_DB",
126            DbType::BlockDb => "BLOCK_DB",
127            DbType::BlockIndexDb => "BLOCK_INDEX_DB",
128            DbType::TxDb => "TX_DB",
129            DbType::TxIndexDb => "TX_INDEX_DB",
130            DbType::SoftDb => "SOFT_DB",
131            DbType::StateDb => "STATE_DB",
132            DbType::ReadWriteDb => "READ_WRITE_DB",
133        }
134    }
135    /// Creates an enum from field names used in the ProtoBuf definition.
136    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
137        match value {
138            "INVALID_DB" => Some(Self::InvalidDb),
139            "BLOCK_DB" => Some(Self::BlockDb),
140            "BLOCK_INDEX_DB" => Some(Self::BlockIndexDb),
141            "TX_DB" => Some(Self::TxDb),
142            "TX_INDEX_DB" => Some(Self::TxIndexDb),
143            "SOFT_DB" => Some(Self::SoftDb),
144            "STATE_DB" => Some(Self::StateDb),
145            "READ_WRITE_DB" => Some(Self::ReadWriteDb),
146            _ => None,
147        }
148    }
149}
150#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
151#[repr(i32)]
152pub enum DataStoreType {
153    /// 文件系统存储
154    FileStore = 0,
155    /// SQL数据库存储
156    SqlStore = 1,
157    /// 云对象存储
158    Cos = 2,
159}
160impl DataStoreType {
161    /// String value of the enum field names used in the ProtoBuf definition.
162    ///
163    /// The values are not transformed in any way and thus are considered stable
164    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
165    pub fn as_str_name(&self) -> &'static str {
166        match self {
167            DataStoreType::FileStore => "FILE_STORE",
168            DataStoreType::SqlStore => "SQL_STORE",
169            DataStoreType::Cos => "COS",
170        }
171    }
172    /// Creates an enum from field names used in the ProtoBuf definition.
173    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
174        match value {
175            "FILE_STORE" => Some(Self::FileStore),
176            "SQL_STORE" => Some(Self::SqlStore),
177            "COS" => Some(Self::Cos),
178            _ => None,
179        }
180    }
181}
182/// store type
183#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
184#[repr(i32)]
185pub enum StoreType {
186    RawDb = 0,
187    Bfdb = 1,
188}
189impl StoreType {
190    /// String value of the enum field names used in the ProtoBuf definition.
191    ///
192    /// The values are not transformed in any way and thus are considered stable
193    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
194    pub fn as_str_name(&self) -> &'static str {
195        match self {
196            StoreType::RawDb => "RawDB",
197            StoreType::Bfdb => "BFDB",
198        }
199    }
200    /// Creates an enum from field names used in the ProtoBuf definition.
201    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
202        match value {
203            "RawDB" => Some(Self::RawDb),
204            "BFDB" => Some(Self::Bfdb),
205            _ => None,
206        }
207    }
208}
209/// archive in process status
210#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
211#[repr(i32)]
212pub enum ArchiveProcess {
213    /// chain is normal status
214    Normal = 0,
215    /// chain is doing archive
216    Archiving = 1,
217    /// chain is doing restore
218    Restoring = 2,
219}
220impl ArchiveProcess {
221    /// String value of the enum field names used in the ProtoBuf definition.
222    ///
223    /// The values are not transformed in any way and thus are considered stable
224    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
225    pub fn as_str_name(&self) -> &'static str {
226        match self {
227            ArchiveProcess::Normal => "Normal",
228            ArchiveProcess::Archiving => "Archiving",
229            ArchiveProcess::Restoring => "Restoring",
230        }
231    }
232    /// Creates an enum from field names used in the ProtoBuf definition.
233    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
234        match value {
235            "Normal" => Some(Self::Normal),
236            "Archiving" => Some(Self::Archiving),
237            "Restoring" => Some(Self::Restoring),
238            _ => None,
239        }
240    }
241}
242/// KeyModification -- QueryResult for history db query. Holds a transaction ID, value,
243/// timestamp, and delete marker which resulted from a history query.
244#[allow(clippy::derive_partial_eq_without_eq)]
245#[derive(Clone, PartialEq, ::prost::Message)]
246pub struct KeyModification {
247    #[prost(string, tag = "1")]
248    pub tx_id: ::prost::alloc::string::String,
249    #[prost(bytes = "vec", tag = "2")]
250    pub value: ::prost::alloc::vec::Vec<u8>,
251    #[prost(int64, tag = "3")]
252    pub timestamp: i64,
253    #[prost(bool, tag = "4")]
254    pub is_delete: bool,
255    #[prost(uint64, tag = "5")]
256    pub block_height: u64,
257}
258#[allow(clippy::derive_partial_eq_without_eq)]
259#[derive(Clone, PartialEq, ::prost::Message)]
260pub struct TxHistory {
261    #[prost(string, tag = "1")]
262    pub tx_id: ::prost::alloc::string::String,
263    #[prost(uint64, tag = "2")]
264    pub block_height: u64,
265    #[prost(bytes = "vec", tag = "3")]
266    pub block_hash: ::prost::alloc::vec::Vec<u8>,
267    #[prost(int64, tag = "4")]
268    pub timestamp: i64,
269}
270#[allow(clippy::derive_partial_eq_without_eq)]
271#[derive(Clone, PartialEq, ::prost::Message)]
272pub struct Kv {
273    #[prost(string, tag = "1")]
274    pub contract_name: ::prost::alloc::string::String,
275    #[prost(bytes = "vec", tag = "2")]
276    pub key: ::prost::alloc::vec::Vec<u8>,
277    #[prost(bytes = "vec", tag = "3")]
278    pub value: ::prost::alloc::vec::Vec<u8>,
279}