diff --git a/consensus/fast-sync/src/create.rs b/consensus/fast-sync/src/create.rs index 2e2b047..dc2311f 100644 --- a/consensus/fast-sync/src/create.rs +++ b/consensus/fast-sync/src/create.rs @@ -3,7 +3,9 @@ use std::{fmt::Write, fs::write}; use clap::Parser; use tower::{Service, ServiceExt}; -use cuprate_blockchain::{config::ConfigBuilder, service::DatabaseReadHandle, RuntimeError}; +use cuprate_blockchain::{ + config::ConfigBuilder, cuprate_database::RuntimeError, service::DatabaseReadHandle, +}; use cuprate_types::blockchain::{BCReadRequest, BCResponse}; use cuprate_fast_sync::{hash_of_hashes, BlockId, HashOfHashes}; diff --git a/storage/blockchain/README.md b/storage/blockchain/README.md index 6c2a177..8a2162c 100644 --- a/storage/blockchain/README.md +++ b/storage/blockchain/README.md @@ -19,6 +19,14 @@ or at the very least the [`ops`] module instead of interacting with the `cuprate # `cuprate_database` Consider reading `cuprate_database`'s crate documentation before this crate, as it is the first layer. +If/when this crate needs is used, be sure to use the version that this crate re-exports, e.g.: +```rust +use cuprate_blockchain::{ + cuprate_database::RuntimeError, +}; +``` +This ensures the types/traits used from `cuprate_database` are the same ones used by `cuprate_blockchain` internally. + # Feature flags The `service` module requires the `service` feature to be enabled. See the module for more documentation. @@ -52,13 +60,12 @@ For examples of the higher-level APIs, see: - [`service`] ```rust -use cuprate_database::{ - ConcreteEnv, - Env, EnvInner, - DatabaseRo, DatabaseRw, TxRo, TxRw, -}; - use cuprate_blockchain::{ + cuprate_database::{ + ConcreteEnv, + Env, EnvInner, + DatabaseRo, DatabaseRw, TxRo, TxRw, + }, config::ConfigBuilder, tables::{Tables, TablesMut}, OpenTables, diff --git a/storage/blockchain/src/config/mod.rs b/storage/blockchain/src/config/mod.rs index fd3ff72..291a0c2 100644 --- a/storage/blockchain/src/config/mod.rs +++ b/storage/blockchain/src/config/mod.rs @@ -14,9 +14,10 @@ //! //! # Example //! ```rust -//! use cuprate_database::{Env, config::SyncMode}; -//! -//! use cuprate_blockchain::config::{ConfigBuilder, ReaderThreads}; +//! use cuprate_blockchain::{ +//! cuprate_database::{Env, config::SyncMode}, +//! config::{ConfigBuilder, ReaderThreads}, +//! }; //! //! # fn main() -> Result<(), Box> { //! let tmp_dir = tempfile::tempdir()?; diff --git a/storage/blockchain/src/lib.rs b/storage/blockchain/src/lib.rs index 87e9ac9..95b6bb9 100644 --- a/storage/blockchain/src/lib.rs +++ b/storage/blockchain/src/lib.rs @@ -121,6 +121,8 @@ pub mod ops; pub mod tables; pub mod types; +pub use cuprate_database; + //---------------------------------------------------------------------------------------------------- Feature-gated #[cfg(feature = "service")] pub mod service; diff --git a/storage/blockchain/src/ops/mod.rs b/storage/blockchain/src/ops/mod.rs index fc234fa..5821120 100644 --- a/storage/blockchain/src/ops/mod.rs +++ b/storage/blockchain/src/ops/mod.rs @@ -55,13 +55,12 @@ //! use hex_literal::hex; //! //! use cuprate_test_utils::data::block_v16_tx0; -//! use cuprate_database::{ -//! ConcreteEnv, -//! Env, EnvInner, -//! DatabaseRo, DatabaseRw, TxRo, TxRw, -//! }; -//! //! use cuprate_blockchain::{ +//! cuprate_database::{ +//! ConcreteEnv, +//! Env, EnvInner, +//! DatabaseRo, DatabaseRw, TxRo, TxRw, +//! }, //! OpenTables, //! config::ConfigBuilder, //! tables::{Tables, TablesMut}, diff --git a/storage/blockchain/src/service/mod.rs b/storage/blockchain/src/service/mod.rs index 105a224..1d9d10b 100644 --- a/storage/blockchain/src/service/mod.rs +++ b/storage/blockchain/src/service/mod.rs @@ -65,9 +65,11 @@ //! //! use cuprate_types::blockchain::{BCReadRequest, BCWriteRequest, BCResponse}; //! use cuprate_test_utils::data::block_v16_tx0; -//! use cuprate_database::Env; //! -//! use cuprate_blockchain::config::ConfigBuilder; +//! use cuprate_blockchain::{ +//! cuprate_database::Env, +//! config::ConfigBuilder, +//! }; //! //! # #[tokio::main] //! # async fn main() -> Result<(), Box> {