pub struct EntityGraph {
pub entities: DashMap<String, EntityNode>,
/* private fields */
}Expand description
Lock-free entity graph using DashMap
Replaces SimpleEntityGraph with lock-free concurrent access. Entity nodes use atomic counters for mention tracking. Relationships use DashMap with sequential IDs for lock-free access.
Fields§
§entities: DashMap<String, EntityNode>Map of entity name to its node data
Implementations§
Source§impl EntityGraph
impl EntityGraph
Sourcepub fn new() -> EntityGraph
pub fn new() -> EntityGraph
Create new empty entity graph (lock-free)
Sourcepub fn add_or_update_entity(
&self,
name: String,
entity_type: EntityType,
timestamp: DateTime<Utc>,
description: &str,
)
pub fn add_or_update_entity( &self, name: String, entity_type: EntityType, timestamp: DateTime<Utc>, description: &str, )
Add or update entity - API compatible with SimpleEntityGraph (lock-free)
Sourcepub fn mention_entity(
&self,
name: &str,
_update_id: Uuid,
timestamp: DateTime<Utc>,
)
pub fn mention_entity( &self, name: &str, _update_id: Uuid, timestamp: DateTime<Utc>, )
Track entity mention - API compatible with SimpleEntityGraph (lock-free)
Sourcepub fn add_relationship(&self, relationship: EntityRelationship)
pub fn add_relationship(&self, relationship: EntityRelationship)
Add relationship - API compatible with SimpleEntityGraph (lock-free)
Sourcepub fn get_entity(&self, name: &str) -> Option<EntityNode>
pub fn get_entity(&self, name: &str) -> Option<EntityNode>
Get entity node (lock-free)
Sourcepub fn get_all_entities(&self) -> Vec<(String, EntityType, usize)>
pub fn get_all_entities(&self) -> Vec<(String, EntityType, usize)>
Get all entities as Vec (lock-free)
Sourcepub fn get_relationships(&self) -> Vec<EntityRelationship>
pub fn get_relationships(&self) -> Vec<EntityRelationship>
Get all relationships (lock-free)
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Get entity count (lock-free)
Sourcepub fn relationship_count(&self) -> usize
pub fn relationship_count(&self) -> usize
Get relationship count (lock-free)
Trait Implementations§
Source§impl Default for EntityGraph
impl Default for EntityGraph
Source§fn default() -> EntityGraph
fn default() -> EntityGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EntityGraph
impl !RefUnwindSafe for EntityGraph
impl Send for EntityGraph
impl Sync for EntityGraph
impl Unpin for EntityGraph
impl UnsafeUnpin for EntityGraph
impl UnwindSafe for EntityGraph
Blanket Implementations§
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::RequestSource§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::RequestSource§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