[package]
name                   = "tsoracle-standalone"
version                = "1.2.0"
edition.workspace      = true
rust-version.workspace = true
license.workspace      = true
repository.workspace   = true
description            = "Driver selection, configuration, and peer transport for running a standalone tsoracle node"
readme                 = "README.md"
publish                = true

[features]
default  = ["file", "openraft", "paxos"]
file     = ["dep:tsoracle-driver-file"]
openraft = [
    "dep:tsoracle-driver-openraft", "dep:tsoracle-openraft-toolkit",
    "dep:openraft", "dep:rocksdb", "dep:tonic", "dep:tonic-prost",
    "dep:prost", "dep:postcard", "dep:tokio-stream", "dep:futures",
    "tonic/tls-aws-lc",
]
paxos    = [
    "dep:tsoracle-driver-paxos", "dep:tsoracle-paxos-toolkit",
    "dep:omnipaxos", "dep:rocksdb", "dep:tonic", "dep:tonic-prost",
    "dep:prost", "dep:postcard", "dep:parking_lot", "dep:tokio-stream",
    "tonic/tls-aws-lc",
]
# Gates `admin::test_support`, a tiny public seam exposing the otherwise
# `pub(crate)` `AdminServiceImpl` constructor so an integration test can
# drive the gRPC handler with a fake `MembershipAdmin`. Off in production.
test-support = []

[dependencies]
tsoracle-core      = { path = "../tsoracle-core", version = "2.2.0" }
tsoracle-consensus = { path = "../tsoracle-consensus", version = "2.1.0" }
tsoracle-server    = { path = "../tsoracle-server", version = "3.1.0" }
tokio              = { workspace = true, features = ["signal", "net", "rt"] }
tracing            = { workspace = true }
thiserror          = { workspace = true }

# file
tsoracle-driver-file = { path = "../tsoracle-driver-file", version = "2.1.0", optional = true }

# openraft
tsoracle-driver-openraft = { path = "../tsoracle-driver-openraft", version = "2.2.0", optional = true }
tsoracle-openraft-toolkit = { path = "../tsoracle-openraft-toolkit", version = "1.2.0", features = ["rocksdb-log-store"], optional = true }
openraft     = { workspace = true, optional = true }
# `net` is required for tokio_stream::wrappers::TcpListenerStream, used by both
# HA drivers' bind-before-spawn peer servers (build_openraft / build_paxos).
tokio-stream = { workspace = true, optional = true, features = ["net"] }
async-trait  = { workspace = true }
futures      = { workspace = true, optional = true }

# paxos
tsoracle-driver-paxos  = { path = "../tsoracle-driver-paxos", version = "2.0.2", optional = true }
tsoracle-paxos-toolkit = { path = "../tsoracle-paxos-toolkit", version = "1.0.4", features = ["rocksdb-storage"], optional = true }
omnipaxos   = { workspace = true, features = ["serde"], optional = true }
parking_lot = { workspace = true, optional = true }

# shared by openraft + paxos transport
rocksdb     = { workspace = true, optional = true }
tonic       = { workspace = true, optional = true }
tonic-prost = { workspace = true, optional = true }
prost       = { workspace = true, optional = true }
postcard    = { workspace = true, optional = true }

[build-dependencies]
tonic-prost-build = { workspace = true }

[dev-dependencies]
rcgen    = { workspace = true }
tempfile = { workspace = true }
tokio    = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }

# Without `required-features`, `cargo test -p tsoracle-standalone` (developer
# default, no `--features test-support`) silently compiles these test files to
# zero test items — the `#![cfg(all(feature = "openraft", feature = "test-support"))]`
# at the top of each file gates everything out. With these entries, cargo
# prints a visible "skipped due to required-features" notice instead.
[[test]]
name = "activation_admin_rpc"
path = "tests/activation_admin_rpc.rs"
required-features = ["openraft", "test-support"]

[[test]]
name = "openraft_membership"
path = "tests/openraft_membership.rs"
required-features = ["openraft", "test-support"]
