pub trait StorageBackend {
// Required methods
fn location(&self) -> String;
fn open(&self, name: &str) -> Result<Box<dyn StoredDatabase>, LoadError>;
fn drop_databases(&self, matches: &dyn Fn(&str) -> bool) -> DroppedDatabases;
// Provided method
fn collect_databases(&self, except: &str, now: f64, max_age: f64) { ... }
}Expand description
A place that keeps a client’s databases, such as a directory of SQLite files. Every call is on the client’s thread.
Required Methods§
Sourcefn location(&self) -> String
fn location(&self) -> String
Where the databases are, such as sqlite:/path/to/dir. Clients on
this thread with the same location and database name share one open
database, as JS tabs share one IndexedDB database.
Sourcefn open(&self, name: &str) -> Result<Box<dyn StoredDatabase>, LoadError>
fn open(&self, name: &str) -> Result<Box<dyn StoredDatabase>, LoadError>
Opens the database name, a new empty one if there is none. name
can hold any character.
Sourcefn drop_databases(&self, matches: &dyn Fn(&str) -> bool) -> DroppedDatabases
fn drop_databases(&self, matches: &dyn Fn(&str) -> bool) -> DroppedDatabases
Deletes the databases that aren’t open whose name matches.
Provided Methods§
Sourcefn collect_databases(&self, except: &str, now: f64, max_age: f64)
fn collect_databases(&self, except: &str, now: f64, max_age: f64)
Deletes, in the background, the databases other than except that
no client used for max_age ms since now (collectIDBDatabases),
such as those of an older schema. Optional.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".