Skip to main content

MemoryDocumentStore

Struct MemoryDocumentStore 

Source
pub struct MemoryDocumentStore { /* private fields */ }

Implementations§

Source§

impl MemoryDocumentStore

Source

pub fn new() -> Self

Source

pub fn iter(&self) -> impl Iterator<Item = (DocId, Document)> + '_

Trait Implementations§

Source§

impl Clone for MemoryDocumentStore

Cloning retains independent row maps and layouts; snapshot APIs share them until a write.

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MemoryDocumentStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryDocumentStore

Source§

fn default() -> MemoryDocumentStore

Returns the “default value” for a type. Read more
Source§

impl DocumentStore for MemoryDocumentStore

Source§

fn put(&mut self, doc_id: DocId, document: Document) -> StorageBackendResult<()>

Replace public fields while preserving metadata already owned by the stored tuple. Engine code that creates a new tuple version must call DocumentStore::put_stored with the new metadata explicitly.
Source§

fn get(&self, doc_id: DocId) -> StorageBackendResult<Option<Document>>

Source§

fn put_stored( &mut self, doc_id: DocId, document: StoredDocument, ) -> StorageBackendResult<()>

Persist one typed storage record. Every backend owns the physical representation of tuple metadata and must keep it outside the public field map.
Source§

fn get_stored( &self, doc_id: DocId, ) -> StorageBackendResult<Option<StoredDocument>>

Read one typed storage record without projecting metadata into user fields.
Source§

fn get_stored_many( &self, doc_ids: &[DocId], ) -> StorageBackendResult<BTreeMap<DocId, StoredDocument>>

Bulk variant of DocumentStore::get_stored.
Source§

fn get_metadata( &self, doc_id: DocId, ) -> StorageBackendResult<Option<DocumentMetadata>>

Read one tuple’s storage metadata without exposing it as a field.
Source§

fn contains_doc_id(&self, doc_id: DocId) -> StorageBackendResult<bool>

Source§

fn get_field( &self, doc_id: DocId, field: &str, ) -> StorageBackendResult<Option<Value>>

Read a single field. Returns an owned Value so persistent backends (SQLite, …) can decode on demand without reaching for a reference into a transient row.
Source§

fn get_fields_multi( &self, doc_ids: &[DocId], fields: &[&str], ) -> StorageBackendResult<BTreeMap<DocId, Vec<Value>>>

Fetch several top-level fields for many documents. The result vector is aligned with fields; missing fields come back as Value::Null, ids without a document are absent. Persistent backends override this to extract all fields in one scan instead of materialising whole documents.
Source§

fn for_each_fields_multi( &self, doc_ids: &[DocId], fields: &[&str], visitor: &mut dyn FnMut(DocId, Vec<Value>) -> bool, ) -> StorageBackendResult<()>

Visit a column projection in the caller’s document-id order. The callback receives one owned row at a time, allowing scan and aggregate pipelines to avoid materialising a second doc-id map. Returning false stops the visit early. Missing documents yield a row of NULLs, matching row-evaluator semantics.
Source§

fn for_each_fields_multi_ref( &self, doc_ids: &[DocId], fields: &[&str], visitor: &mut dyn FnMut(DocId, &[&Value]) -> bool, ) -> StorageBackendResult<()>

Visit a column projection by reference when the backend can keep decoded values alive for the duration of the callback. The default adapter preserves the backend’s owned/batched projection path; in-memory stores override it to avoid cloning every projected value.
Source§

fn for_each_fields_multi_ref_with_presence( &self, doc_ids: &[DocId], fields: &[&str], visitor: &mut dyn FnMut(DocId, bool, &[&Value]) -> bool, ) -> StorageBackendResult<()>

Visit a projection together with whether each requested document actually exists. This avoids a separate contains_doc_id probe when a caller must distinguish a missing document from an existing document whose requested fields are all NULL.
Source§

fn get_shared_fields( &self, doc_ids: &[DocId], fields: &[&str], ) -> StorageBackendResult<Option<Vec<Option<SharedDocumentRow>>>>

Return rows aligned with doc_ids as shared positional projections when the backend owns stable decoded value vectors. None means the backend does not support zero-copy projection; entries inside the returned vector are None only for missing document ids.
Source§

