chore(reth-db): no_std support (#9597)

This commit is contained in:
nk_ysg
2024-07-18 17:52:02 +08:00
committed by GitHub
parent 54d3734c2f
commit 6aabf13bd2
4 changed files with 19 additions and 7 deletions

View File

@ -451,7 +451,7 @@ humantime-serde = "1.1"
rand = "0.8.5" rand = "0.8.5"
rustc-hash = { version = "2.0", default-features = false } rustc-hash = { version = "2.0", default-features = false }
schnellru = "0.2" schnellru = "0.2"
strum = "0.26" strum = { version = "0.26", default-features = false }
rayon = "1.7" rayon = "1.7"
itertools = "0.13" itertools = "0.13"
parking_lot = "0.12" parking_lot = "0.12"

View File

@ -35,21 +35,21 @@ eyre = { workspace = true, optional = true }
serde = { workspace = true, default-features = false } serde = { workspace = true, default-features = false }
# metrics # metrics
reth-metrics.workspace = true reth-metrics = { workspace = true, optional = true }
metrics.workspace = true metrics = { workspace = true, optional = true }
# misc # misc
bytes.workspace = true bytes.workspace = true
page_size = "0.6.0" page_size = { version = "0.6.0", optional = true }
thiserror.workspace = true thiserror.workspace = true
tempfile = { workspace = true, optional = true } tempfile = { workspace = true, optional = true }
derive_more.workspace = true derive_more.workspace = true
paste.workspace = true paste.workspace = true
rustc-hash.workspace = true rustc-hash = { workspace = true, optional = true }
sysinfo = { version = "0.30", default-features = false } sysinfo = { version = "0.30", default-features = false }
# arbitrary utils # arbitrary utils
strum = { workspace = true, features = ["derive"] } strum = { workspace = true, features = ["derive"], optional = true }
[dev-dependencies] [dev-dependencies]
# reth libs with arbitrary # reth libs with arbitrary
@ -77,7 +77,15 @@ assert_matches.workspace = true
[features] [features]
default = ["mdbx"] default = ["mdbx"]
mdbx = ["dep:reth-libmdbx", "dep:eyre"] mdbx = [
"dep:reth-libmdbx",
"dep:eyre",
"dep:page_size",
"reth-metrics",
"dep:metrics",
"dep:strum",
"dep:rustc-hash",
]
test-utils = ["dep:tempfile", "arbitrary"] test-utils = ["dep:tempfile", "arbitrary"]
bench = [] bench = []
arbitrary = ["reth-primitives/arbitrary", "reth-db-api/arbitrary"] arbitrary = ["reth-primitives/arbitrary", "reth-db-api/arbitrary"]

View File

@ -17,9 +17,11 @@
mod implementation; mod implementation;
pub mod lockfile; pub mod lockfile;
#[cfg(feature = "mdbx")]
mod metrics; mod metrics;
pub mod static_file; pub mod static_file;
pub mod tables; pub mod tables;
#[cfg(feature = "mdbx")]
mod utils; mod utils;
pub mod version; pub mod version;
@ -28,6 +30,7 @@ pub mod mdbx;
pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation}; pub use reth_storage_errors::db::{DatabaseError, DatabaseWriteOperation};
pub use tables::*; pub use tables::*;
#[cfg(feature = "mdbx")]
pub use utils::is_database_empty; pub use utils::is_database_empty;
#[cfg(feature = "mdbx")] #[cfg(feature = "mdbx")]

View File

@ -16,6 +16,7 @@ pub mod codecs;
mod raw; mod raw;
pub use raw::{RawDupSort, RawKey, RawTable, RawValue, TableRawRow}; pub use raw::{RawDupSort, RawKey, RawTable, RawValue, TableRawRow};
#[cfg(feature = "mdbx")]
pub(crate) mod utils; pub(crate) mod utils;
use reth_db_api::{ use reth_db_api::{