pub struct GraphMemory { /* private fields */ }Expand description
The main entry point for graph memory operations.
Implementations§
Source§impl GraphMemory
impl GraphMemory
Sourcepub async fn open(path: &Path) -> Result<Self, GraphError>
pub async fn open(path: &Path) -> Result<Self, GraphError>
Open or create a graph store at the given path.
Path should be the graph/ directory inside the memory directory.
Sourcepub async fn add_entity(&self, entity: NewEntity) -> Result<Entity, GraphError>
pub async fn add_entity(&self, entity: NewEntity) -> Result<Entity, GraphError>
Add a new entity to the graph.
Sourcepub async fn get_entity(&self, name: &str) -> Result<Option<Entity>, GraphError>
pub async fn get_entity(&self, name: &str) -> Result<Option<Entity>, GraphError>
Get an entity by name.
Sourcepub async fn get_entity_by_id(
&self,
id: &str,
) -> Result<Option<Entity>, GraphError>
pub async fn get_entity_by_id( &self, id: &str, ) -> Result<Option<Entity>, GraphError>
Get an entity by its record ID.
Sourcepub async fn update_entity(
&self,
id: &str,
updates: EntityUpdate,
) -> Result<Entity, GraphError>
pub async fn update_entity( &self, id: &str, updates: EntityUpdate, ) -> Result<Entity, GraphError>
Update an entity’s fields.
Sourcepub async fn delete_entity(&self, id: &str) -> Result<(), GraphError>
pub async fn delete_entity(&self, id: &str) -> Result<(), GraphError>
Delete an entity and its relationships.
Sourcepub async fn list_entities(
&self,
entity_type: Option<&str>,
) -> Result<Vec<Entity>, GraphError>
pub async fn list_entities( &self, entity_type: Option<&str>, ) -> Result<Vec<Entity>, GraphError>
List all entities, optionally filtered by type.
Sourcepub async fn add_relationship(
&self,
rel: NewRelationship,
) -> Result<Relationship, GraphError>
pub async fn add_relationship( &self, rel: NewRelationship, ) -> Result<Relationship, GraphError>
Create a relationship between two named entities.
Sourcepub async fn get_relationships(
&self,
entity_name: &str,
direction: Direction,
) -> Result<Vec<Relationship>, GraphError>
pub async fn get_relationships( &self, entity_name: &str, direction: Direction, ) -> Result<Vec<Relationship>, GraphError>
Get relationships for an entity.
Sourcepub async fn supersede_relationship(
&self,
old_id: &str,
new: NewRelationship,
) -> Result<Relationship, GraphError>
pub async fn supersede_relationship( &self, old_id: &str, new: NewRelationship, ) -> Result<Relationship, GraphError>
Supersede a relationship: close the old one, create a new one.
Sourcepub async fn add_episode(
&self,
episode: NewEpisode,
) -> Result<Episode, GraphError>
pub async fn add_episode( &self, episode: NewEpisode, ) -> Result<Episode, GraphError>
Add a new episode to the graph.
Sourcepub async fn get_episodes_by_session(
&self,
session_id: &str,
) -> Result<Vec<Episode>, GraphError>
pub async fn get_episodes_by_session( &self, session_id: &str, ) -> Result<Vec<Episode>, GraphError>
Get episodes by session ID.
Sourcepub async fn get_episode_by_log_number(
&self,
log_number: u32,
) -> Result<Option<Episode>, GraphError>
pub async fn get_episode_by_log_number( &self, log_number: u32, ) -> Result<Option<Episode>, GraphError>
Get episode by log number.
Sourcepub async fn ingest_archive(
&self,
archive_text: &str,
session_id: &str,
log_number: Option<u32>,
llm: Option<&dyn LlmProvider>,
) -> Result<IngestionReport, GraphError>
pub async fn ingest_archive( &self, archive_text: &str, session_id: &str, log_number: Option<u32>, llm: Option<&dyn LlmProvider>, ) -> Result<IngestionReport, GraphError>
Ingest a conversation archive into the knowledge graph.
Sourcepub async fn extract_from_archive(
&self,
archive_text: &str,
session_id: &str,
log_number: Option<u32>,
llm: &dyn LlmProvider,
) -> Result<IngestionReport, GraphError>
pub async fn extract_from_archive( &self, archive_text: &str, session_id: &str, log_number: Option<u32>, llm: &dyn LlmProvider, ) -> Result<IngestionReport, GraphError>
Run LLM extraction on an archive without creating episodes.
Sourcepub async fn mark_extracted(&self, log_number: u32) -> Result<(), GraphError>
pub async fn mark_extracted(&self, log_number: u32) -> Result<(), GraphError>
Mark all episodes with a given log_number as extracted.
Sourcepub async fn unextracted_log_numbers(&self) -> Result<Vec<i64>, GraphError>
pub async fn unextracted_log_numbers(&self) -> Result<Vec<i64>, GraphError>
Get log numbers of episodes that have NOT been extracted.
Sourcepub async fn search(
&self,
query: &str,
limit: usize,
) -> Result<Vec<SearchResult>, GraphError>
pub async fn search( &self, query: &str, limit: usize, ) -> Result<Vec<SearchResult>, GraphError>
Semantic search across entities (legacy — returns full Entity).
Sourcepub async fn search_with_options(
&self,
query: &str,
options: &SearchOptions,
) -> Result<Vec<ScoredEntity>, GraphError>
pub async fn search_with_options( &self, query: &str, options: &SearchOptions, ) -> Result<Vec<ScoredEntity>, GraphError>
Search with options — L1 projections, type/keyword filters.
Sourcepub async fn search_episodes(
&self,
query: &str,
limit: usize,
) -> Result<Vec<EpisodeSearchResult>, GraphError>
pub async fn search_episodes( &self, query: &str, limit: usize, ) -> Result<Vec<EpisodeSearchResult>, GraphError>
Semantic search across episodes.
Sourcepub async fn query(
&self,
query_text: &str,
options: &QueryOptions,
) -> Result<QueryResult, GraphError>
pub async fn query( &self, query_text: &str, options: &QueryOptions, ) -> Result<QueryResult, GraphError>
Hybrid query: semantic + graph expansion + optional episode search.
Sourcepub async fn traverse(
&self,
entity_name: &str,
depth: u32,
) -> Result<TraversalNode, GraphError>
pub async fn traverse( &self, entity_name: &str, depth: u32, ) -> Result<TraversalNode, GraphError>
Traverse the graph from a named entity.
Sourcepub async fn traverse_filtered(
&self,
entity_name: &str,
depth: u32,
type_filter: Option<&str>,
) -> Result<TraversalNode, GraphError>
pub async fn traverse_filtered( &self, entity_name: &str, depth: u32, type_filter: Option<&str>, ) -> Result<TraversalNode, GraphError>
Traverse with type filter.
Sourcepub async fn sync_pipeline(
&self,
docs: &PipelineDocuments,
) -> Result<PipelineSyncReport, GraphError>
pub async fn sync_pipeline( &self, docs: &PipelineDocuments, ) -> Result<PipelineSyncReport, GraphError>
Sync pipeline documents into the graph.
Sourcepub async fn pipeline_stats(
&self,
staleness_days: u32,
) -> Result<PipelineGraphStats, GraphError>
pub async fn pipeline_stats( &self, staleness_days: u32, ) -> Result<PipelineGraphStats, GraphError>
Get pipeline stats from the graph.
Sourcepub async fn pipeline_entities(
&self,
stage: &str,
status: Option<&str>,
) -> Result<Vec<EntityDetail>, GraphError>
pub async fn pipeline_entities( &self, stage: &str, status: Option<&str>, ) -> Result<Vec<EntityDetail>, GraphError>
Get pipeline entities by stage and optional status.
Sourcepub async fn pipeline_flow(
&self,
entity_name: &str,
) -> Result<Vec<(EntityDetail, String, EntityDetail)>, GraphError>
pub async fn pipeline_flow( &self, entity_name: &str, ) -> Result<Vec<(EntityDetail, String, EntityDetail)>, GraphError>
Trace pipeline flow for an entity.
Sourcepub async fn sync_vigil_signals(
&self,
signals_path: &Path,
) -> Result<VigilSyncReport, GraphError>
pub async fn sync_vigil_signals( &self, signals_path: &Path, ) -> Result<VigilSyncReport, GraphError>
Sync vigil signal vectors into the graph as Measurement entities.
Sourcepub async fn sync_outcomes(
&self,
outcomes_path: &Path,
) -> Result<VigilSyncReport, GraphError>
pub async fn sync_outcomes( &self, outcomes_path: &Path, ) -> Result<VigilSyncReport, GraphError>
Sync outcome records into the graph as Outcome entities.
Sourcepub async fn sync_vigil(
&self,
signals_path: &Path,
outcomes_path: &Path,
) -> Result<VigilSyncReport, GraphError>
pub async fn sync_vigil( &self, signals_path: &Path, outcomes_path: &Path, ) -> Result<VigilSyncReport, GraphError>
Sync both vigil signals and outcomes in one call.
Sourcepub async fn stats(&self) -> Result<GraphStats, GraphError>
pub async fn stats(&self) -> Result<GraphStats, GraphError>
Get graph statistics.
Auto Trait Implementations§
impl !Freeze for GraphMemory
impl !RefUnwindSafe for GraphMemory
impl Send for GraphMemory
impl Sync for GraphMemory
impl Unpin for GraphMemory
impl UnsafeUnpin for GraphMemory
impl !UnwindSafe for GraphMemory
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
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>
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>
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>
T in a tonic::Request