Skip to main content

RuntimeCatalogData

Struct RuntimeCatalogData 

Source
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

Source

pub fn new() -> Self

Creates an empty catalog.

Source

pub fn entry_count(&self) -> usize

Number of retained catalog entries.

Source

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.

Source

pub fn retained_identifier_bytes(&self) -> usize

Exact UTF-8 bytes retained by entry names and property owners.

Source

pub fn intern_label_at( &mut self, name: &str, now: i64, ) -> Result<RuntimeEntityId, GfError>

Interns an entity label at a caller-authoritative timestamp.

Source

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.

Source

pub fn intern_relation_type_at( &mut self, name: &str, now: i64, ) -> Result<RuntimeRelationId, GfError>

Interns a relation type at a caller-authoritative timestamp.

Source

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.

Source

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.

Source

pub fn contains_entity_type(&self, name: &str) -> bool

Returns true if name has been interned as an entity type.

Source

pub fn contains_relation_type(&self, name: &str) -> bool

Returns true if name has been interned as a relation type.

Source

pub fn contains_property(&self, name: &str, owner_label: Option<&str>) -> bool

Returns true if the owner-scoped property has been interned.

Source

pub fn entity_types(&self) -> Vec<&str>

Returns all interned entity type names (order unspecified).

Source

pub fn relation_types(&self) -> Vec<&str>

Returns all interned relation type names (order unspecified).

Source

pub fn properties_for(&self, label: &str) -> Vec<&str>

Returns all property names observed on label (order unspecified).

Source

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.

Source

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.

Source

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).

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for RuntimeCatalogData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuntimeCatalogData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RuntimeCatalogData

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.