flameiq.storage — Local Storage
FlameIQ local baseline storage.
All storage is file-based. Zero external services required.
Layout:
.flameiq/
└── baselines/
├── current.json ← active baseline (pretty-printed JSON)
└── history.jsonl ← append-only run log (one JSON object per line)
Default root: .flameiq/ in the current working directory.
Override via BaselineStore(root=Path("/custom/path")).
- class flameiq.storage.baseline_store.BaselineStore(root=None)[source]
Bases:
objectManages local baseline and run-history storage.
- Parameters:
root (Path | None) – The
.flameiqroot directory. Defaults toPath(".flameiq")relative tocwd.
Example:
store = BaselineStore() store.save_baseline(snapshot) baseline = store.load_baseline() history = store.load_history()
Initialize the store with the given root path.
- __init__(root=None)[source]
Initialize the store with the given root path.
- Parameters:
root (Path | None)
- Return type:
None
- load_baseline()[source]
Load the current baseline snapshot from disk.
- Returns:
The stored
PerformanceSnapshot.- Raises:
BaselineNotFoundError – If no baseline has been set.
BaselineCorruptedError – If the file cannot be parsed.
- Return type:
- save_baseline(snapshot)[source]
Save snapshot as the current baseline and append to history.
- Parameters:
snapshot (PerformanceSnapshot) – The snapshot to persist.
- Raises:
StorageError – On write failure.
- Return type:
None
- load_history()[source]
Load all historical snapshots from the JSONL log.
- Returns:
List of snapshots, oldest first. Empty list if no history file exists.
- Return type:
- clear()[source]
Delete all stored baselines and history.
Warning
Destructive — this cannot be undone.
- Raises:
StorageError – On deletion failure.
- Return type:
None