pub struct DatabaseBuilder { /* private fields */ }Expand description
Choices needed to open the database part of a store.
Implementations§
Source§impl DatabaseBuilder
impl DatabaseBuilder
Sourcepub fn new(directory: StoreDir) -> Self
pub fn new(directory: StoreDir) -> Self
Begin an open using a directory supplied by the store layout.
Sourcepub fn refuse_close(self) -> Self
pub fn refuse_close(self) -> Self
Have SQLite refuse to close the opened store’s writer.
Sourcepub fn subscribe_progress(&self) -> ProgressWatch<OpenStep>
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.
Sourcepub fn synced_tables(self, tables: Vec<SyncedTable>) -> Self
pub fn synced_tables(self, tables: Vec<SyncedTable>) -> Self
The tables that sync, described at the newest app schema version.
Sourcepub fn namespaces(self, namespaces: Vec<Namespace>) -> Self
pub fn namespaces(self, namespaces: Vec<Namespace>) -> Self
The file namespaces, each with its kind and cache budget (§17.1).
Sourcepub fn migrations(self, migrations: Vec<Migration>) -> Self
pub fn migrations(self, migrations: Vec<Migration>) -> Self
The complete app migration sequence, numbered from one.
Sourcepub fn loading_store(self) -> Self
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).
Sourcepub fn migration_operation<F>(self, operation: F) -> Self
pub fn migration_operation<F>(self, operation: F) -> Self
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.
Sourcepub fn id_source(self, ids: IdSourceRef) -> Self
pub fn id_source(self, ids: IdSourceRef) -> Self
The source of fresh names for this store’s owned file bytes (Appendix C.3).
Sourcepub fn sqlite_settings(self, settings: SqliteSettings) -> Self
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).
Sourcepub fn sql_functions(self, functions: SqlFunctions) -> Self
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).
Sourcepub async fn open(self) -> Result<Database, OpenError>
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.