libdictenstein 0.1.0

High-performance dictionary data structures (trie, DAWG, double-array trie, suffix automaton, lock-free durable persistent ART) behind one trait API; pairs with liblevenshtein for fuzzy matching
[package]
name = "libdictenstein"
version = "0.1.0"
edition = "2021"
rust-version = "1.70"
authors = ["Dylon Edwards <dylon.devo@gmail.com>"]
license = "Apache-2.0"
repository = "https://github.com/vinary-tree/libdictenstein"
description = "High-performance dictionary data structures (trie, DAWG, double-array trie, suffix automaton, lock-free durable persistent ART) behind one trait API; pairs with liblevenshtein for fuzzy matching"
keywords = ["trie", "dawg", "dictionary", "fuzzy-search", "automata"]
categories = ["algorithms", "data-structures", "text-processing"]
readme = "README.md"
exclude = ["docs/", "formal-verification/"]

[dependencies]
# Logging facade
log = "0.4"
# SmallVec for stack-allocated vectors (performance optimization)
smallvec = { version = "1.13", features = ["serde"] }
# Fast non-cryptographic hashing for internal use
rustc-hash = "1.1"
# Lock-free atomic Arc swapping for DynamicDawgU64
arc-swap = "1.7"
# Error handling
thiserror = "2.0"
# Shared lattice trait (join/meet); extracted leaf crate (cycle-break)
llattice = { path = "../llattice", version = "0.1" }
# Faster RwLock for DynamicDawg
parking_lot = { version = "0.12", optional = true }
# Serialization support (optional)
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
bincode = { version = "2.0", features = ["serde"], optional = true }
serde_json = { version = "1.0", optional = true }

# Compression support (optional)
flate2 = { version = "1.0", optional = true }

# Protobuf support (optional)
prost = { version = "0.13", optional = true }

# PathMap as an optional dictionary backend
pathmap = { version = "0.2", optional = true }

# Memory-mapped I/O for persistent data structures
memmap2 = { version = "0.9", optional = true }

# Lock-free MPMC channels for group commit
crossbeam-channel = { version = "0.5", optional = true }

# Cross-platform system information (memory, CPU, etc.)
sysinfo = { version = "0.37", optional = true }

# Parallel processing for merge operations
rayon = { version = "1.10", optional = true }

# Fast non-cryptographic hashing for node deduplication
xxhash-rust = { version = "0.8", features = ["xxh3"], optional = true }

# LRU cache for reverse lookups in vocabulary trie
lru = { version = "0.18", optional = true }

# Concurrent hash map for LRU tracking in eviction
dashmap = { version = "6.1", optional = true }

# (Removed) `im` was the RRB-tree backing for the lock-free overlay nodes; both
# the char and byte overlay nodes now use the tiered `ChildStore` (Inline/Heap)
# with owned `Child` slots, so `im` has no remaining users. Re-add here if a
# future module needs persistent vectors again.

# io_uring for O_DIRECT async I/O (Linux-only, optional)
io-uring = { version = "0.7", optional = true }

# libc for O_DIRECT flag and fallocate (Linux-only, used by io-uring-backend)
libc = { version = "0.2", optional = true }

[build-dependencies]
prost-build = { version = "0.13", optional = true }

[dev-dependencies]
criterion = "0.5"
tempfile = "3.8"
proptest = "1.4"
paste = "1.0"  # For macro test name concatenation
hdrhistogram = "7.5"  # High dynamic range histograms for latency benchmarks
rand = "0.8"  # PRNG for randomized benchmark scenarios
loom = "0.7"  # Bounded schedule exploration for concurrency correspondence tests

