# 0001 Storage Engine And Source Generation

## Status

Accepted

## Context

CBDD targets embedded workloads where predictable latency and low operational overhead are priorities. Runtime reflection and remote database dependencies increase startup and runtime variance for this workload profile.

## Decision

1. Use an embedded storage engine with page-based persistence and WAL-backed transactions.
2. Use compile-time source generation for mapping instead of runtime reflection.
3. Keep query and indexing execution in-process for deterministic behavior.

## Consequences

Positive:
- Lower runtime allocation and startup overhead.
- Strong control over transaction and recovery behavior.
- Predictable deployment for local/offline workloads.

Trade-offs:
- Greater maintenance burden for custom storage/query engine internals.
- Source generator complexity requires dedicated regression coverage.

## Related Documents

- [`../architecture.md`](../architecture.md)
- [`../runbook.md`](../runbook.md)
- [`../../RFC.md`](../../RFC.md)
