forked from stoolap/stoolap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
301 lines (259 loc) · 9.68 KB
/
Cargo.toml
File metadata and controls
301 lines (259 loc) · 9.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
[package]
name = "stoolap"
version = "0.3.2"
edition = "2021"
build = "cairo/build.rs"
authors = ["Stoolap Contributors"]
description = "High-performance embedded SQL database with MVCC, time-travel queries, and full ACID compliance"
license = "Apache-2.0"
repository = "https://github.com/stoolap/stoolap"
homepage = "https://stoolap.io"
documentation = "https://stoolap.io/docs/"
readme = "README.md"
keywords = ["database", "sql", "embedded", "mvcc", "acid"]
categories = ["database", "database-implementations"]
[lib]
name = "stoolap"
path = "src/lib.rs"
crate-type = ["rlib"]
[lib.stoolap]
name = "stoolap_native"
crate-type = ["cdylib"]
[[bin]]
name = "stoolap"
path = "src/bin/stoolap.rs"
required-features = ["cli"]
# PG server will be enabled once implemented
# [[bin]]
# name = "stoolap-pgserver"
# path = "src/bin/pgserver.rs"
# required-features = ["pg-server"]
[dependencies]
# Error handling
thiserror = "2.0"
anyhow = "1.0"
# Plugin loading (for STWO verification plugin)
libloading = "0.8"
# Concurrency
parking_lot = "0.12"
dashmap = "6"
crossbeam = "0.8"
rayon = { version = "1.11", optional = true }
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
# Deterministic Floating-Point (DFP) per RFC-0104
octo-determin = { git = "https://github.com/CipherOcto/cipherocto", branch = "next" }
# Time handling
chrono = { version = "0.4", features = ["serde"] }
# Logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# CLI (optional)
clap = { version = "4.4", features = ["derive"], optional = true }
rustyline = { version = "17.0", optional = true }
comfy-table = { version = "7.2", optional = true }
dirs = { version = "6.0", optional = true }
# Checksums for data integrity
crc32fast = "1.4"
# Compression
lz4_flex = "0.12"
# Utilities
bytes = "1.5"
smallvec = "1.11"
ordered-float = "5.1"
indexmap = "2.1"
rustc-hash = "1.1"
memchr = "2.6"
regex = "1.10"
radsort = "0.1" # Radix sort - O(n) for integer keys
rand = "0.9" # Random number generation for RANDOM() function
ahash = "0.8" # Fast hash for hash indexes (DOS-resistant)
hashbrown = "0.16" # HashMap with raw_entry API for efficient group-by
roaring = "0.11" # Compressed bitmap indexes (used by Lucene, Druid, Spark)
lru = "0.16" # O(1) LRU cache for compiled expression programs
hex = { version = "0.4", optional = true } # Hex encoding for ZK proofs
# Optional benchmark dependencies (for comparison benchmarks)
rusqlite = { version = "0.32", features = ["bundled"], optional = true }
duckdb = { version = "1.4.3", features = ["bundled"], optional = true }
# Optional allocators
mimalloc = { version = "0.1", default-features = false, optional = true }
# Semantic embedding (optional — enables EMBED() SQL function)
candle-core = { version = "0.9", optional = true }
candle-nn = { version = "0.9", optional = true }
candle-transformers = { version = "0.9", optional = true }
tokenizers = { version = "0.22", default-features = false, features = ["progressbar", "fancy-regex"], optional = true }
hf-hub = { version = "0.4", optional = true }
sha2 = "0.10.9"
# Zero-knowledge proofs (optional)
# Note: Full STWO support moved to stwo-plugin crate (requires nightly to build)
# The zk feature here provides types and stubs only - use plugin for actual proofs
blake3 = { version = "1.5", optional = true }
memmap2 = { version = "0.9", optional = true }
which = { version = "7.0", optional = true }
tempfile = { version = "3.9", optional = true }
starknet-crypto = { version = "0.6", optional = true }
# Platform-specific file locking
[target.'cfg(unix)'.dependencies]
libc = "0.2"
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_IO"] }
# WASM dependencies
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
js-sys = "0.3"
web-sys = { version = "0.3", features = ["console", "Performance", "Window"] }
getrandom_02 = { package = "getrandom", version = "0.2", features = ["js"] }
getrandom_03 = { package = "getrandom", version = "0.3", features = ["wasm_js"] }
web-time = "1.1"
[dev-dependencies]
criterion = { version = "0.8", features = ["html_reports"] }
proptest = "1.4"
tempfile = "3.9"
dhat = "0.3"
[features]
default = ["cli", "parallel", "vector"]
parallel = ["dep:rayon"]
wasm = [] # Excludes parallel + persistence; for wasm32 builds
cli = ["clap", "rustyline", "comfy-table", "dirs"]
dhat-heap = []
sqlite = ["dep:rusqlite"]
duckdb = ["dep:duckdb"]
mimalloc = ["dep:mimalloc"]
semantic = ["candle-core", "candle-nn", "candle-transformers", "tokenizers", "hf-hub"]
zk = ["dep:blake3", "dep:which", "dep:tempfile", "dep:hex"] # ZK types and plugin loader (stable compatible)
commitment = ["dep:starknet-crypto", "dep:blake3"] # Pedersen commitments + confidential queries (stable compatible)
vector = ["dep:blake3", "dep:memmap2", "dep:tempfile"] # Vector storage with Merkle + mmap
[[example]]
name = "benchmark_sqlite"
required-features = ["sqlite"]
[[example]]
name = "benchmark_duckdb"
required-features = ["duckdb"]
[[example]]
name = "semantic_search"
required-features = ["semantic"]
# =============================================================================
# Build Profiles
# =============================================================================
#
# STOOLAP BUILD OPTIMIZATION GUIDE
# ------------------------------
# RFC-0104 (Deterministic Floating-Point) requires specific compiler settings for
# consensus-critical computations. This section documents why each profile exists.
#
# RFC-0104 References:
# - Section "Compiler Flags for Reproducibility": Must use release profile (overflow checks off)
# - Section "Determinism Hazards": Disable FMA, reordering, and undefined behavior
# - Section "Storage Encoding": Single canonical serialization path
#
# Key Requirements from RFC-0104:
# 1. overflow-checks = false (required for DFP saturating arithmetic)
# 2. No floating-point hardware fast-path (software-only DFP)
# 3. No FMA contraction (-C target-feature=-fma)
# 4. No fast-math flags
# 5. Deterministic integer arithmetic (checked/wrapping explicitly)
#
# =============================================================================
# DEVELOPMENT PROFILE: Fastest possible builds for iterative development
# - Uses debug mode for fast compile times
# - overflow-checks = true (safe for development, not for production)
# - No LTO for faster incremental builds
# - Multiple codegen units for parallelism
# - Suitable for: `cargo build`, `cargo test` (without --profile flag)
#
# NOTE: This produces NON-DETERMINISTIC results. Use for development only!
[profile.dev]
opt-level = 0 # No optimization for fast compile
debug = true # Full debug symbols
lto = false # No LTO for faster incremental builds
codegen-units = 16 # Parallel codegen for speed
overflow-checks = true # Runtime overflow checks (safe in dev)
# FINAL RELEASE PROFILE: Deterministic, fully optimized builds
# - Uses release mode with deterministic settings per RFC-0104
# - overflow-checks = false (REQUIRED for DFP consensus operations)
# - Full LTO for maximum optimization
# - Single codegen unit for best optimization
# - Suitable for: Production builds, benchmark binaries
#
# RFC-0104 Compliance:
# - "Use `release` profile (overflow checks off by default)"
# - "Disable FMA contraction: -C target-feature=-fma"
# - "Disable auto-vectorization and fast-math flags"
# - "Single codegen unit ensures deterministic optimization passes"
[profile.release]
# RFC-0104: Disable overflow checks for deterministic floating-point (DFP)
# DFP uses saturating arithmetic, not wrapping. Overflow saturates to MAX/MIN.
overflow-checks = false
# Full LTO for maximum cross-crate optimization (deterministic inlining)
lto = true
# Single codegen unit ensures deterministic optimization passes across builds
codegen-units = 1
# Abort on panic (no unwinding, smaller binary)
panic = "abort"
# Maximum optimization level
opt-level = 3
# Debug symbols for production profiling (can be disabled for smaller binaries)
debug = true
# BENCHMARK PROFILE: For benchmark binaries
# - Full optimization like release
# - Single codegen unit for deterministic results
[profile.bench]
lto = true
codegen-units = 1
# TEST PROFILE: For running tests with deterministic behavior
# - Inherits release settings for RFC-0104 compliance
# - Uses thin LTO for faster test compilation while maintaining determinism
# - Multiple codegen units for parallel test compilation
# - overflow-checks = false REQUIRED per RFC-0104 for DFP
# - Suitable for: `cargo test --profile test`
#
# RFC-0104: "Do NOT use debug profile for DFP operations"
# Tests must use deterministic settings to verify consensus behavior
[profile.test]
inherits = "release"
# RFC-0104: Required for deterministic floating-point operations in tests
overflow-checks = false
# Thin LTO: Faster compilation than full LTO, still deterministic
lto = "thin"
# Parallel codegen: Faster test compilation
codegen-units = 16
# CI PROFILE: Optimized for CI pipeline speed
# - Faster than test profile (no debug symbols)
# - Still maintains determinism for consistent CI results
# - Suitable for: GitHub Actions, CI runners
#
# NOTE: debug = false reduces binary size and link time
[profile.ci]
inherits = "release"
lto = "thin"
codegen-units = 16
debug = false
[[bench]]
name = "select_by_id"
harness = false
[[bench]]
name = "update_by_id"
harness = false
[[bench]]
name = "delete_by_id"
harness = false
[[bench]]
name = "select_complex"
harness = false
[[bench]]
name = "update_complex"
harness = false
[[bench]]
name = "delete_complex"
harness = false
[[bench]]
name = "hexary_proof"
harness = false
[[bench]]
name = "stark_proof"
harness = false
[[bench]]
name = "vector_search"
harness = false
required-features = ["vector"]