Skip to main content

SqliteSettings

Struct SqliteSettings 

Source
pub struct SqliteSettings {
Show 16 fields pub busy_timeout: Option<Duration>, pub cache_size: Option<CacheSize>, pub cache_spill: Option<CacheSpill>, pub mmap_size: Option<u64>, pub temp_store: Option<TempStore>, pub threads: Option<u32>, pub journal_size_limit: Option<JournalSizeLimit>, pub wal_autocheckpoint: Option<WalAutocheckpoint>, pub automatic_index: Option<bool>, pub cell_size_check: Option<bool>, pub secure_delete: Option<SecureDelete>, pub fullfsync: Option<bool>, pub checkpoint_fullfsync: Option<bool>, pub analysis_limit: Option<AnalysisLimit>, pub page_size: Option<PageSize>, pub auto_vacuum: Option<AutoVacuum>,
}
Expand description

SQLite settings for every connection sqlive opens to a database: the writer and the readers of a writable handle, and every connection of a read-only one. A setting left None keeps SQLite’s own default, except checkpoint_fullfsync on macOS and iOS, which sqlive turns on, and auto_vacuum, which is Incremental. sqlive applies them as each connection opens, before any of its own statements.

The settings sqlive’s guarantees rest on have no field here: the journal mode, synchronous, the locking mode, foreign keys and the rest stay fixed (§4).

ⓘ
let _ = sqlive::SqliteSettings {
    journal_mode: None,
    ..Default::default()
};

Fields§

§busy_timeout: Option<Duration>

How long a connection waits for a lock another connection holds before failing with SQLITE_BUSY (PRAGMA busy_timeout), at most i32::MAX milliseconds. Unset keeps the 5 seconds rusqlite sets when it opens a connection. RESTART and TRUNCATE checkpoints wait this long for readers.

§cache_size: Option<CacheSize>

The size of each connection’s page cache (PRAGMA cache_size).

§cache_spill: Option<CacheSpill>

Whether, and past how many cached pages, a transaction writes changed pages to the file before it commits (PRAGMA cache_spill).

§mmap_size: Option<u64>

Bytes of the database read through memory-mapped I/O (PRAGMA mmap_size), at most i64::MAX. SQLite lowers it to the largest size it was built to map.

§temp_store: Option<TempStore>

Where temporary tables and indices are kept (PRAGMA temp_store). On Android, sqlive’s SQLite is built to keep them in memory whatever this says.

§threads: Option<u32>

Helper threads one statement may use to sort (PRAGMA threads), at most i32::MAX. SQLite lowers it to the most it was built to allow.

§journal_size_limit: Option<JournalSizeLimit>

The size SQLite truncates the WAL file to at the first commit after a checkpoint lets the WAL start over (PRAGMA journal_size_limit). Unset is sqlive’s 4 MiB.

§wal_autocheckpoint: Option<WalAutocheckpoint>

The WAL size at which sqlive checkpoints it, off the commit path; unset is SQLite’s 1000 pages (§4). None of a writable handle’s connections runs a checkpoint as it commits. A read-only handle’s own commits, which only its cache makes, checkpoint as SQLite’s PRAGMA wal_autocheckpoint does.

§automatic_index: Option<bool>

Whether the query planner may build a temporary index for one query (PRAGMA automatic_index).

§cell_size_check: Option<bool>

Whether SQLite checks each page’s cells for damage as it reads them (PRAGMA cell_size_check).

§secure_delete: Option<SecureDelete>

Whether deleted content is overwritten in the file (PRAGMA secure_delete).

§fullfsync: Option<bool>

Whether a commit’s sync on macOS and iOS also flushes the drive’s own cache, F_FULLFSYNC (PRAGMA fullfsync). Other platforms ignore it. Unset keeps SQLite’s default, off, so a power loss can lose the latest commits.

§checkpoint_fullfsync: Option<bool>

The same for checkpoints (PRAGMA checkpoint_fullfsync). Unset is on for macOS and iOS, so a power loss can’t leave the database file holding only part of a checkpoint after the WAL has started over.

§analysis_limit: Option<AnalysisLimit>

How many rows of each index ANALYZE reads (PRAGMA analysis_limit).

§page_size: Option<PageSize>

The page size SQLite creates a database with (PRAGMA page_size). SQLite fixes the size once the file has its first page, so an existing database keeps the size SQLite created it with.

§auto_vacuum: Option<AutoVacuum>

The auto-vacuum mode a database is created with (PRAGMA auto_vacuum). Like the page size, an existing database keeps its own. Unset is Incremental, and a host gives back free pages past 4 MiB through give_back_free_pages, as coven does each time a claim lands (§4).

Implementations§

Source§

impl SqliteSettings

Source

pub fn checkpoint_pages(&self) -> Option<NonZeroU32>

The WAL size at which sqlive checkpoints it, or None if it never does.

Trait Implementations§

Source§

impl Clone for SqliteSettings

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SqliteSettings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SqliteSettings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for SqliteSettings

Source§

impl PartialEq for SqliteSettings

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SqliteSettings

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more