pub trait WriteBatch {
// Required methods
fn commit_time(&self) -> ReadTime;
fn get(&self, path: &ResourcePath) -> Option<Arc<StoredDocument>>;
fn set(&mut self, path: &ResourcePath, fields: Fields);
fn delete(&mut self, path: &ResourcePath);
fn deleted_at(&self, path: &ResourcePath) -> Option<ReadTime>;
fn revert(&mut self, path: &ResourcePath);
}Expand description
The writes of one commit, with read-your-writes visibility.
Required Methods§
Sourcefn commit_time(&self) -> ReadTime
fn commit_time(&self) -> ReadTime
The time this commit will be stamped with (and the documents’ update_time).
Sourcefn get(&self, path: &ResourcePath) -> Option<Arc<StoredDocument>>
fn get(&self, path: &ResourcePath) -> Option<Arc<StoredDocument>>
The document as it will be if the commit succeeds now: the batch’s own writes first, then the latest committed version.
Sourcefn set(&mut self, path: &ResourcePath, fields: Fields)
fn set(&mut self, path: &ResourcePath, fields: Fields)
Replaces the document’s fields. Keeps create_time if the document exists.
Sourcefn delete(&mut self, path: &ResourcePath)
fn delete(&mut self, path: &ResourcePath)
Deletes the document. Deleting a missing document is not an error.
Sourcefn deleted_at(&self, path: &ResourcePath) -> Option<ReadTime>
fn deleted_at(&self, path: &ResourcePath) -> Option<ReadTime>
When a commit deleted the document, if it is missing because one did (not when it never existed, nor when a delete found it missing): the commit time of that deletion, which is the version a version precondition compares with.
Sourcefn revert(&mut self, path: &ResourcePath)
fn revert(&mut self, path: &ResourcePath)
Drops the batch’s writes to the document, which keeps its latest committed version: a commit whose writes leave a document as it was changes nothing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".