# ██████╗ ███████╗██████╗ ███████╗
# ██╔══██╗██╔════╝██╔══██╗██╔════╝
# ██████╔╝█████╗  ██████╔╝███████╗
# ██╔══██╗██╔══╝  ██╔═══╝ ╚════██║
# ██║  ██║███████╗██║     ███████║
# ╚═╝  ╚═╝╚══════╝╚═╝     ╚══════╝
#╔═══════════════════════════════╗
#║ Rust Efficiency & Performance ║
#╚═══════════════════════════════╝
[package]
name    = "txn-db"
version = "0.8.0"

# Minimum Supported Rust Version (MSRV)
rust-version = "1.85"
edition = "2024"

# License
license = "Apache-2.0 OR MIT"

# Readme
readme = "README.md"

# Description
description = "MVCC transaction engine for Rust storage layers. Snapshot isolation and serializable transactions with multi-version concurrency control, conflict detection, and a durable transaction log on wal-db. The transaction layer for embedded databases and Hive DB."

# Keywords (5 max)
keywords = [
    "mvcc",
    "transactions",
    "snapshot-isolation",
    "database",
    "concurrency"
]

# Categories
categories = [
    "database-implementations",
    "concurrency",
    "data-structures"
]

# Links
homepage      = "https://github.com/jamesgober/txn-db"
repository    = "https://github.com/jamesgober/txn-db"
documentation = "https://docs.rs/txn-db"

# Authors
authors = [
    "James Gober <me@jamesgober.com>"
]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lib]
name = "txn_db"
path = "src/lib.rs"


# FEATURE FLAGS
# #################################
[features]
default = ["std"]
# Standard library.
std = []
# Durable transaction commit log via `wal-db`: a commit's record is appended and
# synced before the commit is acknowledged, and `Db::open` replays the log on
# startup. Additive — the in-memory `Db::new` path is unchanged when this is off.
durability = ["dep:wal-db"]
# Serializable isolation (SSI) on top of snapshot isolation: adds
# `Db::begin_serializable`, which validates a transaction's read set at commit so
# that write skew and other snapshot-isolation anomalies are rejected. Additive
# — snapshot isolation is unchanged and remains the default when this is off.
serializable = []


# LINTS
# #################################
# `loom` is enabled via `RUSTFLAGS="--cfg loom"`, not a Cargo feature, so the
# compiler must be told the cfg is expected or `#![deny(warnings)]` rejects it.
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)'] }


# DEPENDENCIES
# #################################
[dependencies]
# Domain error type. Portfolio crates standardise on `error-forge` for stable
# error metadata (kind/caption/is_fatal) instead of thiserror/anyhow in library
# crates. Default features off — only the `ForgeError` trait is needed.
error-forge = { version = "1.0", default-features = false }

# Durable commit log, behind the `durability` feature. The published crate is
# used (not a path) so a standalone checkout — and CI — resolves it the same way
# every other portfolio crate does. Default features off: txn-db frames its own
# commit records and only needs the byte-record log.
wal-db = { version = "1.0", optional = true, default-features = false }


# DEV DEPENDENCIES
# #################################
[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] }
proptest  = "1"
tempfile  = "3"

# `loom` is a normal (not dev) dependency under `cfg(loom)`: the commit path
# swaps its `std::sync` primitives for loom's instrumented versions so the
# concurrency model checks can explore every interleaving. Pulled in only when
# building with `RUSTFLAGS="--cfg loom"`.
[target.'cfg(loom)'.dependencies]
loom = "0.7"


# EXAMPLES
# #################################
# The write-skew demonstration needs serializable isolation.
[[example]]
name              = "serializable_doctors"
required-features = ["serializable"]

# The durability demonstration needs the write-ahead log.
[[example]]
name              = "durable_store"
required-features = ["durability"]


# BENCHMARKS
# #################################
[[bench]]
name    = "txn_bench"
harness = false

[[bench]]
name    = "contention"
harness = false


# RELEASE PROFILE
# #################################
[profile.release]
opt-level     = 3
lto           = "fat"
codegen-units = 1
panic         = "abort"
strip         = "symbols"
