mithril_common/digesters/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Tools to compute mithril digest from a Cardano node database.

pub mod cache;
mod cardano_immutable_digester;
mod dumb_immutable_digester;
mod immutable_digester;
mod immutable_file;
mod immutable_file_observer;
mod ledger_file;

pub use cardano_immutable_digester::CardanoImmutableDigester;
pub use immutable_digester::{
    ComputedImmutablesDigests, ImmutableDigester, ImmutableDigesterError,
};
pub use immutable_file::{ImmutableFile, ImmutableFileCreationError, ImmutableFileListingError};
pub use immutable_file_observer::{
    DumbImmutableFileObserver, ImmutableFileObserver, ImmutableFileObserverError,
    ImmutableFileSystemObserver,
};
pub use ledger_file::{LedgerFile, LedgerFileListingError};

pub use dumb_immutable_digester::DumbImmutableDigester;

/// Directory name for the immutable files.
pub const IMMUTABLE_DIR: &str = "immutable";
/// Directory name for the ledger files.
pub const LEDGER_DIR: &str = "ledger";
/// Directory name for the volatile files.
pub const VOLATILE_DIR: &str = "volatile";

/// Returns the names of the files that compose an immutable trio.
pub fn immutable_trio_names(
    immutable_file_number: crate::entities::ImmutableFileNumber,
) -> Vec<String> {
    vec![
        format!("{:05}.chunk", immutable_file_number),
        format!("{:05}.primary", immutable_file_number),
        format!("{:05}.secondary", immutable_file_number),
    ]
}

cfg_test_tools! {
    mod dummy_cardano_db;

    pub use dummy_cardano_db::{DummyCardanoDb, DummyCardanoDbBuilder};
}