Skip to main content

DatabaseBuilder

Struct DatabaseBuilder 

Source
pub struct DatabaseBuilder { /* private fields */ }
Expand description

Choices needed to open the database part of a store.

Implementations§

Source§

impl DatabaseBuilder

Source

pub fn new(directory: StoreDir) -> Self

Begin an open using a directory supplied by the store layout.

Source

pub fn refuse_close(self) -> Self

Have SQLite refuse to close the opened store’s writer.

Source

pub fn subscribe_progress(&self) -> ProgressWatch<OpenStep>

The steps a writable open reports as it runs them, each with how much of it is done (§4). A read-only open runs none.

Source

pub fn synced_tables(self, tables: Vec<SyncedTable>) -> Self

The tables that sync, described at the newest app schema version.

Source

pub fn namespaces(self, namespaces: Vec<Namespace>) -> Self

The file namespaces, each with its kind and cache budget (§17.1).

Source

pub fn migrations(self, migrations: Vec<Migration>) -> Self

The complete app migration sequence, numbered from one.

Source

pub fn loading_store(self) -> Self

Open an installation that loads its store from storage next, for a join, restore or reset: its breaking migrations make no migration write, since the device isn’t registered yet and the load replaces what they changed (§18.4).

Source

pub fn migration_operation<F>(self, operation: F) -> Self
where F: Fn(u32) -> Result<NewOperation, DbError> + Send + Sync + 'static,

Let sync describe the operation that publishes a breaking migration batch. The database commits its step 1 with the schema, converted waiting writes and migration write. A factory error rolls all of them back. Standalone database users may omit this; the application composition root supplies it.

Source

pub fn clock(self, clock: ClockRef) -> Self

The clock used when stamping a local write (§7.2).

Source

pub fn id_source(self, ids: IdSourceRef) -> Self

The source of fresh names for this store’s owned file bytes (Appendix C.3).

Source

pub fn sqlite_settings(self, settings: SqliteSettings) -> Self

SQLite settings for every connection to the store’s database; unset ones keep SQLite’s defaults, except that checkpoint_fullfsync is on for macOS and iOS (§4).

Source

pub fn sql_functions(self, functions: SqlFunctions) -> Self

The app’s collations and scalar functions, registered on every connection to the store’s database before any app SQL runs on it (§4).

Source

pub async fn open(self) -> Result<Database, OpenError>

Open one writer under the store lock and four read-only connections. Always migrate coven’s internal tables, then rebuild the indexes a new version of SQLite or of the app’s collations and functions changes, then migrate the app’s schema.

Source

pub async fn open_locked(self, lock: StoreLock) -> Result<Database, OpenError>

Open under a lock already held by the facade while checking restored device identity. The lock must protect this builder’s directory.

Source

pub async fn open_read_only(self) -> Result<Database<ReadOnly>, OpenError>

Open read-only connections under a shared deletion guard, without migrating or rebuilding, including from a second process while the writer is open.

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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
§

impl<T> ErasedDestructor for T
where T: 'static,