pub trait Store: Send + Sync {
// Required methods
fn latest_read_time(&self, database: &str) -> ReadTime;
fn earliest_read_time(&self, database: &str) -> ReadTime;
fn get(
&self,
database: &str,
path: &ResourcePath,
at: ReadTime,
) -> Option<Arc<StoredDocument>>;
fn list_collection(
&self,
database: &str,
collection: &ResourcePath,
at: ReadTime,
options: ListOptions<'_>,
visit: &mut dyn FnMut(ListItem<'_>) -> ControlFlow<()>,
);
fn scan_collection_group(
&self,
database: &str,
parent: &ResourcePath,
collection_id: &str,
at: ReadTime,
visit: &mut Visit<'_>,
);
fn scan_descendants(
&self,
database: &str,
parent: &ResourcePath,
at: ReadTime,
visit: &mut Visit<'_>,
);
fn list_collection_ids(
&self,
database: &str,
parent: &ResourcePath,
at: ReadTime,
) -> Vec<String>;
fn commit(
&self,
database: &str,
write: &mut dyn FnMut(&mut dyn WriteBatch) -> Result<(), StoreError>,
) -> Result<Commit, StoreError>;
fn clear_database(&self, database: &str) -> ReadTime;
fn database_names(&self) -> Vec<String>;
fn clear(&self);
// Provided method
fn scan_collection(
&self,
database: &str,
collection: &ResourcePath,
at: ReadTime,
visit: &mut Visit<'_>,
) { ... }
}Expand description
The storage engine. database is the full database name,
projects/{project}/databases/{database}; databases are created on first write.
Required Methods§
Sourcefn latest_read_time(&self, database: &str) -> ReadTime
fn latest_read_time(&self, database: &str) -> ReadTime
A read time that sees every commit made so far.
Sourcefn earliest_read_time(&self, database: &str) -> ReadTime
fn earliest_read_time(&self, database: &str) -> ReadTime
The oldest read time still served; older versions may have been dropped.
fn get( &self, database: &str, path: &ResourcePath, at: ReadTime, ) -> Option<Arc<StoredDocument>>
Sourcefn list_collection(
&self,
database: &str,
collection: &ResourcePath,
at: ReadTime,
options: ListOptions<'_>,
visit: &mut dyn FnMut(ListItem<'_>) -> ControlFlow<()>,
)
fn list_collection( &self, database: &str, collection: &ResourcePath, at: ReadTime, options: ListOptions<'_>, visit: &mut dyn FnMut(ListItem<'_>) -> ControlFlow<()>, )
Like Store::scan_collection, with paging and missing documents.
Sourcefn scan_collection_group(
&self,
database: &str,
parent: &ResourcePath,
collection_id: &str,
at: ReadTime,
visit: &mut Visit<'_>,
)
fn scan_collection_group( &self, database: &str, parent: &ResourcePath, collection_id: &str, at: ReadTime, visit: &mut Visit<'_>, )
Every document under parent (a document path, or the root) whose collection ID is
collection_id, at any depth, ordered by full path.
Sourcefn scan_descendants(
&self,
database: &str,
parent: &ResourcePath,
at: ReadTime,
visit: &mut Visit<'_>,
)
fn scan_descendants( &self, database: &str, parent: &ResourcePath, at: ReadTime, visit: &mut Visit<'_>, )
Every document below parent (a document path, or the root), at any depth, ordered by
path. parent itself is not included.
Sourcefn list_collection_ids(
&self,
database: &str,
parent: &ResourcePath,
at: ReadTime,
) -> Vec<String>
fn list_collection_ids( &self, database: &str, parent: &ResourcePath, at: ReadTime, ) -> Vec<String>
IDs of the collections directly under parent that contain at least one document at
any depth, in UTF-8 order.
Sourcefn commit(
&self,
database: &str,
write: &mut dyn FnMut(&mut dyn WriteBatch) -> Result<(), StoreError>,
) -> Result<Commit, StoreError>
fn commit( &self, database: &str, write: &mut dyn FnMut(&mut dyn WriteBatch) -> Result<(), StoreError>, ) -> Result<Commit, StoreError>
Runs write as one atomic commit.
Sourcefn clear_database(&self, database: &str) -> ReadTime
fn clear_database(&self, database: &str) -> ReadTime
Drops every document of database and every older version, at a time after its last
commit, which it returns: later commits are later still, so listeners can order the
clear among them.
Sourcefn database_names(&self) -> Vec<String>
fn database_names(&self) -> Vec<String>
The databases that hold or held documents.
Provided Methods§
Sourcefn scan_collection(
&self,
database: &str,
collection: &ResourcePath,
at: ReadTime,
visit: &mut Visit<'_>,
)
fn scan_collection( &self, database: &str, collection: &ResourcePath, at: ReadTime, visit: &mut Visit<'_>, )
The documents directly in collection (not in its subcollections).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".