[package] name = "openraft" readme = "../README.md" version = { workspace = true } edition = { workspace = true } authors = { workspace = true } categories = { workspace = true } description = { workspace = true } documentation = { workspace = true } homepage = { workspace = true } keywords = { workspace = true } license = { workspace = true } repository = { workspace = true } [dependencies] anyerror = { workspace = true } anyhow = { workspace = true, optional = true } byte-unit = { workspace = true } chrono = { workspace = true } clap = { workspace = true } derive_more = { workspace = true } futures = { workspace = true } openraft-macros = { path = "../macros", version = "0.9.6" } maplit = { workspace = true } rand = { workspace = true } serde = { workspace = true, optional = true } serde_json = { workspace = true, optional = true } thiserror = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } tracing-futures = { workspace = true } validit = { workspace = true } [dev-dependencies] anyhow = { workspace = true } async-entry = { workspace = true } pretty_assertions = { workspace = true } serde_json = { workspace = true } [features] # Enables benchmarks in unittest. # # Benchmark in openraft depends on the unstable feature `test` thus it can not be used with stable rust. # In order to run the benchmark with stable toolchain, # the unstable features have to be enabled explicitly with environment variable `RUSTC_BOOTSTRAP=1`. bench = [] # Enable backtrace when generating an error. # Stable rust does not support backtrace. bt = ["anyerror/backtrace", "anyhow/backtrace"] # Add serde::Serialize and serde:Deserialize bound to data types. # If you'd like to use `serde` to serialize messages. serde = ["dep:serde"] # Turn on this feature it allows at most ONE quorum-granted leader for each term. # This is the way standard raft does, by making the LeaderId a partial order value. # # - With this feature on: # It is more likely to conflict during election. But every log only needs to store one `term` in it. # # - With this feature off: # Election conflict rate will be reduced, but every log has to store a `LeaderId{ term, node_id}`, # which may be costly if an application uses a big NodeId type. # # This feature is disabled by default. single-term-leader = [] # Provide basic compatible types compat = [] # Allows an application to implement a custom the v2 storage API. # See `openraft::storage::v2` for more details. # V2 API are unstable and may change in the future. storage-v2 = [] # Disallows applications to share a raft instance with multiple threads. singlethreaded = ["openraft-macros/singlethreaded"] # Permit the follower's log to roll back to an earlier state without causing the # leader to panic. # # Although log state reversion is typically seen as a bug, enabling it can be # useful for testing or other special scenarios. # For instance, in an even number nodes cluster, erasing a node's data and then # rebooting it(log reverts to empty) will not result in data loss. loosen-follower-log-revert = [] # Enable this feature flag to eliminate the `AsyncRead + AsyncWrite + AsyncSeek # + Unpin` bound from `RaftTypeConfig::SnapshotData`. # # Enabling this feature allows applications to use a custom snapshot data format # and transport fragmentation, diverging from the default implementation which # typically relies on a single-file structure . # # By default it is off. # This feature is introduced in 0.9.0 generic-snapshot-data = [] # Enables "log" feature in `tracing` crate, to let tracing events emit log # record. # See: https://docs.rs/tracing/latest/tracing/#emitting-log-records tracing-log = [ "tracing/log" ] # default = ["single-term-leader"] [package.metadata.docs.rs] # Enable these feature flags to show all types/mods, # including the feature enabled ones on docs.rs features = [ "bt", "compat", "generic-snapshot-data", "loosen-follower-log-revert", "serde", "storage-v2", "tracing-log", ] # Do not use this to enable all features: # "singlethreaded" makes `Raft` a `!Send`, which confuses users. # all-features = true # Disabled appearance order. It produce multiple `Trait`, `Struct` sections in a doc page. # # Sort modules by appearance order for crate `docs`. # https://doc.rust-lang.org/rustdoc/unstable-features.html#--sort-modules-by-appearance-control-how-items-on-module-pages-are-sorted # rustdoc-args = ["-Z", "unstable-options", "--sort-modules-by-appearance"]