pub struct DocumentChanges { /* private fields */ }Expand description
A fixed selection of replacements and tombstones, and the rows running commands staged above it. Clones and document snapshots share both the selection and its allocation lease; fallible extensions charge replacement capacity while retaining the original source owners.
Implementations§
Source§impl DocumentChanges
impl DocumentChanges
Sourcepub fn identity_counts(&self) -> Option<ChangedRowCounts>
pub fn identity_counts(&self) -> Option<ChangedRowCounts>
The counted rows a transaction changed, when these changes are exactly those rows, which a read then counts without visiting them.
Source§impl DocumentChanges
impl DocumentChanges
Sourcepub fn extend(
&mut self,
newer: Self,
control: &StorageReadControl,
) -> StorageBackendResult<()>
pub fn extend( &mut self, newer: Self, control: &StorageReadControl, ) -> StorageBackendResult<()>
Merge complete ordered views before publication. Failure leaves both the original selection and its charged capacity unchanged.
Source§impl DocumentChanges
impl DocumentChanges
Sourcepub fn with_retained_vectors(
self,
documents: Arc<dyn DocumentStore>,
desired: DocumentSelection,
columns: &[ColumnDef],
indexes: &dyn VectorIndexSource,
control: &StorageReadControl,
) -> StorageBackendResult<Self>
pub fn with_retained_vectors( self, documents: Arc<dyn DocumentStore>, desired: DocumentSelection, columns: &[ColumnDef], indexes: &dyn VectorIndexSource, control: &StorageReadControl, ) -> StorageBackendResult<Self>
Capture immutable rows and their actual canonical vector sources at the same selected table boundary. Each retained row, including a tombstone, keeps the source that supplied that version across later captures, schema renames and transaction completion. Raw sources carry values independently of physical mutation provenance.
Sourcepub fn with_identities(
self,
changed: ChangedIdentitiesView,
documents: Arc<dyn DocumentStore>,
columns: &[ColumnDef],
indexes: &dyn VectorIndexSource,
control: &StorageReadControl,
) -> StorageBackendResult<Self>
pub fn with_identities( self, changed: ChangedIdentitiesView, documents: Arc<dyn DocumentStore>, columns: &[ColumnDef], indexes: &dyn VectorIndexSource, control: &StorageReadControl, ) -> StorageBackendResult<Self>
These changes with the rows a transaction changed above them, as changed records them: each present one read from documents, the transaction’s view of the relation, with the vector sources it holds now.
Source§impl DocumentChanges
impl DocumentChanges
Sourcepub fn capture_owned(
source: &dyn DocumentStore,
desired: DocumentSelection,
control: &StorageReadControl,
) -> StorageBackendResult<Self>
pub fn capture_owned( source: &dyn DocumentStore, desired: DocumentSelection, control: &StorageReadControl, ) -> StorageBackendResult<Self>
Serialized providers copy selected private rows while their live handle is guarded; immutable providers use with_retained instead.
pub fn has_changes(&self) -> bool
pub fn contains_change(&self, id: DocId) -> StorageBackendResult<bool>
pub fn change_presence(&self, id: DocId) -> StorageBackendResult<Option<bool>>
Sourcepub fn changes(&self) -> Changes<bool, bool> ⓘ
pub fn changes(&self) -> Changes<bool, bool> ⓘ
Visit every change in identity order, each with whether its row is present afterwards.
Sourcepub fn with_retained(
self,
source: Arc<dyn DocumentStore>,
desired: DocumentSelection,
control: &StorageReadControl,
) -> StorageBackendResult<Self>
pub fn with_retained( self, source: Arc<dyn DocumentStore>, desired: DocumentSelection, control: &StorageReadControl, ) -> StorageBackendResult<Self>
source must already retain an immutable snapshot. Membership checks normalize missing replacements into tombstones without reading complete row payloads.
Sourcepub fn from_retained(
rows: impl IntoIterator<Item = (DocId, Option<(RetainedDocumentFields, DocumentMetadata)>)>,
control: &StorageReadControl,
) -> StorageBackendResult<Self>
pub fn from_retained( rows: impl IntoIterator<Item = (DocId, Option<(RetainedDocumentFields, DocumentMetadata)>)>, control: &StorageReadControl, ) -> StorageBackendResult<Self>
Capture already charged immutable fields without copying or reserving their payload again.
Capture evaluated fields without copying their payloads, then merge the complete selection with an older view.
pub fn from_rows( rows: BTreeMap<DocId, Option<StoredDocument>>, control: &StorageReadControl, ) -> StorageBackendResult<Self>
pub fn into_rows( self, ) -> impl Iterator<Item = StorageBackendResult<(DocId, Option<StoredDocument>)>>
Source§impl DocumentChanges
impl DocumentChanges
Sourcepub fn row_matches(
&self,
id: DocId,
columns: &[String],
values: &[Value],
presence: FieldPresence,
) -> Result<bool, SQLError>
pub fn row_matches( &self, id: DocId, columns: &[String], values: &[Value], presence: FieldPresence, ) -> Result<bool, SQLError>
Whether the changed row of id holds values in columns.
pub fn row_matches_with_catalog( &self, id: DocId, columns: &[String], values: &[Value], presence: FieldPresence, catalog: Option<&dyn SQLValueCatalog>, ) -> Result<bool, SQLError>
Trait Implementations§
Source§impl Clone for DocumentChanges
impl Clone for DocumentChanges
Source§impl Default for DocumentChanges
impl Default for DocumentChanges
Source§impl DocumentStore for DocumentChanges
impl DocumentStore for DocumentChanges
Source§fn put(&mut self, _: DocId, _: Document) -> StorageBackendResult<()>
fn put(&mut self, _: DocId, _: Document) -> StorageBackendResult<()>
DocumentStore::put_stored with the new metadata explicitly.Source§fn put_stored(
&mut self,
_: DocId,
_: StoredDocument,
) -> StorageBackendResult<()>
fn put_stored( &mut self, _: DocId, _: StoredDocument, ) -> StorageBackendResult<()>
Source§fn patch_fields(
&mut self,
_: DocId,
_: &BTreeMap<String, Value>,
) -> StorageBackendResult<bool>
fn patch_fields( &mut self, _: DocId, _: &BTreeMap<String, Value>, ) -> StorageBackendResult<bool>
Value::Null matches put by
removing the stored field. Ok(false) means the document does
not exist; write failures surface as Err.fn delete(&mut self, _: DocId) -> StorageBackendResult<()>
fn clear(&mut self) -> StorageBackendResult<()>
Source§fn get_stored(&self, id: DocId) -> StorageBackendResult<Option<StoredDocument>>
fn get_stored(&self, id: DocId) -> StorageBackendResult<Option<StoredDocument>>
Source§fn get_stored_many(
&self,
ids: &[DocId],
) -> StorageBackendResult<BTreeMap<DocId, StoredDocument>>
fn get_stored_many( &self, ids: &[DocId], ) -> StorageBackendResult<BTreeMap<DocId, StoredDocument>>
DocumentStore::get_stored.Source§fn get_stored_many_controlled(
&self,
ids: &[DocId],
control: &StorageReadControl,
) -> StorageBackendResult<RetainedDocumentPage>
fn get_stored_many_controlled( &self, ids: &[DocId], control: &StorageReadControl, ) -> StorageBackendResult<RetainedDocumentPage>
Source§fn get_metadata(
&self,
id: DocId,
) -> StorageBackendResult<Option<DocumentMetadata>>
fn get_metadata( &self, id: DocId, ) -> StorageBackendResult<Option<DocumentMetadata>>
Source§fn with_field_ref_controlled(
&self,
id: DocId,
field: &str,
control: &StorageReadControl,
visitor: &mut dyn FnMut(Option<&Value>) -> StorageBackendResult<()>,
) -> StorageBackendResult<()>
fn with_field_ref_controlled( &self, id: DocId, field: &str, control: &StorageReadControl, visitor: &mut dyn FnMut(Option<&Value>) -> StorageBackendResult<()>, ) -> StorageBackendResult<()>
Source§fn field_presence_controlled(
&self,
ids: &[DocId],
fields: &[&str],
control: &StorageReadControl,
) -> StorageBackendResult<BudgetedVec<bool>>
fn field_presence_controlled( &self, ids: &[DocId], fields: &[&str], control: &StorageReadControl, ) -> StorageBackendResult<BudgetedVec<bool>>
fn contains_doc_id(&self, id: DocId) -> StorageBackendResult<bool>
Source§fn get_field(
&self,
id: DocId,
field: &str,
) -> StorageBackendResult<Option<Value>>
fn get_field( &self, id: DocId, field: &str, ) -> StorageBackendResult<Option<Value>>
Value so persistent
backends (SQLite, …) can decode on demand without reaching
for a reference into a transient row.Source§fn get_fields_multi(
&self,
ids: &[DocId],
fields: &[&str],
) -> StorageBackendResult<BTreeMap<DocId, Vec<Value>>>
fn get_fields_multi( &self, ids: &[DocId], fields: &[&str], ) -> StorageBackendResult<BTreeMap<DocId, Vec<Value>>>
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_ref_with_presence(
&self,
ids: &[DocId],
fields: &[&str],
visitor: &mut dyn FnMut(DocId, bool, &[&Value]) -> bool,
) -> StorageBackendResult<()>
fn for_each_fields_multi_ref_with_presence( &self, ids: &[DocId], fields: &[&str], visitor: &mut dyn FnMut(DocId, bool, &[&Value]) -> bool, ) -> StorageBackendResult<()>
contains_doc_id probe when a
caller must distinguish a missing document from an existing document
whose requested fields are all NULL.Source§fn for_each_fields_multi_ref(
&self,
ids: &[DocId],
fields: &[&str],
visitor: &mut dyn FnMut(DocId, &[&Value]) -> bool,
) -> StorageBackendResult<()>
fn for_each_fields_multi_ref( &self, ids: &[DocId], fields: &[&str], visitor: &mut dyn FnMut(DocId, &[&Value]) -> bool, ) -> StorageBackendResult<()>
Source§fn for_each_fields_multi(
&self,
ids: &[DocId],
fields: &[&str],
visitor: &mut dyn FnMut(DocId, Vec<Value>) -> bool,
) -> StorageBackendResult<()>
fn for_each_fields_multi( &self, ids: &[DocId], fields: &[&str], visitor: &mut dyn FnMut(DocId, Vec<Value>) -> bool, ) -> StorageBackendResult<()>
false stops the visit early. Missing documents yield
a row of NULLs, matching row-evaluator semantics.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.fn doc_ids(&self) -> StorageBackendResult<Vec<DocId>>
Source§fn next_doc_ids(
&self,
after: Option<DocId>,
limit: usize,
) -> StorageBackendResult<Vec<DocId>>
fn next_doc_ids( &self, after: Option<DocId>, limit: usize, ) -> StorageBackendResult<Vec<DocId>>
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_doc_ids_controlled(
&self,
after: Option<DocId>,
limit: usize,
control: &StorageReadControl,
) -> StorageBackendResult<BudgetedVec<DocId>>
fn next_doc_ids_controlled( &self, after: Option<DocId>, limit: usize, control: &StorageReadControl, ) -> StorageBackendResult<BudgetedVec<DocId>>
limit identities in strictly ascending order after after, retaining the supplied allowance with the output. Implementations reserve producer scratch and output before allocation, preserve this store’s selected view, and never read document payloads. The default rejects unsupported providers without calling an unbounded owned cursor; empty requests still honor cancellation. Controlled consumers use read_document_ids to validate the returned page and its allowance.fn len(&self) -> StorageBackendResult<usize>
Source§fn snapshot(&self) -> StorageBackendResult<Arc<dyn DocumentStore>>
fn snapshot(&self) -> StorageBackendResult<Arc<dyn DocumentStore>>
ExecutionContext. Persistent
backends share their connection; memory backends deep-clone so the
snapshot is isolated from later mutations.Source§fn put_stored_unused(
&mut self,
doc_id: u64,
document: StoredDocument,
namespace: DocumentIdNamespace,
) -> Result<(), StorageBackendError>
fn put_stored_unused( &mut self, doc_id: u64, document: StoredDocument, namespace: DocumentIdNamespace, ) -> Result<(), StorageBackendError>
namespace. A provider that keys its records by that namespace may write them without reading what they would replace, and only while it stores the table under that namespace; a record that exists after all fails the commit. The default replaces as put_stored does.fn get( &self, doc_id: u64, ) -> Result<Option<BTreeMap<String, Value>>, StorageBackendError>
Source§fn find_doc_id_by_field(
&self,
field: &str,
value: &Value,
) -> Result<Option<u64>, StorageBackendError>
fn find_doc_id_by_field( &self, field: &str, value: &Value, ) -> Result<Option<u64>, StorageBackendError>
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 get_many(
&self,
doc_ids: &[u64],
) -> Result<BTreeMap<u64, BTreeMap<String, Value>>, StorageBackendError>
fn get_many( &self, doc_ids: &[u64], ) -> Result<BTreeMap<u64, BTreeMap<String, Value>>, StorageBackendError>
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: &[u64],
field: &str,
) -> Result<BTreeMap<u64, Value>, StorageBackendError>
fn get_fields_bulk( &self, doc_ids: &[u64], field: &str, ) -> Result<BTreeMap<u64, Value>, StorageBackendError>
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,
) -> Result<bool, StorageBackendError>
fn has_value( &self, field: &str, value: &Value, ) -> Result<bool, StorageBackendError>
true if any document has field == value.Source§fn find_doc_id_by_fields(
&self,
fields: &[String],
values: &[Value],
) -> Result<Option<u64>, StorageBackendError>
fn find_doc_id_by_fields( &self, fields: &[String], values: &[Value], ) -> Result<Option<u64>, StorageBackendError>
Source§fn eval_path(
&self,
doc_id: u64,
path: &[PathSegment],
) -> Result<Option<Value>, StorageBackendError>
fn eval_path( &self, doc_id: u64, path: &[PathSegment], ) -> Result<Option<Value>, StorageBackendError>
Source§fn next_doc_id(
&self,
after: Option<u64>,
) -> Result<Option<u64>, StorageBackendError>
fn next_doc_id( &self, after: Option<u64>, ) -> Result<Option<u64>, StorageBackendError>
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.None lets persistent backends use the ordinary id + projection path.next_shared_fields directly from stable decoded memory, without acquiring ownership for each row. This opt-in path must have no fallible provider reads, decoding, or effects that ordinary shared-page construction would perform before the visitor. The visitor must not reenter storage or invoke host callbacks; false stops before the next row. Support is stable for this read owner: an eligible provider returns Some(0) for a zero limit; None always declines without calling the visitor.Source§fn for_each_next_fields(
&self,
_after: Option<u64>,
_limit: usize,
_fields: &[&str],
_visitor: &mut dyn FnMut(u64, &[&Value]) -> bool,
) -> Result<Option<usize>, StorageBackendError>
fn for_each_next_fields( &self, _after: Option<u64>, _limit: usize, _fields: &[&str], _visitor: &mut dyn FnMut(u64, &[&Value]) -> bool, ) -> Result<Option<usize>, StorageBackendError>
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 for_each_next_fields_borrowed(
&self,
after: Option<u64>,
limit: usize,
fields: &[&str],
visitor: &mut dyn FnMut(u64, &[&Value]) -> bool,
) -> Result<Option<usize>, StorageBackendError>
fn for_each_next_fields_borrowed( &self, after: Option<u64>, limit: usize, fields: &[&str], visitor: &mut dyn FnMut(u64, &[&Value]) -> bool, ) -> Result<Option<usize>, StorageBackendError>
visitor. Missing fields are SQL NULL; stopping the visitor must not decode later rows. None must leave the visitor uncalled. Providers without a physical borrow reuse their ordinary projected cursor.Source§fn for_each_fields_multi_borrowed(
&self,
_ids: &[u64],
_fields: &[&str],
_visitor: &mut dyn FnMut(u64, bool, &[&Value]) -> bool,
) -> Result<Option<usize>, StorageBackendError>
fn for_each_fields_multi_borrowed( &self, _ids: &[u64], _fields: &[&str], _visitor: &mut dyn FnMut(u64, bool, &[&Value]) -> bool, ) -> Result<Option<usize>, StorageBackendError>
Some(count) counts callbacks; None must leave the visitor uncalled and selects the ordinary projection path.fn max_doc_id(&self) -> Result<u64, StorageBackendError>
fn is_empty(&self) -> Result<bool, StorageBackendError>
Source§fn iter_all(
&self,
) -> Result<Box<dyn Iterator<Item = (u64, BTreeMap<String, Value>)> + '_>, StorageBackendError>
fn iter_all( &self, ) -> Result<Box<dyn Iterator<Item = (u64, BTreeMap<String, Value>)> + '_>, StorageBackendError>
(doc_id, document) pairs in id order. The default
implementation fetches each document individually; SQLite-backed
stores override with a single query.Source§fn retained_snapshot(
&self,
) -> Result<Option<Arc<dyn DocumentStore>>, StorageBackendError>
fn retained_snapshot( &self, ) -> Result<Option<Arc<dyn DocumentStore>>, StorageBackendError>
snapshot method, whose persistent implementations may share a mutable connection.Source§fn writable_snapshot(
&self,
) -> Result<Box<dyn DocumentStore>, StorageBackendError>
fn writable_snapshot( &self, ) -> Result<Box<dyn DocumentStore>, StorageBackendError>
Source§impl ExactLookupOverlay for DocumentChanges
impl ExactLookupOverlay for DocumentChanges
fn is_empty(&self) -> Result<bool, SQLError>
fn masks(&self, id: DocId) -> Result<bool, SQLError>
fn find_match( &self, columns: &[String], values: &[Value], presence: FieldPresence, ) -> Result<Option<DocId>, SQLError>
fn find_match_with_catalog( &self, columns: &[String], values: &[Value], presence: FieldPresence, catalog: Option<&dyn SQLValueCatalog>, ) -> Result<Option<DocId>, SQLError>
Auto Trait Implementations§
impl !RefUnwindSafe for DocumentChanges
impl !UnwindSafe for DocumentChanges
impl Freeze for DocumentChanges
impl Send for DocumentChanges
impl Sync for DocumentChanges
impl Unpin for DocumentChanges
impl UnsafeUnpin for DocumentChanges
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more