pub struct ReadTxn<'db> { /* private fields */ }Expand description
Public read transaction. Acquired by
crate::Db::read_transaction.
Carries only the obj-core read-side handle — the writer’s live
Catalog is NOT held by a ReadTxn because reads consult the
snapshot-pinned catalog root via
obj_core::Catalog::lookup_via_snapshot (M6 #53), not the
live Catalog.tree.root.
M11 #93: a ReadTxn MAY also carry one AttachedReadCtx per
attached database registered on the calling crate::Db. The
per-attached snapshots are pinned at txn-begin time and released
when the ReadTxn drops; reads against <namespace>.<collection>
route through them.
Implementations§
Source§impl<'db> ReadTxn<'db>
impl<'db> ReadTxn<'db>
Sourcepub fn collection<T: Document>(&self) -> Result<Collection<'_, T>>
pub fn collection<T: Document>(&self) -> Result<Collection<'_, T>>
Open a typed handle to the collection T lives in.
Read-only: returns Error::CollectionNotFound if the
collection has never been registered AT THE SNAPSHOT’S
PINNED LSN.
If T::COLLECTION is of the form <namespace>.<name>, the
txn dispatches against the attached database registered under
<namespace> instead of the calling Db.
§Errors
Error::CollectionNotFoundifT::COLLECTIONis not registered in the catalog as-of the snapshot’s pinned LSN.Error::CollectionNamespaceUnknownifT::COLLECTIONcarries a namespace prefix that is not attached.Error::Busyif the pager / catalog mutex is poisoned.