pub struct Db { /* private fields */ }Expand description
An immutable value of a database at one basis transaction and time view.
Implementations§
Source§impl Db
impl Db
Sourcepub fn with_naming(self, idents: Idents, interner: KeywordInterner) -> Self
pub fn with_naming(self, idents: Idents, interner: KeywordInterner) -> Self
Attaches ident and keyword naming registries, returning the named value.
Sourcepub fn interner(&self) -> &KeywordInterner
pub fn interner(&self) -> &KeywordInterner
Keyword interner used by keyword values in this database.
Sourcepub fn recorded_datoms(&self) -> &[Datom]
pub fn recorded_datoms(&self) -> &[Datom]
Every recorded assertion and retraction, in transaction order.
Sourcepub fn as_of(&self, t: u64) -> Self
pub fn as_of(&self, t: u64) -> Self
Returns the as-of view at basis t: facts as they stood then.
Sourcepub fn tx_range(&self, start: u64, end: Option<u64>) -> Vec<(u64, Vec<Datom>)>
pub fn tx_range(&self, start: u64, end: Option<u64>) -> Vec<(u64, Vec<Datom>)>
Groups recorded datoms by transaction over the half-open range [start, end).
Sourcepub fn datoms(&self) -> Vec<Datom>
pub fn datoms(&self) -> Vec<Datom>
Returns this view’s facts, deterministically ordered by EAVT.
Sourcepub fn datoms_at(&self, order: IndexOrder) -> impl Iterator<Item = &Datom>
pub fn datoms_at(&self, order: IndexOrder) -> impl Iterator<Item = &Datom>
Iterates this view’s datoms in one index order.
AVET covers only indexed/unique attributes and VAET only reference values, mirroring Datomic’s covering-index composition.
Sourcepub fn datoms_prefix<'a>(
&'a self,
order: IndexOrder,
prefix: &'a [u8],
) -> impl Iterator<Item = &'a Datom>
pub fn datoms_prefix<'a>( &'a self, order: IndexOrder, prefix: &'a [u8], ) -> impl Iterator<Item = &'a Datom>
Iterates datoms whose key in order starts with prefix.
Sourcepub fn seek_datoms<'a>(
&'a self,
order: IndexOrder,
start: &[u8],
) -> impl Iterator<Item = &'a Datom>
pub fn seek_datoms<'a>( &'a self, order: IndexOrder, start: &[u8], ) -> impl Iterator<Item = &'a Datom>
Iterates datoms in order starting from the first key at or after start.
Sourcepub fn index_range<'a>(
&'a self,
a: AttrId,
start: Option<&Value>,
end: Option<&'a Value>,
) -> impl Iterator<Item = &'a Datom>
pub fn index_range<'a>( &'a self, a: AttrId, start: Option<&Value>, end: Option<&'a Value>, ) -> impl Iterator<Item = &'a Datom>
Iterates the AVET index for a over the value range [start, end).
Only indexed/unique attributes appear in AVET.
Sourcepub fn values(&self, e: EntityId, a: AttrId) -> Vec<Value>
pub fn values(&self, e: EntityId, a: AttrId) -> Vec<Value>
Current values for an entity/attribute pair.
Sourcepub fn lookup(&self, a: AttrId, v: &Value) -> Option<EntityId>
pub fn lookup(&self, a: AttrId, v: &Value) -> Option<EntityId>
Resolves a unique attribute/value pair to its entity.
Sourcepub fn with_transaction(&self, t: u64, datoms: &[Datom]) -> Self
pub fn with_transaction(&self, t: u64, datoms: &[Datom]) -> Self
Applies a committed record, returning a new database value.
Only meaningful for the current view; time views are read-only.
Sourcepub fn planner_stats(&self) -> &PlannerStats
pub fn planner_stats(&self) -> &PlannerStats
Planner statistics for this view, built lazily and cached.