pub struct ReadTransaction { /* private fields */ }Expand description
Read transaction over a pinned snapshot.
A read transaction owns its own Arc<Snapshot> and never borrows the
Database, so it stays valid across a later begin_write/checkpoint on
the same handle (it cloned the snapshot before the write borrowed &mut). It
is Send + Sync (asserted below).
§Performance
Creating and cloning a read transaction is O(1): it shares the pinned
snapshot through an Arc, not by copying.
Implementations§
Source§impl ReadTransaction
impl ReadTransaction
Sourcepub fn element_count(&self) -> usize
pub fn element_count(&self) -> usize
Sourcepub fn relation_count(&self) -> usize
pub fn relation_count(&self) -> usize
Sourcepub fn incidence_count(&self) -> usize
pub fn incidence_count(&self) -> usize
Sourcepub fn element_ids(&self) -> Vec<ElementId>
pub fn element_ids(&self) -> Vec<ElementId>
Sourcepub fn relation_ids(&self) -> Vec<RelationId>
pub fn relation_ids(&self) -> Vec<RelationId>
Sourcepub fn contains_element(&self, id: ElementId) -> bool
pub fn contains_element(&self, id: ElementId) -> bool
Sourcepub fn contains_relation(&self, id: RelationId) -> bool
pub fn contains_relation(&self, id: RelationId) -> bool
Sourcepub fn contains_incidence(&self, id: IncidenceId) -> bool
pub fn contains_incidence(&self, id: IncidenceId) -> bool
Sourcepub fn element(&self, id: ElementId) -> Option<Cow<'_, ElementRecord>>
pub fn element(&self, id: ElementId) -> Option<Cow<'_, ElementRecord>>
Returns an element record, borrowed from the base for a base-only id and owned for an overlay-supplied id.
§Performance
This method is O(log change + log n).
Sourcepub fn relation(&self, id: RelationId) -> Option<Cow<'_, RelationRecord>>
pub fn relation(&self, id: RelationId) -> Option<Cow<'_, RelationRecord>>
Returns a relation record (see Self::element for the borrow contract).
§Performance
This method is O(log change + log n).
Sourcepub fn incidence(&self, id: IncidenceId) -> Option<Cow<'_, IncidenceRecord>>
pub fn incidence(&self, id: IncidenceId) -> Option<Cow<'_, IncidenceRecord>>
Returns an incidence record (see Self::element for the borrow
contract).
§Performance
This method is O(log change + log n).
Sourcepub fn element_incidences(&self, id: ElementId) -> Vec<IncidenceRecord>
pub fn element_incidences(&self, id: ElementId) -> Vec<IncidenceRecord>
Returns every visible incidence attached to an element, in ascending incidence-id order.
The merged set mixes overlay-owned and base-borrowed records, so this
returns an owned Vec (IncidenceRecord is Copy, so the copy is
cheap).
§Performance
This method is O(base incidences + overlay incidence change).
Sourcepub fn property(
&self,
subject: PropertySubject,
key: PropertyKeyId,
) -> Option<Cow<'_, PropertyValue>>
pub fn property( &self, subject: PropertySubject, key: PropertyKeyId, ) -> Option<Cow<'_, PropertyValue>>
Returns one property value (see Self::element for the borrow
contract).
§Performance
This method is O(log subjects + log keys).
Sourcepub fn lookup_property_equal(
&self,
key: PropertyKeyId,
value: &PropertyValue,
) -> Result<Vec<PropertySubject>, DbError>
pub fn lookup_property_equal( &self, key: PropertyKeyId, value: &PropertyValue, ) -> Result<Vec<PropertySubject>, DbError>
Sourcepub fn lookup_property_range(
&self,
key: PropertyKeyId,
min: &PropertyValue,
max: &PropertyValue,
) -> Result<Vec<PropertySubject>, DbError>
pub fn lookup_property_range( &self, key: PropertyKeyId, min: &PropertyValue, max: &PropertyValue, ) -> Result<Vec<PropertySubject>, DbError>
Sourcepub fn lookup_index(
&self,
index: IndexId,
lookup: IndexLookup<'_>,
) -> Result<Vec<PropertySubject>, DbError>
pub fn lookup_index( &self, index: IndexId, lookup: IndexLookup<'_>, ) -> Result<Vec<PropertySubject>, DbError>
Sourcepub fn graph_projection(
&self,
id: ProjectionId,
) -> Result<GraphProjection, DbError>
pub fn graph_projection( &self, id: ProjectionId, ) -> Result<GraphProjection, DbError>
Sourcepub fn graph_projection_by_name(
&self,
name: &str,
) -> Result<GraphProjection, DbError>
pub fn graph_projection_by_name( &self, name: &str, ) -> Result<GraphProjection, DbError>
Sourcepub fn traverse_graph(
&self,
projection: ProjectionId,
seeds: &[ElementId],
options: TraversalOptions,
) -> Result<TraversalResult, DbError>
pub fn traverse_graph( &self, projection: ProjectionId, seeds: &[ElementId], options: TraversalOptions, ) -> Result<TraversalResult, DbError>
Traverses a cataloged graph projection from canonical seed elements.
Rows are unique canonical elements in BFS first-discovery order. Depth is the shortest discovered hop count from any seed.
§Errors
Returns DbError when the projection is unknown, is not a graph,
cannot be materialized, or a seed element is not part of the projection.
§Performance
This method is O(relation count * incidence count + visited edges).