Expand description
Shared application state for the HTTP server.
AppState carries the configured database path and offers a uniform
helper, AppState::with_connection, for running blocking SQLite work
on Tokio’s blocking-task pool. Every handler that touches the database
routes through this helper so that:
- The rusqlite dependency stays contained to one module,
- No handler accidentally blocks the async runtime,
- Each request gets a fresh read-only connection — matching the milestone 8 design decision on connection strategy.
The read-only connection is opened via [logdive_core::Indexer:: open_read_only], which enforces SQLite-level SQLITE_OPEN_READ_ONLY
semantics and fails fast if the DB file is missing (as opposed to
creating it, the way Indexer::open does).
Structs§
- AppState
- State shared across every HTTP handler.