Skip to main content

WriteBatch

Trait WriteBatch 

Source
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§

Source

fn commit_time(&self) -> ReadTime

The time this commit will be stamped with (and the documents’ update_time).

Source

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.

Source

fn set(&mut self, path: &ResourcePath, fields: Fields)

Replaces the document’s fields. Keeps create_time if the document exists.

Source

fn delete(&mut self, path: &ResourcePath)

Deletes the document. Deleting a missing document is not an error.

Source

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.

Source

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".

Implementors§