[package]
name = "shodh-redb"
description = "Multi-modal embedded database - vectors, blobs, TTL, merge operators, and causal tracking built on ACID B-trees"
readme = "README.md"
version = "0.3.0"
exclude = ["fuzz/", "crates/bf-tree/"]
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
authors.workspace = true
keywords = ["database", "embedded", "vector", "blob", "no_std"]
categories = ["database-implementations", "data-structures", "no-std"]

[workspace]
members = [".", "crates/redb-bench", "crates/redb-cli", "crates/redb-derive", "crates/redb-python"]
default-members = [".", "crates/redb-cli", "crates/redb-derive", "crates/redb-python"]

[workspace.package]
edition = "2024"
rust-version = "1.89"
license = "Apache-2.0"
homepage = "https://github.com/varun29ankuS/shodh-redb"
repository = "https://github.com/varun29ankuS/shodh-redb"
authors = ["Varun Sharma"]

[dependencies]
log = { version = "0.4.17", optional = true }
chrono_v0_4 = { package = "chrono", version= "0.4.41", optional = true }
uuid = { version= "1.17.0", optional = true }
lz4_flex = { version = "0.11.5", optional = true }
sha2 = { version = "0.10", default-features = false }
zstd = { version = "0.13.3", optional = true, default-features = false }
hashbrown = "0.15"
spin = { version = "0.9", default-features = false, features = ["mutex", "spin_mutex", "rwlock"] }

# bf-tree vendored dependencies (all optional, activated by bf_tree feature)
rand_08 = { package = "rand", version = "0.8.5", default-features = false, features = ["small_rng", "std", "std_rng"], optional = true }
portable-atomic = { version = "1", default-features = false, features = ["fallback"], optional = true }
cfg-if = { version = "1", optional = true }
serde = { version = "1", default-features = false, features = ["derive", "alloc", "std"], optional = true }
serde_json = { version = "1.0.116", optional = true }
thread_local = { version = "1.1.9", optional = true }
toml = { version = "0.8.23", optional = true }

[target.'cfg(target_os = "wasi")'.dependencies]
libc = "0.2.174"

[target.'cfg(target_os = "linux")'.dependencies]
io-uring = { version = "0.6.4", optional = true }

[target.'cfg(unix)'.dependencies]
libc = { version = "0.2.174", optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
windows-sys = { version = "0.59.0", optional = true, features = [
    "Win32_System_Threading",
    "Win32_System_WindowsProgramming",
] }

# Common test/bench dependencies
[dev-dependencies]
rand = "0.10.0"
tempfile = "3.5.0"
# for backwards compatibility testing - pin at 2.6.0
redb2_6 = { version = "=2.6.0", package = "redb" }
bincode = "2.0.1"
uuid = { version= "1.17.0", features = ["v4"] }
shodh-redb-derive = { version = "0.1.0", path = "./crates/redb-derive" }
# bf-tree test dependencies
rand_test = { version = "0.9.2", package = "rand" }
proptest = { version = "1.6.0", default-features = false, features = ["std"] }
proptest-derive = "0.5.1"
bytemuck = { version = "1.24.0", features = ["must_cast"] }
rstest = "0.19.0"

[features]
default = ["std"]
# Enable std library support (file backends, group commit, TTL, full error types)
std = []
# Enables log messages
logging = ["dep:log"]
# Enable cache hit metrics
cache_metrics = []
# Enable LZ4 page compression
compression_lz4 = ["dep:lz4_flex"]
# Enable zstd page compression
compression_zstd = ["dep:zstd"]
# Enable all compression algorithms
compression = ["compression_lz4", "compression_zstd"]
# Enable Bf-Tree concurrent storage engine (vendored, requires std)
bf_tree = [
    "std",
    "dep:rand_08",
    "dep:portable-atomic",
    "dep:cfg-if",
    "dep:serde",
    "dep:serde_json",
    "dep:thread_local",
    "dep:toml",
    "dep:io-uring",
    "dep:libc",
    "dep:windows-sys",
]

[profile.bench]
debug = true

[lints.rust]
# bf-tree vendored code references features that exist only as internal dead-code gates.
# Suppress the check-cfg warnings for these features.
unexpected_cfgs = { level = "allow", check-cfg = [
    'cfg(feature, values("metrics", "metrics-rt", "metrics-rt-debug-all", "metrics-rt-debug-timer", "shuttle", "tracing"))',
] }

[lints.clippy]
big_endian_bytes = "deny"
dbg_macro = "deny"
host_endian_bytes = "deny"