[features]
default = ["parking_lot"]
pathmap-backend = ["pathmap"]
serialization = ["serde", "bincode", "serde_json"]
compression = ["flate2"]
protobuf = ["prost", "prost-build"]
# Persistent Adaptive Radix Trie (disk-based dictionary).
# Enables the `serialization` feature transitively because the
# persistent_artrie* modules use `crate::serialization::bincode_compat`
# unconditionally — without this dep the module references resolve to a
# feature-gated crate::serialization that isn't visible.
persistent-artrie = ["memmap2", "parking_lot", "serde", "bincode", "sysinfo", "xxhash-rust", "lru", "dashmap", "crossbeam-channel", "serialization"]
# Group commit for WAL batching.
# Status: EXPERIMENTAL — measured 1.5-2x throughput regression on NVMe vs
# per-record sync in benches/group_commit_benchmarks.rs (recorded 2026-01-15).
# Retained for slower-storage scenarios (HDDs, remote block stores) and for
# revisiting under a different coordinator design. Do not enable on NVMe
# without re-benchmarking. See docs/persistence/group_commit_regression.md.
group-commit = ["persistent-artrie", "crossbeam-channel"]
# Parallel merge using rayon for multi-core acceleration
parallel-merge = ["persistent-artrie", "rayon"]
# io_uring-based block storage backend (Linux-only, requires kernel >= 5.1)
io-uring-backend = ["persistent-artrie", "dep:io-uring", "dep:libc"]
# Expose internal APIs for benchmarks (not in default features)
bench-internals = ["io-uring-backend"]

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

[profile.release]
opt-level = 3
lto = true
codegen-units = 1

[profile.bench]
inherits = "release"

[[bench]]
name = "serialization_benchmarks"
harness = false
required-features = ["serialization", "pathmap-backend"]

[[bench]]
name = "persistent_artrie_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "persistent_artrie_char_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "loading_experiments"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "epoch_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "group_commit_benchmarks"
harness = false
required-features = ["group-commit"]

[[bench]]
name = "memory_pressure_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "adaptive_pool_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "per_node_log_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "batch_wal_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "write_locality_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "parallel_merge_benchmarks"
harness = false
required-features = ["parallel-merge"]

[[bench]]
name = "transaction_benchmarks"
harness = false
required-features = ["persistent-artrie"]

# Examples requiring persistent-artrie feature
[[example]]
name = "test_bench"
required-features = ["persistent-artrie"]

[[example]]
name = "test_bench_large"
required-features = ["persistent-artrie"]

[[example]]
name = "bench_disk_io"
required-features = ["persistent-artrie"]

[[example]]
name = "wal_size_test"
required-features = ["persistent-artrie"]

[[example]]
name = "wal_debug"
required-features = ["persistent-artrie"]

[[example]]
name = "exp_checkpoint_throughput"
required-features = ["persistent-artrie"]

[[example]]
name = "wal_compare"
required-features = ["persistent-artrie"]

[[example]]
name = "wal_flush_debug"
required-features = ["persistent-artrie"]

[[example]]
name = "insert_trace"
required-features = ["persistent-artrie"]

[[example]]
name = "prefix_diversity_test"
required-features = ["persistent-artrie"]

[[example]]
name = "streaming_merge_test"
required-features = ["persistent-artrie"]

[[example]]
name = "batched_merge_comparison"
required-features = ["persistent-artrie"]

[[example]]
name = "test_checkpoint_debug"
required-features = ["persistent-artrie"]

[[bench]]
name = "io_backend_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "io_uring_comparison_benchmarks"
harness = false
required-features = ["io-uring-backend"]

[[bench]]
name = "eviction_benchmarks"
harness = false
required-features = ["bench-internals"]

[[bench]]
name = "concurrent_read_vs_flush_benchmarks"
harness = false
required-features = ["persistent-artrie"]

[[bench]]
name = "lockfree_flip_benchmark"
# criterion provides its own main via criterion_main!, so the libtest harness
# must be disabled (otherwise libtest's main runs and criterion never executes).
harness = false
required-features = ["persistent-artrie", "bench-internals"]

[package.metadata.docs.rs]
all-features = true