Expand description
SQLite-backed index for ingested log entries.
This module owns the persistent storage side of logdive: schema creation,
row-level deduplication via blake3, and batched inserts of 1000 rows per
transaction (per the decisions log entry dated 2026-04-19). The schema is
reproduced verbatim from the project doc’s “SQLite schema” section with
IF NOT EXISTS added so opening an existing database is idempotent.
Indexer is an owning handle over a rusqlite::Connection. It can be
constructed against a filesystem path via Indexer::open or against an
in-memory database via Indexer::open_in_memory — the latter is used
by the unit tests below and will also serve ad-hoc one-shot scenarios.
For read-only consumers (the HTTP API in milestone 8), [Indexer:: open_read_only] opens an existing database without the schema init or
directory-creation side effects of Indexer::open, and enforces
read-only semantics at the SQLite level via SQLITE_OPEN_READ_ONLY.
§Timestamp NOT NULL policy
The schema declares timestamp TEXT NOT NULL, but the parser produces
LogEntry::timestamp = None for lines that omit the key. Rather than
fabricating a fallback (which would falsely anchor those rows to
ingestion time and confuse last Nh queries), the indexer skips such
rows and reports them in InsertStats::skipped_no_timestamp. This
mirrors the parser’s “graceful skip” philosophy — bad data is counted
and dropped, never manufactured.
Structs§
- Indexer
- Owning handle over a SQLite connection to a logdive index.
- Insert
Stats - Outcome of an insert batch, surfaced to the CLI for progress output (“lines ingested / lines skipped per second”, per milestone 6).
- Stats
- Aggregate metadata about the contents of an index.
Constants§
- BATCH_
SIZE - Size of a single insert transaction, per the decisions log (2026-04-19: “batch insert per 1000 lines”).
Functions§
- db_path
- Resolve the path to the index database.