Skip to main content

GraphLabelRegistry

Struct GraphLabelRegistry 

Source
pub struct GraphLabelRegistry {
    pub labels: BTreeMap<String, u32>,
    pub kinds: BTreeMap<String, LabelKind>,
    pub sequences: BTreeMap<u32, u64>,
    pub dropped_label_ids: BTreeSet<u32>,
    pub next_label_id: u32,
}
Expand description

Per-graph AGE label registry: label name -> label id plus the per-label id sequences. Serializable so engines can persist it in catalog metadata and restore deterministic id allocation.

Fields§

§labels: BTreeMap<String, u32>

Label name -> AGE label id. Vertex and edge labels share the namespace-wide counter; the reserved names for ids 1 / 2 are not stored here (empty labels map onto them implicitly).

§kinds: BTreeMap<String, LabelKind>

Label name -> vertex or edge kind. Registries persisted before kinds were recorded fill this map from the stored entities.

§sequences: BTreeMap<u32, u64>

Label id -> last allocated per-label sequence value.

§dropped_label_ids: BTreeSet<u32>

AGE label ids whose relations were removed through drop_label. Tombstones are persisted because edge rows can outlive the vertex label relations that owned their endpoints. Registries written before this field existed deserialize as an empty set.

§next_label_id: u32

Next label id handed to a previously unseen label.

Implementations§

Source§

impl GraphLabelRegistry

Source

pub fn contains_label(&self, label: &str) -> bool

Whether label names a registered user label or a reserved default label.

Source

pub fn label_kind(&self, label: &str) -> Option<LabelKind>

The kind of a registered or default label. A user label persisted before kinds were recorded, and whose entities are all gone, reports as a vertex label until its next use records the kind.

Source

pub fn register_label( &mut self, label: &str, kind: LabelKind, ) -> GraphStoreResult<Option<u32>>

Register an empty user label ahead of any entity, as create_vlabel / create_elabel do. Returns the new label id; None when the name is already a label of this graph.

Source

pub fn remove_label(&mut self, label: &str) -> Option<u32>

Forget a label. Default labels leave a durable tombstone so the graph can continue to exist without their AGE relations. Returns the released label id, or None when the label is not registered.

Source

pub fn labels(&self) -> Vec<GraphLabelInfo>

Every present label of the graph in ag_label order: surviving defaults first, then user labels by ascending label id.

Source

pub fn merge(&mut self, other: &GraphLabelRegistry)

Merge another registry (e.g. persisted metadata) into this one, keeping the larger sequence values and label id watermark.

Trait Implementations§

Source§

impl Clone for GraphLabelRegistry

Source§

fn clone(&self) -> GraphLabelRegistry

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 GraphLabelRegistry

Source§

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

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

impl Default for GraphLabelRegistry

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for GraphLabelRegistry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for GraphLabelRegistry

Source§

impl PartialEq for GraphLabelRegistry

Source§

fn eq(&self, other: &GraphLabelRegistry) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for GraphLabelRegistry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for GraphLabelRegistry

Auto Trait Implementations§

Blanket Implementations§

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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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