Skip to main content

Module state

Module state 

Source
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:

  1. The rusqlite dependency stays contained to one module,
  2. No handler accidentally blocks the async runtime,
  3. 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.