pub struct RuntimeCatalogData { /* private fields */ }Expand description
Checked runtime catalog carrier and its encoding-preserving Arrow codec.
The caller chooses observation timestamps and whether a name may be interned. Entries preserve their stable local identity and insertion order across batches.
Implementations§
Source§impl RuntimeCatalogData
impl RuntimeCatalogData
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Number of retained catalog entries.
Sourcepub fn latest_observation_micros(&self) -> Option<i64>
pub fn latest_observation_micros(&self) -> Option<i64>
Latest retained observation across all entry kinds, in UTC microseconds.
Returns None only for an empty catalog; pre-epoch values are preserved.
Sourcepub fn retained_identifier_bytes(&self) -> usize
pub fn retained_identifier_bytes(&self) -> usize
Exact UTF-8 bytes retained by entry names and property owners.
Sourcepub fn intern_label_at(
&mut self,
name: &str,
now: i64,
) -> Result<RuntimeEntityId, GfError>
pub fn intern_label_at( &mut self, name: &str, now: i64, ) -> Result<RuntimeEntityId, GfError>
Interns an entity label at a caller-authoritative timestamp.
Sourcepub fn intern_label_observed_at(
&mut self,
name: &str,
now: i64,
observations: u64,
) -> Result<RuntimeEntityId, GfError>
pub fn intern_label_observed_at( &mut self, name: &str, now: i64, observations: u64, ) -> Result<RuntimeEntityId, GfError>
Interns an entity label and records observations sightings of it at
once: the catalog observation_count an equal number of single
Self::intern_label_at calls would leave. observations is at least one.
Sourcepub fn intern_relation_type_at(
&mut self,
name: &str,
now: i64,
) -> Result<RuntimeRelationId, GfError>
pub fn intern_relation_type_at( &mut self, name: &str, now: i64, ) -> Result<RuntimeRelationId, GfError>
Interns a relation type at a caller-authoritative timestamp.
Sourcepub fn intern_relation_type_observed_at(
&mut self,
name: &str,
now: i64,
observations: u64,
) -> Result<RuntimeRelationId, GfError>
pub fn intern_relation_type_observed_at( &mut self, name: &str, now: i64, observations: u64, ) -> Result<RuntimeRelationId, GfError>
Interns a relation type and records observations sightings of it at
once, as an equal number of Self::intern_relation_type_at calls would.
Sourcepub fn intern_property_at(
&mut self,
name: &str,
owner_label: Option<&str>,
now: i64,
) -> Result<RuntimePropId, GfError>
pub fn intern_property_at( &mut self, name: &str, owner_label: Option<&str>, now: i64, ) -> Result<RuntimePropId, GfError>
Interns a property at a caller-authoritative timestamp.
Sourcepub fn contains_entity_type(&self, name: &str) -> bool
pub fn contains_entity_type(&self, name: &str) -> bool
Returns true if name has been interned as an entity type.
Sourcepub fn contains_relation_type(&self, name: &str) -> bool
pub fn contains_relation_type(&self, name: &str) -> bool
Returns true if name has been interned as a relation type.
Sourcepub fn contains_property(&self, name: &str, owner_label: Option<&str>) -> bool
pub fn contains_property(&self, name: &str, owner_label: Option<&str>) -> bool
Returns true if the owner-scoped property has been interned.
Sourcepub fn entity_types(&self) -> Vec<&str>
pub fn entity_types(&self) -> Vec<&str>
Returns all interned entity type names (order unspecified).
Sourcepub fn relation_types(&self) -> Vec<&str>
pub fn relation_types(&self) -> Vec<&str>
Returns all interned relation type names (order unspecified).
Sourcepub fn properties_for(&self, label: &str) -> Vec<&str>
pub fn properties_for(&self, label: &str) -> Vec<&str>
Returns all property names observed on label (order unspecified).
Sourcepub fn property_name(&self, id: RuntimePropId) -> Option<&str>
pub fn property_name(&self, id: RuntimePropId) -> Option<&str>
Resolves a RuntimePropId back to the property name it was interned
under, or None if no property entry carries that ID.
Used by the relational lowering layer to turn a numeric PropertyAccess
ID back into the real column name when reading exploratory property
tables.
Sourcepub fn property_names(&self) -> impl Iterator<Item = (RuntimePropId, &str)> + '_
pub fn property_names(&self) -> impl Iterator<Item = (RuntimePropId, &str)> + '_
Returns (RuntimePropId, name) for every interned property (order
unspecified). Convenient for building a PropId → name map in one pass.
Sourcepub fn relation_type_name(&self, id: RuntimeRelationId) -> Option<&str>
pub fn relation_type_name(&self, id: RuntimeRelationId) -> Option<&str>
Resolves a relation-type RuntimeRelationId back to the name it was
interned under, or None if no relation-type entry carries that ID.
Used by the relational lowering layer to resolve a TypedEdgeScan’s
relation name when reading exploratory edge tables (no ontology present).
Sourcepub fn relation_type_names_with_ids(
&self,
) -> impl Iterator<Item = (RuntimeRelationId, &str)> + '_
pub fn relation_type_names_with_ids( &self, ) -> impl Iterator<Item = (RuntimeRelationId, &str)> + '_
Returns (RuntimeRelationId, name) for every interned relation type (order
unspecified). Convenient for building a TypeId → relation-name map.
Sourcepub fn entity_type_name(&self, id: RuntimeEntityId) -> Option<&str>
pub fn entity_type_name(&self, id: RuntimeEntityId) -> Option<&str>
Resolves an entity-type (node label) RuntimeEntityId back to the name
it was interned under, or None if no entity-type entry carries that ID.
Mirror of relation_type_name for labels —
used to render a real label name for an unlabelled MATCH (n) RETURN n
in exploratory mode, where the ontology map is empty (#889).
Sourcepub fn entity_type_names_with_ids(
&self,
) -> impl Iterator<Item = (RuntimeEntityId, &str)> + '_
pub fn entity_type_names_with_ids( &self, ) -> impl Iterator<Item = (RuntimeEntityId, &str)> + '_
Returns (RuntimeEntityId, name) for every interned entity type (node
label), order unspecified. Convenient for building a
TypeId → label-name map.
Sourcepub fn to_record_batch(&self) -> RecordBatch
pub fn to_record_batch(&self) -> RecordBatch
Serialises the catalog to an Arrow RecordBatch using RUNTIME_CATALOG_SCHEMA.
The resulting batch can be written to topology/runtime_catalog.parquet
and later restored via from_record_batch.
Sourcepub fn from_record_batch(batch: &RecordBatch) -> Result<Self, GfError>
pub fn from_record_batch(batch: &RecordBatch) -> Result<Self, GfError>
Restores a RuntimeCatalogData from an Arrow RecordBatch previously
produced by to_record_batch.
§Errors
Returns GfError::Storage if any column has the wrong type or an
unknown entry_kind value is encountered.
Sourcepub fn from_record_batches<'a>(
batches: impl IntoIterator<Item = &'a RecordBatch>,
) -> Result<Self, GfError>
pub fn from_record_batches<'a>( batches: impl IntoIterator<Item = &'a RecordBatch>, ) -> Result<Self, GfError>
Restores a catalog from a bounded stream of persisted Arrow batches without concatenating or retaining those batches.
Sourcepub fn extend_from_record_batch(
&mut self,
batch: &RecordBatch,
) -> Result<(), GfError>
pub fn extend_from_record_batch( &mut self, batch: &RecordBatch, ) -> Result<(), GfError>
Appends one persisted catalog batch while preserving its stable IDs and observations. The caller may therefore decode a Parquet catalog in bounded windows rather than concatenating it in memory.