[package]
name         = "tsoracle-driver-openraft"
description  = "openraft-backed ConsensusDriver for tsoracle"
version      = "2.0.1"
readme       = "README.md"
edition.workspace      = true
rust-version.workspace = true
license.workspace      = true
repository.workspace   = true
homepage.workspace     = true
authors.workspace      = true

[features]
default                = ["rocksdb-snapshot-store"]
# Enables `RocksdbSnapshotStore`, a `SnapshotStore` impl keyed in a
# caller-managed RocksDB column family. Pairs naturally with
# `tsoracle_openraft_toolkit::RocksdbLogStore` so one `Arc<DB>` covers both the
# raft log and the persisted snapshot. Default-on because the two example
# crates in this workspace both use the rocksdb-backed log store anyway;
# downstream consumers that want a custom snapshot backend can opt out via
# `default-features = false`.
rocksdb-snapshot-store = ["dep:rocksdb"]
# Emit format-migration observability through the `metrics` crate facade
# (gauges for the version state, counters for the SetFormatVersion
# lifecycle). Off by default so embedders that do not want the `metrics`
# dependency are unaffected, matching `tsoracle-server`'s `metrics` feature.
metrics                = ["dep:metrics"]

[dependencies]
async-trait        = { workspace = true }
futures            = { workspace = true }
metrics            = { workspace = true, optional = true }
openraft           = { workspace = true }
postcard           = { workspace = true }
# `default-features = false` so this crate does not unilaterally pull the
# toolkit's `rocksdb-log-store` feature (and its transitive `librocksdb-sys` →
# `bindgen` → `clang-sys` chain) into every consumer. The driver's `src/` only
# touches `tsoracle_openraft_toolkit::{LeadershipState, lifecycle, declare_raft_types_ext}`,
# all of which live outside the feature-gated `log_store` module. Workspace
# members that need `RocksdbLogStore` (examples, this crate's dev-deps) opt in
# explicitly with `features = ["rocksdb-log-store"]` and cargo feature
# unification re-enables it for their builds.
tsoracle-openraft-toolkit   = { path = "../tsoracle-openraft-toolkit", version = "1.1.0", default-features = false }
parking_lot        = { workspace = true }
rocksdb            = { workspace = true, optional = true, features = ["multi-threaded-cf"] }
serde              = { workspace = true }
thiserror          = { workspace = true }
tokio              = { workspace = true }
tracing            = { workspace = true }
tsoracle-codec     = { workspace = true }
tsoracle-consensus = { path = "../tsoracle-consensus", version = "2.0.1", features = ["serde"] }
tsoracle-core      = { path = "../tsoracle-core", version = "2.1.1", features = ["serde"] }

[dev-dependencies]
anyhow           = { workspace = true }
tsoracle-openraft-toolkit = { path = "../tsoracle-openraft-toolkit", version = "1.1.0", features = ["rocksdb-log-store", "test-fakes"] }
metrics-util     = { workspace = true }
proptest         = { workspace = true }
rocksdb          = { workspace = true }
tempfile         = { workspace = true }
tokio            = { workspace = true, features = ["macros", "rt-multi-thread", "test-util"] }
tracing-subscriber = { workspace = true }
