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
impl MetadataStorage
Sourcepub fn new() -> MetadataStorage
pub fn new() -> MetadataStorage
Create new metadata storage
Sourcepub fn set(
&mut self,
entity_id: EntityId,
key: impl Into<String>,
value: MetadataValue,
)
pub fn set( &mut self, entity_id: EntityId, key: impl Into<String>, value: MetadataValue, )
Set a metadata value for an entity
Sourcepub fn get(&self, entity_id: EntityId, key: &str) -> Option<MetadataValue>
pub fn get(&self, entity_id: EntityId, key: &str) -> Option<MetadataValue>
Get a metadata value for an entity
Sourcepub fn set_all(&mut self, entity_id: EntityId, metadata: &Metadata)
pub fn set_all(&mut self, entity_id: EntityId, metadata: &Metadata)
Set all metadata for an entity
Sourcepub fn remove_all(&mut self, entity_id: EntityId)
pub fn remove_all(&mut self, entity_id: EntityId)
Remove all metadata for an entity
Sourcepub fn filter_int_range(
&self,
key: &str,
min: Option<i64>,
max: Option<i64>,
) -> Vec<EntityId>
pub fn filter_int_range( &self, key: &str, min: Option<i64>, max: Option<i64>, ) -> Vec<EntityId>
Find entities matching int range
Sourcepub fn filter_string_prefix(&self, key: &str, prefix: &str) -> Vec<EntityId>
pub fn filter_string_prefix(&self, key: &str, prefix: &str) -> Vec<EntityId>
Find entities matching string prefix
Sourcepub fn filter_eq(&self, key: &str, value: &MetadataValue) -> Vec<EntityId>
pub fn filter_eq(&self, key: &str, value: &MetadataValue) -> Vec<EntityId>
Find entities where key equals value
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Number of entities with metadata
Sourcepub fn value_count(&self) -> usize
pub fn value_count(&self) -> usize
Total number of key-value pairs
Trait Implementations§
Source§impl Debug for MetadataStorage
impl Debug for MetadataStorage
Source§impl Default for MetadataStorage
impl Default for MetadataStorage
Source§fn default() -> MetadataStorage
fn default() -> MetadataStorage
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Forget for MetadataStorage
impl Freeze for MetadataStoragewhere
*const LeafNode<(EntityId, String), bool> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<((EntityId, String), bool)>>: Freeze,
*const LeafNode<(EntityId, String), i64> is !null: Freeze,
PhantomData<Box<((EntityId, String), i64)>>: Freeze,
*const LeafNode<(EntityId, String), f64> is !null: Freeze,
PhantomData<Box<((EntityId, String), f64)>>: Freeze,
*const LeafNode<(EntityId, String), String> is !null: Freeze,
PhantomData<Box<((EntityId, String), String)>>: Freeze,
*const LeafNode<(EntityId, String), Vec<u8>> is !null: Freeze,
PhantomData<Box<((EntityId, String), Vec<u8>)>>: Freeze,
*const LeafNode<(EntityId, String), u64> is !null: Freeze,
PhantomData<Box<((EntityId, String), u64)>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<((EntityId, String), MetadataValue)>: Freeze,
PhantomData<(EntityId, HashSet<String>)>: Freeze,
impl Move for MetadataStorage
impl RefUnwindSafe for MetadataStorage
impl Send for MetadataStoragewhere
NodeRef<Owned, (EntityId, String), bool, LeafOrInternal>: Send,
BoxRaw<((EntityId, String), bool)>: Send,
NodeRef<Owned, (EntityId, String), i64, LeafOrInternal>: Send,
BoxRaw<((EntityId, String), i64)>: Send,
NodeRef<Owned, (EntityId, String), f64, LeafOrInternal>: Send,
BoxRaw<((EntityId, String), f64)>: Send,
NodeRef<Owned, (EntityId, String), String, LeafOrInternal>: Send,
BoxRaw<((EntityId, String), String)>: Send,
NodeRef<Owned, (EntityId, String), Vec<u8>, LeafOrInternal>: Send,
BoxRaw<((EntityId, String), Vec<u8>)>: Send,
NodeRef<Owned, (EntityId, String), u64, LeafOrInternal>: Send,
BoxRaw<((EntityId, String), u64)>: Send,
RawTable<((EntityId, String), MetadataValue)>: Send,
RawTable<(EntityId, HashSet<String>)>: Send,
impl Sync for MetadataStoragewhere
NodeRef<Owned, (EntityId, String), bool, LeafOrInternal>: Sync,
BoxRaw<((EntityId, String), bool)>: Sync,
NodeRef<Owned, (EntityId, String), i64, LeafOrInternal>: Sync,
BoxRaw<((EntityId, String), i64)>: Sync,
NodeRef<Owned, (EntityId, String), f64, LeafOrInternal>: Sync,
BoxRaw<((EntityId, String), f64)>: Sync,
NodeRef<Owned, (EntityId, String), String, LeafOrInternal>: Sync,
BoxRaw<((EntityId, String), String)>: Sync,
NodeRef<Owned, (EntityId, String), Vec<u8>, LeafOrInternal>: Sync,
BoxRaw<((EntityId, String), Vec<u8>)>: Sync,
NodeRef<Owned, (EntityId, String), u64, LeafOrInternal>: Sync,
BoxRaw<((EntityId, String), u64)>: Sync,
RawTable<((EntityId, String), MetadataValue)>: Sync,
RawTable<(EntityId, HashSet<String>)>: Sync,
impl Unpin for MetadataStoragewhere
*const LeafNode<(EntityId, String), bool> is !null: Unpin,
Box<((EntityId, String), bool)>: Unpin,
*const LeafNode<(EntityId, String), i64> is !null: Unpin,
Box<((EntityId, String), i64)>: Unpin,
*const LeafNode<(EntityId, String), f64> is !null: Unpin,
Box<((EntityId, String), f64)>: Unpin,
*const LeafNode<(EntityId, String), String> is !null: Unpin,
Box<((EntityId, String), String)>: Unpin,
*const LeafNode<(EntityId, String), Vec<u8>> is !null: Unpin,
Box<((EntityId, String), Vec<u8>)>: Unpin,
*const LeafNode<(EntityId, String), u64> is !null: Unpin,
Box<((EntityId, String), u64)>: Unpin,
*const u8 is !null: Unpin,
impl UnsafeUnpin for MetadataStoragewhere
*const LeafNode<(EntityId, String), bool> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<((EntityId, String), bool)>>: UnsafeUnpin,
*const LeafNode<(EntityId, String), i64> is !null: UnsafeUnpin,
PhantomData<Box<((EntityId, String), i64)>>: UnsafeUnpin,
*const LeafNode<(EntityId, String), f64> is !null: UnsafeUnpin,
PhantomData<Box<((EntityId, String), f64)>>: UnsafeUnpin,
*const LeafNode<(EntityId, String), String> is !null: UnsafeUnpin,
PhantomData<Box<((EntityId, String), String)>>: UnsafeUnpin,
*const LeafNode<(EntityId, String), Vec<u8>> is !null: UnsafeUnpin,
PhantomData<Box<((EntityId, String), Vec<u8>)>>: UnsafeUnpin,
*const LeafNode<(EntityId, String), u64> is !null: UnsafeUnpin,
PhantomData<Box<((EntityId, String), u64)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<((EntityId, String), MetadataValue)>: UnsafeUnpin,
PhantomData<(EntityId, HashSet<String>)>: UnsafeUnpin,
impl UnwindSafe for MetadataStoragewhere
BTreeMap<(EntityId, String), bool>: UnwindSafe,
BTreeMap<(EntityId, String), i64>: UnwindSafe,
BTreeMap<(EntityId, String), f64>: UnwindSafe,
BTreeMap<(EntityId, String), String>: UnwindSafe,
BTreeMap<(EntityId, String), Vec<u8>>: UnwindSafe,
BTreeMap<(EntityId, String), u64>: UnwindSafe,
HashMap<(EntityId, String), MetadataValue>: UnwindSafe,
HashMap<EntityId, HashSet<String>>: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request