Skip to main content

MetadataStorage

Struct MetadataStorage 

Source
pub struct MetadataStorage { /* private fields */ }
Expand description

Type-aware metadata storage

Uses separate B-trees for each type, enabling:

  • Efficient range queries on numeric types
  • No NULL storage overhead
  • Type-specific indexing

Implementations§

Source§

impl MetadataStorage

Source

pub fn new() -> Self

Create new metadata storage

Source

pub fn set( &mut self, entity_id: EntityId, key: impl Into<String>, value: MetadataValue, )

Set a metadata value for an entity

Source

pub fn get(&self, entity_id: EntityId, key: &str) -> Option<MetadataValue>

Get a metadata value for an entity

Source

pub fn get_all(&self, entity_id: EntityId) -> Metadata

Get all metadata for an entity

Source

pub fn set_all(&mut self, entity_id: EntityId, metadata: &Metadata)

Set all metadata for an entity

Source

pub fn remove_all(&mut self, entity_id: EntityId)

Remove all metadata for an entity

Source

pub fn filter_int_range( &self, key: &str, min: Option<i64>, max: Option<i64>, ) -> Vec<EntityId>

Find entities matching int range

Source

pub fn filter_string_prefix(&self, key: &str, prefix: &str) -> Vec<EntityId>

Find entities matching string prefix

Source

pub fn filter_eq(&self, key: &str, value: &MetadataValue) -> Vec<EntityId>

Find entities where key equals value

Source

pub fn entity_count(&self) -> usize

Number of entities with metadata

Source

pub fn value_count(&self) -> usize

Total number of key-value pairs

Trait Implementations§

Source§

impl Debug for MetadataStorage

Source§

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

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

impl Default for MetadataStorage

Source§

fn default() -> Self

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

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