Skip to main content

MetadataStore

Struct MetadataStore 

Source
pub struct MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Key, N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,
{ /* private fields */ }
Expand description

Metadata store that holds metadata for externally defined objects.

Implementations§

Source§

impl<ObjKey, N, K, L, W, WV, A, AV> MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Key, N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Source

pub fn builder() -> MetadataStoreBuilder<ObjKey, N, K, L, W, WV, A, AV>

Create an instance of MetadataStore using the builder syntax

Source§

impl<ObjKey, N, K, L, W, WV, A, AV> MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Key, N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Source

pub fn new() -> Self

Create a new metadata store.

Source

pub fn len(&self) -> usize

The number of objects in store.

Source

pub fn is_empty(&self) -> bool

Whether this store is empty.

Source

pub fn add(&mut self) -> (ObjKey, Uuid)

Add an object to the store by registering an ID for it. Returns the internally used key as well as the ID itself.

Source

pub fn intern_id(&mut self, id: Cow<'_, Uuid>) -> ObjKey

Add a specific ID to the store.

Source

pub fn try_insert( &mut self, meta: Metadata<N, K, L, W, WV, A, AV>, ) -> Result<ObjKey, Error>

Try to insert a metadata object, returns an error if the ID already exists.

Source

pub fn insert(&mut self, meta: Metadata<N, K, L, W, WV, A, AV>) -> ObjKey

Insert a metadata object. Overrides any existing metadata.

Source

pub fn try_apply<Id: AsRef<Uuid>>( &mut self, id: Id, tx: Transaction<N, K, L, W, WV, A, AV>, ) -> Result<(), Error>

Apply a transaction to an object using named metadata fields. Raises an error if the ID does not exist and when the new ID as supplied in the transaction already exists for another object.

Source

pub fn apply(&mut self, obj: ObjKey, tx: Transaction<N, K, L, W, WV, A, AV>)

Apply a transaction to an object using named metadata fields. Assumes any potential ID update is valid.

Source

pub fn try_apply_keyed( &mut self, obj: ObjKey, tx: Transaction<NameKey, KindKey, LabelKey, WeightKey, WV, AnnotationKey, AV>, ) -> Result<(), Error>

Apply a transaction to an object based on internal keys representing metadata fields. Raises an error if a potential new ID as supplied in the transaction already exists for another object.

Source

pub fn apply_keyed( &mut self, obj: ObjKey, tx: Transaction<NameKey, KindKey, LabelKey, WeightKey, WV, AnnotationKey, AV>, )

Apply a transaction to an object based on internal keys representing metadata field. Assumes any potential ID update is valid.

Source

pub fn intern_name(&mut self, name: Cow<'_, N>) -> NameKey

Intern a name. Returns the internally used key for that name.

Source

pub fn forget_name(&mut self, name: &N) -> Option<NameKey>

Forget a name entirely. Removes it from any object it was attached to.

Source

pub fn forget_name_key(&mut self, name: NameKey) -> Option<N>

Forget a name entirely (by key). Removes it from any object it was attached to.

Source

pub fn set_object_name<Id: AsRef<Uuid>>(&mut self, id: Id, name: &N)

Apply a name to an object.

Source

pub fn set_object_name_key(&mut self, obj: ObjKey, name: NameKey)

Apply a name to an object using internally used keys.

Source

pub fn remove_object_name<Id: AsRef<Uuid>>(&mut self, id: Id) -> Option<&N>

Strip an objects name value.

Source

pub fn remove_object_name_key(&mut self, obj: ObjKey) -> Option<NameKey>

Strip an objects name value by means of the internally used keys.

Source

pub fn intern_kind(&mut self, kind: Cow<'_, K>) -> KindKey

Intern a kind. Returns the internally used key for that kind.

Source

pub fn forget_kind(&mut self, kind: &K) -> Option<KindKey>

Forget a kind entirely. Removes it from any object it was attached to.

Source

pub fn forget_kind_key(&mut self, kind: KindKey) -> Option<K>

Forget a kind entirely (by key). Removes it from any object it was attached to.

Source

pub fn set_object_kind<Id: AsRef<Uuid>>(&mut self, id: Id, kind: &K)

Apply a kind to an object.

Source

pub fn set_object_kind_key(&mut self, obj: ObjKey, kind: KindKey)

Apply a kind to an object using internally used keys.

Source

pub fn remove_object_kind<Id: AsRef<Uuid>>(&mut self, id: Id) -> Option<&K>

Strip an object’s kind value.

Source

pub fn remove_object_kind_key(&mut self, obj: ObjKey) -> Option<KindKey>

Strip an object’s kind value by means of the internally used keys.

Source

pub fn intern_label(&mut self, label: Cow<'_, L>) -> LabelKey

Intern a label. Returns the internally used key for that label.

Source

pub fn forget_label(&mut self, label: &L) -> Option<LabelKey>

Forget a label entirely. Removes it from any object it was attached to.

Source

pub fn forget_label_key(&mut self, label: LabelKey) -> Option<L>

Forget a label entirely (by key). Removes it from any object it was attached to.

Source

pub fn set_object_label<Id: AsRef<Uuid>>(&mut self, id: Id, label: &L)

Apply a label to an object.

Source

pub fn set_object_label_key(&mut self, obj: ObjKey, label: LabelKey)

Apply a label to an object by using internally used keys.

Source

pub fn remove_object_label<Id: AsRef<Uuid>>(&mut self, id: Id, label: &L)

Strip a label from an object.

Source

pub fn strip_label_key(&mut self, obj: ObjKey, label: LabelKey)

Strip a label from an object by using internally used keys.

Source

pub fn intern_weight(&mut self, weight: Cow<'_, W>) -> WeightKey

Intern a weight. Returns the internally used key.

Source

pub fn forget_weight(&mut self, weight: &W) -> Option<WeightKey>

Forget a weight field entirely. Removes it from any object it was attached to. Returns forgotten object-value pairs.

Source

pub fn forget_weight_key(&mut self, weight: WeightKey) -> Option<W>

Forget a weight field entirely (by key). Removes it from any object it was attached to. Returns forgotten object-value pairs.

Source

pub fn set_object_weight<Id: AsRef<Uuid>>( &mut self, id: Id, weight: &W, value: WV, ) -> Option<WV>

Apply a weight value to an object. Returns the previous value if any.

Source

pub fn set_object_weight_key( &mut self, obj: ObjKey, key: WeightKey, value: WV, ) -> Option<WV>

Apply a weight value to an object using internally used keys. Returns the previous value if any.

Source

pub fn remove_object_weight<Id: AsRef<Uuid>>( &mut self, id: Id, weight: &W, ) -> Option<WV>

Strip a weight value from an object.

Source

pub fn remove_object_weight_key( &mut self, obj: ObjKey, weight: WeightKey, ) -> Option<WV>

Strip a weight value from an object using internally used keys.

Source

pub fn intern_annotation(&mut self, annotation: Cow<'_, A>) -> AnnotationKey

Intern an annotation. Returns the internally used key.

Source

pub fn forget_annotation(&mut self, annotation: &A) -> Option<AnnotationKey>

Forget an annotation field entirely. Removes it from any object it was attached to. Returns forgotten object-value pairs.

Source

pub fn forget_annotation_key(&mut self, key: AnnotationKey) -> Option<A>

Forget an annotation field entirely. Removes it from any object it was attached to. Returns forgotten object-value pairs.

Source

pub fn set_object_annotation<Id: AsRef<Uuid>>( &mut self, id: Id, annotation: &A, value: AV, ) -> Option<AV>

Apply an annotation value to an object. Returns the previous value if any.

Source

pub fn set_object_annotation_key( &mut self, obj: ObjKey, key: AnnotationKey, value: AV, ) -> Option<AV>

Apply a annotation value to an object using internally used keys. Returns the previous value if any.

Source

pub fn remove_object_annotation<Id: AsRef<Uuid>>( &mut self, id: Id, annotation: &A, ) -> Option<AV>

Strip an annotation value from an object.

Source

pub fn remove_object_annotation_key( &mut self, obj: ObjKey, annotation: AnnotationKey, ) -> Option<AV>

Strip an annotation value from an object using internally used keys.

Source

pub fn remove_object<Id: AsRef<Uuid>>(&mut self, id: Id) -> bool

Remove an object from the store by its ID. Returns if any metadata was held apart from its ID.

Source

pub fn remove_object_key(&mut self, obj: ObjKey) -> bool

Remove an object from the store by its key. Returns if it was removed.

Source

pub fn clean(&mut self)

Clean-up all interned field names that are no longer in use.

Source

pub fn object_meta_named<'a, Id: AsRef<Uuid>>( &'a self, id: Id, ) -> Option<MetadataRef<'a, N, K, L, W, WV, A, AV>>

Get a metadata object with references to the field names.

Source

pub fn object_meta_keyed( &self, obj: ObjKey, ) -> Option<Metadata<NameKey, KindKey, LabelKey, WeightKey, WV, AnnotationKey, AV>>

Get a metadata object expressed as internal field keys.

Source

pub fn object_keys(&self) -> impl Iterator<Item = ObjKey>

All object keys in store.

Source

pub fn object_ids(&self) -> impl Iterator<Item = &Uuid>

All object IDs in store.

Source

pub fn object_key_id_pairs(&self) -> impl Iterator<Item = (ObjKey, &Uuid)>

Iterator over all object key-ID pairs.

Source

pub fn object_id(&self, obj: ObjKey) -> Option<Uuid>

Get the ID of an object.

Source

pub fn object_key<Id: AsRef<Uuid>>(&self, id: Id) -> Option<ObjKey>

Get the key of an object from its ID.

Source

pub fn name_store(&self) -> &NameStore<ObjKey, N>

Read-only access to the name interner.

Source

pub fn name_field_names(&self) -> impl Iterator<Item = &N>

Get all interned name field values.

Source

pub fn name_field_keys(&self) -> impl Iterator<Item = NameKey>

Get all interned name field keys.

Source

pub fn name_field_items(&self) -> impl Iterator<Item = (NameKey, &N)>

Get all interned name field key-name pairs.

Source

pub fn objects_with_name(&self, name: &N) -> impl Iterator<Item = Uuid>

Get all objects with the given name and return their ID.

Source

pub fn objects_with_name_key( &self, name: NameKey, ) -> impl Iterator<Item = ObjKey>

Get all objects with the given internal name key and return their internal key.

Source

pub fn object_name<Id: AsRef<Uuid>>(&self, id: Id) -> Option<&N>

Get the name of an object by ID.

Source

pub fn object_name_key(&self, obj: ObjKey) -> Option<NameKey>

Get the interned name key of an object by internal key.

Source

pub fn kind_store(&self) -> &KindStore<ObjKey, K>

Read-only access to the kind store.

Source

pub fn kind_field_names(&self) -> impl Iterator<Item = &K>

Get all interned kind field names.

Source

pub fn kind_field_keys(&self) -> impl Iterator<Item = KindKey>

Get all interned kind field keys.

Source

pub fn kind_field_items(&self) -> impl Iterator<Item = (KindKey, &K)>

Get all interned kind field key-name pairs.

Source

pub fn object_kind<Id: AsRef<Uuid>>(&self, id: Id) -> Option<&K>

Get the kind of an object by ID.

Source

pub fn object_kind_key(&self, obj: ObjKey) -> Option<KindKey>

Get the interned kind key of an object by internal key.

Source

pub fn label_store(&self) -> &LabelStore<ObjKey, L>

Read-only access to the label store.

Source

pub fn label_field_names(&self) -> impl Iterator<Item = &L>

Get all interned label field names.

Source

pub fn label_field_keys(&self) -> impl Iterator<Item = LabelKey>

Get all interned label field keys.

Source

pub fn label_field_items(&self) -> impl Iterator<Item = (LabelKey, &L)>

Get all interned label field key-name pairs.

Source

pub fn object_labels<Id: AsRef<Uuid>>(&self, id: Id) -> impl Iterator<Item = &L>

Get the labels of an object.

Source

pub fn object_label_keys(&self, obj: ObjKey) -> Option<&BTreeSet<LabelKey>>

Get the set of interned label keys for an object.

Source

pub fn weight_store(&self) -> &WeightStore<ObjKey, W, WV>

Read-only access to the weight store.

Source

pub fn weight_field_names(&self) -> impl Iterator<Item = &W>

Get all interned weight field names.

Source

pub fn weight_field_keys(&self) -> impl Iterator<Item = WeightKey>

Get all interned weight field keys.

Source

pub fn weight_field_items(&self) -> impl Iterator<Item = (WeightKey, &W)>

Get all interned weight field key-name pairs.

Source

pub fn object_weights<Id: AsRef<Uuid>>(&self, id: Id) -> BTreeMap<&W, &WV>

Get all weight values of an object.

Source

pub fn object_weights_keyed( &self, obj: ObjKey, ) -> Option<&BTreeMap<WeightKey, WV>>

Get the mapping of weights by internal field keys for an object.

Source

pub fn object_weight<Id: AsRef<Uuid>>(&self, id: Id, weight: &W) -> Option<&WV>

Get a specific weight of an object via its name.

Source

pub fn object_weight_by_key( &self, obj: ObjKey, weight: WeightKey, ) -> Option<&WV>

Get a specific weight of an object via its internal key.

Source

pub fn annotation_store(&self) -> &AnnotationStore<ObjKey, A, AV>

Read-only access to the annotation store.

Source

pub fn annotation_field_names(&self) -> impl Iterator<Item = &A>

Get all interned annotation field names.

Source

pub fn annotation_field_keys(&self) -> impl Iterator<Item = AnnotationKey>

Get all interned annotation field keys.

Source

pub fn annotation_field_items( &self, ) -> impl Iterator<Item = (AnnotationKey, &A)>

Get all interned annotation field key-name pairs.

Source

pub fn object_annotations<Id: AsRef<Uuid>>(&self, id: Id) -> BTreeMap<&A, &AV>

Get all annotation values of an object.

Source

pub fn object_annotations_keyed( &self, obj: ObjKey, ) -> Option<&BTreeMap<AnnotationKey, AV>>

Get the annotations mapping by internal field keys for an object.

Source

pub fn object_annotation<Id: AsRef<Uuid>>( &self, id: Id, annotation: &A, ) -> Option<&AV>

Get a specific annotation of an object via its name.

Source

pub fn object_annotation_by_key( &self, obj: ObjKey, annotation: AnnotationKey, ) -> Option<&AV>

Get a specific annotation of an object via its internal key.

Source

pub fn iter_meta_named<'a>( &'a self, ) -> impl Iterator<Item = MetadataRef<'a, N, K, L, W, WV, A, AV>>

Iterate over the interned metadata in terms of field names

Source

pub fn iter_meta_keyed( &self, ) -> impl Iterator<Item = Metadata<NameKey, KindKey, LabelKey, WeightKey, WV, AnnotationKey, AV>>

Iterate over all interned metadata items in terms of internal keys.

Source

pub fn aggregate(&self) -> Aggregate<N, K, L, W, WV, A>

Calculate the aggregate for this store.

Trait Implementations§

Source§

impl<ObjKey, N, K, L, W, WV, A, AV> Clone for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Key + Clone, N: Field + Clone, K: Field + Clone, L: Field + Clone, W: Field + Clone, WV: WeightValue + Clone, A: Field + Clone, AV: AnnotationValue + Clone,

Source§

fn clone(&self) -> MetadataStore<ObjKey, N, K, L, W, WV, A, AV>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<ObjKey, N, K, L, W, WV, A, AV> Debug for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Key + Debug, N: Field + Debug, K: Field + Debug, L: Field + Debug, W: Field + Debug, WV: WeightValue + Debug, A: Field + Debug, AV: AnnotationValue + Debug,

Source§

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

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

impl<ObjKey, N, K, L, W, WV, A, AV> Default for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Key, N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Source§

fn default() -> Self

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

impl<'de, ObjKey, N, K, L, W, WV, A, AV> Deserialize<'de> for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Key + Deserialize<'de>, N: Field + Deserialize<'de>, K: Field + Deserialize<'de>, L: Field + Deserialize<'de>, W: Field + Deserialize<'de>, WV: WeightValue + Deserialize<'de>, A: Field + Deserialize<'de>, AV: AnnotationValue + Deserialize<'de>, MetadataStore<ObjKey, N, K, L, W, WV, A, AV>: Default,

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<ObjKey, N, K, L, W, WV, A, AV> Serialize for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>

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

Auto Trait Implementations§

§

impl<ObjKey, N, K, L, W, WV, A, AV> Freeze for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>

§

impl<ObjKey, N, K, L, W, WV, A, AV> RefUnwindSafe for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>

§

impl<ObjKey, N, K, L, W, WV, A, AV> Send for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Send, N: Send, K: Send, L: Send, W: Send, A: Send, WV: Send, AV: Send,

§

impl<ObjKey, N, K, L, W, WV, A, AV> Sync for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Sync, N: Sync, K: Sync, L: Sync, W: Sync, A: Sync, WV: Sync, AV: Sync,

§

impl<ObjKey, N, K, L, W, WV, A, AV> Unpin for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>
where ObjKey: Unpin, N: Unpin, K: Unpin, L: Unpin, W: Unpin, A: Unpin,

§

impl<ObjKey, N, K, L, W, WV, A, AV> UnsafeUnpin for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>

§

impl<ObjKey, N, K, L, W, WV, A, AV> UnwindSafe for MetadataStore<ObjKey, N, K, L, W, WV, A, AV>

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> 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,