pub struct MemoryStorage { /* private fields */ }Expand description
Detached in-memory reference implementation of Storage. Reads return owned copies.
Implementations§
Source§impl MemoryStorage
impl MemoryStorage
pub fn new() -> Self
Sourcepub fn with_commit_sink(self, sink: CommitSink) -> Self
pub fn with_commit_sink(self, sink: CommitSink) -> Self
Every later commit goes through sink before it is applied.
Sourcepub fn prepare_commit(
&self,
writes: Vec<StorageWrite>,
seq: Option<Seq>,
) -> Result<PreparedCommit>
pub fn prepare_commit( &self, writes: Vec<StorageWrite>, seq: Option<Seq>, ) -> Result<PreparedCommit>
Validate one commit and resolve its document copies without changing observable state. seq defaults to the
next sequence; a replaying caller (JSONL recovery) supplies the recorded one, which must not go backwards.
Sourcepub fn apply_commit(&mut self, prepared: PreparedCommit) -> Seq
pub fn apply_commit(&mut self, prepared: PreparedCommit) -> Seq
Apply a commit prepared against the current state; nothing in it can fail.
Trait Implementations§
Source§impl Default for MemoryStorage
impl Default for MemoryStorage
Source§impl Storage for MemoryStorage
impl Storage for MemoryStorage
Source§fn commit(&mut self, writes: Vec<StorageWrite>) -> Result<Seq>
fn commit(&mut self, writes: Vec<StorageWrite>) -> Result<Seq>
Atomically persist one batch and return its sequence; later reads observe it.
Source§fn mint_id(&mut self) -> Result<u64>
fn mint_id(&mut self) -> Result<u64>
A fresh ID from the Session-global namespace, greater than every ID minted or stored before, across reopen.
fn conversation(&self, id: ConversationId) -> Result<Option<ConversationRecord>>
fn scan_conversations( &self, query: &ConversationQuery, limit: usize, cursor: Option<&Cursor>, ) -> Result<Page<ConversationRecord>>
fn entry(&self, id: EntryId) -> Result<Option<StoredEntry>>
Source§fn visible_entry(
&self,
conversation_id: ConversationId,
id: EntryId,
) -> Result<Option<StoredEntry>>
fn visible_entry( &self, conversation_id: ConversationId, id: EntryId, ) -> Result<Option<StoredEntry>>
One entry only when it is visible through the conversation’s fork ancestry.
Source§fn find_latest_head_marker(
&self,
conversation_id: ConversationId,
at_or_before: Option<EntryId>,
) -> Result<Option<EntryRecord>>
fn find_latest_head_marker( &self, conversation_id: ConversationId, at_or_before: Option<EntryId>, ) -> Result<Option<EntryRecord>>
The newest visible entry with a
head at or below the optional inclusive cutoff.fn scan_entries( &self, query: &EntryQuery, limit: usize, cursor: Option<&Cursor>, ) -> Result<Page<EntryRecord>>
fn task(&self, id: TaskId) -> Result<Option<TaskRecord>>
fn scan_tasks( &self, query: &TaskQuery, limit: usize, cursor: Option<&Cursor>, ) -> Result<Page<TaskRecord>>
fn submission(&self, id: SubmissionId) -> Result<Option<SubmissionRecord>>
fn scan_submissions( &self, query: &SubmissionQuery, limit: usize, cursor: Option<&Cursor>, ) -> Result<Page<SubmissionRecord>>
fn submission_by_request( &self, conversation_id: ConversationId, request_id: &str, ) -> Result<Option<SubmissionRecord>>
Source§fn find_document(
&self,
address: &DocumentAddress,
at: DocumentPoint,
) -> Result<Option<DocumentRecord>>
fn find_document( &self, address: &DocumentAddress, at: DocumentPoint, ) -> Result<Option<DocumentRecord>>
The incarnation occupying one exact logical address at the point.
Source§fn document(
&self,
id: DocumentId,
at: DocumentPoint,
) -> Result<Option<StoredDocument>>
fn document( &self, id: DocumentId, at: DocumentPoint, ) -> Result<Option<StoredDocument>>
Materialize one incarnation by ID at the point, without following a replacement at its address.
fn scan_documents( &self, query: &DocumentQuery, limit: usize, cursor: Option<&Cursor>, ) -> Result<Page<DocumentRecord>>
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryStorage
impl !Sync for MemoryStorage
impl !UnwindSafe for MemoryStorage
impl Forget for MemoryStorage
impl Freeze for MemoryStorage
impl Move for MemoryStorage
impl Send for MemoryStorage
impl Unpin for MemoryStorage
impl UnsafeUnpin for MemoryStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more