[package]
name = "subms-lsm-tree"
version = "0.5.2"
edition = "2024"
rust-version = "1.85"
authors = ["Kieran Smith <oss@submillisecond.com>"]
description = "submillisecond.com cookbook recipe - storage: subms-lsm-tree. A working LSM tree (memtable, immutable SSTables, bloom-filter trailer) with sub-millisecond reads at p99 on a 50k-entry workload."
license = "MIT OR Apache-2.0"
readme = "README.md"
homepage = "https://submillisecond.com/cookbook/recipes/subms-lsm-tree"
keywords = ["lsm", "storage", "cookbook", "subms", "low-latency"]
categories = ["data-structures", "database-implementations"]

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

[[example]]
name = "perf_main"
required-features = ["harness"]

[[example]]
name = "perf_features"
required-features = ["harness", "wal", "tiered-compaction", "leveled-compaction", "snapshot", "lz4", "zstd", "block-cache-integration"]

[features]
default = []
# Enables the `SubMsRecipe` impl, the `perf_main` example, and the
# `sub_millisecond_bench` integration test.
harness = ["dep:subms"]

# ----- Opt-in feature catalog (subms 0.5+) -----
# Each feature lives in src/features/<name>.rs behind a #[cfg(feature)]
# gate. Base tree is std-only + one cross-recipe dep (subms-bloom-filter);
# each opt-in adds a focused capability. Pick what you need:
#
#   subms-lsm-tree = { version = "0.5", features = ["wal"] }
#   subms-lsm-tree = { version = "0.5", features = ["wal", "snapshot"] }
#
# `wal`                     - Write-ahead log: durable replay across restarts.
# `tiered-compaction`       - Size-tiered compaction (write-amp friendly).
# `leveled-compaction`      - Leveled compaction (read-amp friendly).
# `snapshot`                - Point-in-time read view of the SSTable manifest.
# `lz4`                     - LZ4 block compression (pulls in lz4_flex).
# `zstd`                    - Zstd block compression (pulls in zstd).
# `block-cache-integration` - Read-side block cache trait + LruCache impl.
wal = []
tiered-compaction = []
leveled-compaction = []
snapshot = []
lz4 = ["dep:lz4_flex"]
zstd = ["dep:zstd"]
block-cache-integration = []

# subms-bloom-filter is a real runtime dep (one bloom per SSTable trailer).
# subms (the harness) is optional behind `harness`.
[dependencies]
subms-bloom-filter = { path = "../../subms-bloom-filter/rust", version = "0.5.2" }
subms = { version = "0.5.2", path = "../../../../subms/rust", optional = true }
lz4_flex = { version = "0.11", optional = true, default-features = false, features = ["std"] }
zstd = { version = "0.13", optional = true, default-features = false }
