cfxcore/pos/consensus/consensusdb/schema/
mod.rs

1// Copyright (c) The Diem Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2021 Conflux Foundation. All rights reserved.
5// Conflux is free software and distributed under GNU General Public License.
6// See http://www.gnu.org/licenses/
7
8use anyhow::{ensure, Result};
9
10use schemadb::ColumnFamilyName;
11
12pub(crate) mod block;
13pub(crate) mod ledger_block;
14pub(crate) mod quorum_certificate;
15pub(crate) mod single_entry;
16pub(crate) mod staking_event;
17
18pub(super) const BLOCK_CF_NAME: ColumnFamilyName = "block";
19pub(super) const QC_CF_NAME: ColumnFamilyName = "quorum_certificate";
20pub(super) const SINGLE_ENTRY_CF_NAME: ColumnFamilyName = "single_entry";
21pub(super) const LEDGER_BLOCK_CF_NAME: ColumnFamilyName = "ledger_block";
22pub(super) const STAKING_EVENTS_CF_NAME: ColumnFamilyName = "staking_event";
23
24fn ensure_slice_len_eq(data: &[u8], len: usize) -> Result<()> {
25    ensure!(
26        data.len() == len,
27        "Unexpected data len {}, expected {}.",
28        data.len(),
29        len,
30    );
31    Ok(())
32}