pub struct Options<'a, P: Policy> {
pub settings: SqliteSettings,
pub readers: NonZeroUsize,
pub prepare_on_reader: bool,
pub whole_views: Arc<WholeViews>,
pub policy: &'a dyn Fn() -> P,
pub setup: &'a dyn Fn(&Setup<'_, P>, &P) -> Result<()>,
pub capture: Option<BTreeSet<String>>,
pub checkpoint_pages: Option<NonZeroU32>,
pub statistics: bool,
}Expand description
How to open a database’s connections. Every connection gets a policy of
its own from policy, and the same setup.
Fields§
§settings: SqliteSettingsThe SQLite settings of every connection.
readers: NonZeroUsizeThe read-only connections beside the writer.
prepare_on_reader: boolRun prepare on the first reader, and open the writer only once
prepare passes, leaving the journal mode as it is. Set this for a
database whose checks must not write, because its writer would create
the file or the schema the checks look for. Otherwise the writer
switches the database to WAL and runs prepare.
whole_views: Arc<WholeViews>The views and tables a live query reads whole.
policy: &'a dyn Fn() -> PEach connection’s policy, made as the connection opens.
setup: &'a dyn Fn(&Setup<'_, P>, &P) -> Result<()>What each connection registers, given that connection’s policy, before any SQL runs on it.
capture: Option<BTreeSet<String>>Capture the writer’s commits for the handle’s live queries, and record each operation of a write on these tables, named in lowercase, with every column’s value before and after it.
checkpoint_pages: Option<NonZeroU32>Checkpoint the WAL on a thread of its own once it holds this many frames not yet in the database file (§4).
statistics: boolGather the planner’s statistics as the database opens, keep them on a thread of their own while it stays open, and gather them again as it closes (§4).