pub struct FederatedGraphRag { /* private fields */ }Expand description
Multi-node GraphRAG federation manager.
In production this would issue async HTTP requests to remote endpoints; here remote nodes are simulated by the local engine (each node shares the same local corpus but is given a distinct source label).
Implementations§
Source§impl FederatedGraphRag
impl FederatedGraphRag
Sourcepub fn new(strategy: FederationStrategy) -> Self
pub fn new(strategy: FederationStrategy) -> Self
Create a new federation with the given routing strategy.
Sourcepub fn add_node(&mut self, node: FederationNode)
pub fn add_node(&mut self, node: FederationNode)
Add a remote node to the federation.
Sourcepub fn remove_node(&mut self, node_id: &str) -> bool
pub fn remove_node(&mut self, node_id: &str) -> bool
Remove a node by its ID. Returns true if the node existed.
Sourcepub fn query(&mut self, q: &FederatedQuery) -> FederatedResult
pub fn query(&mut self, q: &FederatedQuery) -> FederatedResult
Execute a federated query and return the merged result.
Sourcepub fn healthy_nodes(&self) -> Vec<&FederationNode>
pub fn healthy_nodes(&self) -> Vec<&FederationNode>
Return references to all currently healthy nodes.
Sourcepub fn mark_unhealthy(&mut self, node_id: &str)
pub fn mark_unhealthy(&mut self, node_id: &str)
Mark a node as unhealthy (e.g. after a failed health check).
Sourcepub fn rebalance(&mut self)
pub fn rebalance(&mut self)
Rebalance: restore all nodes to healthy (simulates health-check recovery).
Sourcepub fn add_corpus_passage(&mut self, text: impl Into<String>, base_score: f64)
pub fn add_corpus_passage(&mut self, text: impl Into<String>, base_score: f64)
Add a passage to the local corpus (used as backing store for all nodes in the simulation).
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes in the federation (healthy + unhealthy).
Auto Trait Implementations§
impl Freeze for FederatedGraphRag
impl RefUnwindSafe for FederatedGraphRag
impl Send for FederatedGraphRag
impl Sync for FederatedGraphRag
impl Unpin for FederatedGraphRag
impl UnsafeUnpin for FederatedGraphRag
impl UnwindSafe for FederatedGraphRag
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 more