Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 0 additions & 125 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions storage/blockchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ repository = "https://github.com/Cuprate/cuprate/tree/main/storage/cuprate-bloc
keywords = ["cuprate", "blockchain", "database"]

[features]
default = ["heed"]
default = []
# default = ["redb", "service"]
# default = ["redb-memory", "service"]
heed = ["cuprate-database/heed"]
redb = ["cuprate-database/redb"]
redb-memory = ["cuprate-database/redb-memory"]
# heed = ["cuprate-database/heed"]
# redb = ["cuprate-database/redb"]
# redb-memory = ["cuprate-database/redb-memory"]
serde = ["dep:serde", "cuprate-database/serde", "cuprate-database-service/serde", "cuprate-helper/serde"]

[dependencies]
Expand Down
10 changes: 4 additions & 6 deletions storage/database/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ repository = "https://github.com/Cuprate/cuprate/tree/main/storage/database"
keywords = ["cuprate", "database"]

[features]
default = ["heed"]
default = []
# default = ["redb"]
# default = ["redb-memory"]
heed = []
redb = ["dep:redb"]
redb-memory = ["redb"]
# heed = []

[dependencies]
bytemuck = { version = "1.18.0", features = ["must_cast", "derive", "min_const_generics", "extern_crate_alloc"] }
Expand All @@ -26,8 +24,8 @@ thiserror = { workspace = true }
tracing = { workspace = true }

# Optional features.
heed = { version = "0.20.5", features = ["read-txn-no-tls"] }
redb = { version = "2.1.3", optional = true }
# heed = { version = "0.20.5", features = ["read-txn-no-tls"] }
redb = { version = "2.1.3" }
serde = { workspace = true, optional = true }

[dev-dependencies]
Expand Down
15 changes: 2 additions & 13 deletions storage/database/src/backend/mod.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
//! Database backends.

cfg_if::cfg_if! {
// If both backends are enabled, fallback to `heed`.
// This is useful when using `--all-features`.
if #[cfg(all(feature = "redb", not(feature = "heed")))] {
use heed as _;

mod redb;
pub use redb::ConcreteEnv;
} else {
mod heed;
pub use heed::ConcreteEnv;
}
}
mod redb;
pub use redb::ConcreteEnv;

#[cfg(test)]
mod tests;
30 changes: 3 additions & 27 deletions storage/database/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@ If this happens frequently, consider using the `Safe` sync mode.";
/// |---------|-------|
/// | `heed` | `"heed"`
/// | `redb` | `"redb"`
pub const DATABASE_BACKEND: &str = {
cfg_if! {
if #[cfg(all(feature = "redb", not(feature = "heed")))] {
"redb"
} else {
"heed"
}
}
};
pub const DATABASE_BACKEND: &str = "redb";

/// Cuprate's database filename.
///
Expand All @@ -45,31 +37,15 @@ pub const DATABASE_BACKEND: &str = {
/// |---------|-------|
/// | `heed` | `"data.mdb"`
/// | `redb` | `"data.redb"`
pub const DATABASE_DATA_FILENAME: &str = {
cfg_if! {
if #[cfg(all(feature = "redb", not(feature = "heed")))] {
"data.redb"
} else {
"data.mdb"
}
}
};
pub const DATABASE_DATA_FILENAME: &str = "data.redb";

/// Cuprate's database lock filename.
///
/// | Backend | Value |
/// |---------|-------|
/// | `heed` | `Some("lock.mdb")`
/// | `redb` | `None` (redb doesn't use a file lock)
pub const DATABASE_LOCK_FILENAME: Option<&str> = {
cfg_if! {
if #[cfg(all(feature = "redb", not(feature = "heed")))] {
None
} else {
Some("lock.mdb")
}
}
};
pub const DATABASE_LOCK_FILENAME: Option<&str> = None;

//---------------------------------------------------------------------------------------------------- Tests
#[cfg(test)]
Expand Down
10 changes: 0 additions & 10 deletions storage/database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,3 @@ pub(crate) mod tests;
// Used inside public facing macros.
#[doc(hidden)]
pub use paste;

//----------------------------------------------------------------------------------------------------
// HACK: needed to satisfy the `unused_crate_dependencies` lint.
cfg_if::cfg_if! {
if #[cfg(feature = "redb")] {
use redb as _;
} else {
use heed as _;
}
}
8 changes: 4 additions & 4 deletions storage/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ repository = "https://github.com/Cuprate/cuprate/tree/main/storage/service"
keywords = ["cuprate", "service", "database"]

[features]
default = ["heed"]
heed = ["cuprate-database/heed"]
redb = ["cuprate-database/redb"]
redb-memory = ["cuprate-database/redb-memory"]
default = []
# heed = ["cuprate-database/heed"]
# redb = ["cuprate-database/redb"]
# redb-memory = ["cuprate-database/redb-memory"]

[dependencies]
cuprate-database = { workspace = true }
Expand Down
10 changes: 5 additions & 5 deletions storage/txpool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ repository = "https://github.com/Cuprate/cuprate/tree/main/storage/txpool"
keywords = ["cuprate", "txpool", "transaction", "pool", "database"]

[features]
default = ["heed"]
default = []
# default = ["redb", "service"]
# default = ["redb-memory", "service"]
heed = ["cuprate-database/heed"]
redb = ["cuprate-database/redb"]
redb-memory = ["cuprate-database/redb-memory"]
# heed = ["cuprate-database/heed"]
# redb = ["cuprate-database/redb"]
# redb-memory = ["cuprate-database/redb-memory"]
serde = ["dep:serde", "cuprate-database/serde", "cuprate-database-service/serde", "cuprate-helper/serde"]

[dependencies]
cuprate-database = { workspace = true, features = ["heed"] }
cuprate-database = { workspace = true }
cuprate-database-service = { workspace = true }
cuprate-types = { workspace = true, features = ["rpc"] }
cuprate-helper = { workspace = true, default-features = false, features = ["constants"] }
Expand Down
Loading