fn find_doc_id_by_field( &self, field: &str, value: &Value, ) -> StorageBackendResult<Option<DocId>>

Find the first document whose top-level field equals value. Persistent stores can override this with an indexed or JSON-path lookup so point updates do not have to materialise every row.
Source§

fn find_doc_id_by_fields( &self, fields: &[String], values: &[Value], ) -> StorageBackendResult<Option<DocId>>

Find the first document whose top-level fields match every requested value.
Source§

fn patch_fields( &mut self, doc_id: DocId, updates: &BTreeMap<String, Value>, ) -> StorageBackendResult<bool>

Apply top-level field updates without requiring callers to materialise the whole document. Value::Null matches put by removing the stored field. Ok(false) means the document does not exist; write failures surface as Err.
Source§

fn delete(&mut self, doc_id: DocId) -> StorageBackendResult<()>

Source§

fn clear(&mut self) -> StorageBackendResult<()>

Source§

fn doc_ids(&self) -> StorageBackendResult<Vec<DocId>>

Source§

fn next_doc_id( &self, after: Option<DocId>, ) -> StorageBackendResult<Option<DocId>>

Return the first stored document id strictly greater than after, or the first id when after is None. Scan operators use this cursor API so a full table scan does not need a cardinality-sized id vector before it can yield its first row.
Source§

fn next_doc_ids( &self, after: Option<DocId>, limit: usize, ) -> StorageBackendResult<Vec<DocId>>

Return up to limit document ids strictly greater than after, in ascending order. Scan operators use this bounded cursor instead of reacquiring their store lock and issuing one backend lookup per row.
Source§

fn next_shared_fields( &self, after: Option<DocId>, limit: usize, fields: &[&str], ) -> StorageBackendResult<Option<Vec<(DocId, SharedDocumentRow)>>>

Return the next bounded id range and its shared positional projections in one storage traversal when stable decoded rows are available. None lets persistent backends use the ordinary id + projection path.
Source§

fn for_each_next_fields( &self, after: Option<DocId>, limit: usize, fields: &[&str], visitor: &mut dyn FnMut(DocId, &[&Value]) -> bool, ) -> StorageBackendResult<Option<usize>>

Visit the next bounded id range through a reusable borrowed projection of each backend-owned row. Missing fields are exposed as SQL NULL. Some(count) means the backend supports this borrowed cursor and reports how many rows it visited; None selects the ordinary cursor path without invoking visitor.
Source§

fn len(&self) -> StorageBackendResult<usize>

Source§

fn snapshot(&self) -> StorageBackendResult<Arc<dyn DocumentStore>>

Read-only handle suitable for an ExecutionContext. Persistent backends share their connection; memory backends deep-clone so the snapshot is isolated from later mutations.
Source§

fn writable_snapshot(&self) -> StorageBackendResult<Box<dyn DocumentStore>>

Independent writable copy used by the in-memory engine transaction rollback path. Persistent engines restore through their backend transaction and need not implement this operation.
Source§

fn get_many( &self, doc_ids: &[DocId], ) -> StorageBackendResult<BTreeMap<DocId, Document>>

Bulk variant of DocumentStore::get. Ids without a stored document are absent from the result. The default implementation walks each id one at a time; persistent backends should override to batch the reads into few queries.
Source§

fn get_fields_bulk( &self, doc_ids: &[DocId], field: &str, ) -> StorageBackendResult<BTreeMap<DocId, Value>>

Bulk variant of DocumentStore::get_field. The default implementation walks each id one at a time; persistent backends should override to run a single batched query.
Source§

fn has_value(&self, field: &str, value: &Value) -> StorageBackendResult<bool>

Return true if any document has field == value.
Source§

fn eval_path( &self, doc_id: DocId, path: &[PathSegment], ) -> StorageBackendResult<Option<Value>>

Evaluate a hierarchical path expression against a document.
Source§

fn max_doc_id(&self) -> StorageBackendResult<DocId>

Source§

fn is_empty(&self) -> StorageBackendResult<bool>

Source§

fn iter_all( &self, ) -> StorageBackendResult<Box<dyn Iterator<Item = (DocId, Document)> + '_>>

Iterate over (doc_id, document) pairs in id order. The default implementation fetches each document individually; SQLite-backed stores override with a single query.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.