Skip to main content

sqlite_graphrag/constants/
mod.rs

1//! Compile-time constants shared across the crate.
2//!
3//! Grouped into embedding configuration, length and size limits, SQLite
4//! pragmas and retrieval tuning knobs. Values are taken from the PRD and
5//! must stay in sync with the migrations under `migrations/`.
6//!
7//! ## Dynamic concurrency permit calculation
8//!
9//! The maximum number of simultaneous instances can be adjusted at runtime
10//! using the formula:
11//!
12//! ```text
13//! permits = min(cpus, available_memory_mb / LLM_WORKER_RSS_MB) * 0.5
14//! ```
15//!
16//! where `available_memory_mb` is obtained via `sysinfo::System::available_memory()`
17//! converted to MiB. The result is capped at `MAX_CONCURRENT_CLI_INSTANCES`
18//! and floored at 1.
19//!
20//! ## Layout
21//!
22//! The constants live in themed submodules and are re-exported here, so every
23//! `crate::constants::X` path in the crate keeps resolving unchanged. The split
24//! happened in v1.2.5, when the single file had reached 960 lines against the
25//! project's own 800-line ceiling (GAP-SG-89).
26
27mod embedding;
28mod enrich;
29mod exit_codes;
30mod identity;
31mod limits;
32mod network;
33mod runtime;
34mod search;
35mod storage;
36
37pub use embedding::*;
38pub use enrich::*;
39pub use exit_codes::*;
40pub use identity::*;
41pub use limits::*;
42pub use network::*;
43pub use runtime::*;
44pub use search::*;
45pub use storage::*;