Configuration¶
Runtime-mutable, disk-persisted engine configuration.
LSMConfig¶
LSMConfig(path)
¶
Thread-safe, disk-persisted engine configuration.
Read any field as an attribute::
config.max_memtable_size_mb # → 64
config.max_memtable_bytes # → 67108864 (convenience)
config.bloom_fpr # → 0.05 (dev) or 0.01 (prod)
Update at runtime::
config.set("max_memtable_entries", 500_000)
config.set("bloom_fpr_prod", 0.001)
# writes to disk synchronously, all further reads see new value
Bloom filter configuration:
bloom_fpr_dev— false positive rate in dev mode (default 0.05). Higher FPR means smaller filters and faster builds.bloom_fpr_prod— false positive rate in prod mode (default 0.01). Lower FPR means fewer false disk reads at the cost of larger filters.- The convenience property :attr:
bloom_fprauto-selects based onenv. - The expected item count (
bloom_n) is not configurable — it is derived from the actual data size at flush time (len(snapshot)) and compaction time (sum of input record counts).
Load or create engine configuration from path.
If the file exists, its contents are merged with built-in defaults so that new keys introduced in code upgrades are always present. If the file does not exist or is corrupt, defaults are used and persisted to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Filesystem path to |
required |
Source code in app/engine/config.py
is_dev
property
¶
True when env is 'dev'.
is_prod
property
¶
True when env is 'prod'.
max_memtable_bytes
property
¶
Convenience: max_memtable_size_mb converted to bytes.
bloom_fpr
property
¶
False positive rate for bloom filters, based on current env.
Dev mode uses a higher FPR (smaller filters, faster builds). Prod mode uses a lower FPR (fewer false positives, larger filters).
__getattr__(name)
¶
Read a config field by name. Thread-safe.
Source code in app/engine/config.py
set(key, value)
¶
Update a config field and persist to disk.
Returns (old_value, new_value).
Raises :class:ConfigError if the key is unknown or the value
is invalid.
Source code in app/engine/config.py
to_dict()
¶
to_json(indent=2)
¶
load(data_root, config_path=None)
classmethod
¶
Load config from config_path, defaulting to <data_root>/config.json.
Source code in app/engine/config.py
Bloom Filter Settings¶
The bloom filter's false positive rate is environment-aware:
| Key | Dev default | Prod default | Description |
|---|---|---|---|
bloom_fpr_dev |
0.05 |
— | FPR used when env = "dev" |
bloom_fpr_prod |
— | 0.01 |
FPR used when env = "prod" |
The convenience property config.bloom_fpr auto-selects based on the current env.
The expected item count is derived from the actual data — not configurable:
- Flush: exact snapshot size (
len(snapshot)) - Compaction: total input record count
Update at runtime: