pub struct DistributedReasoner { /* private fields */ }Expand description
Distributed reasoner coordinator with Raft consensus
Implementations§
Source§impl DistributedReasoner
impl DistributedReasoner
Sourcepub fn new(strategy: PartitionStrategy) -> Self
pub fn new(strategy: PartitionStrategy) -> Self
Create a new distributed reasoner with Raft consensus
Sourcepub fn set_min_facts_per_partition(&mut self, min: usize)
pub fn set_min_facts_per_partition(&mut self, min: usize)
Set minimum facts per partition (to prevent over-partitioning)
Sourcepub fn register_node(&mut self, node: Node) -> Result<()>
pub fn register_node(&mut self, node: Node) -> Result<()>
Register a node
Sourcepub fn unregister_node(&mut self, node_id: &str) -> Option<Node>
pub fn unregister_node(&mut self, node_id: &str) -> Option<Node>
Unregister a node
Sourcepub fn get_available_nodes(&self) -> Vec<&Node>
pub fn get_available_nodes(&self) -> Vec<&Node>
Get available nodes
Sourcepub fn partition_work(
&mut self,
rules: &[Rule],
facts: &[RuleAtom],
) -> Result<Vec<WorkPartition>>
pub fn partition_work( &mut self, rules: &[Rule], facts: &[RuleAtom], ) -> Result<Vec<WorkPartition>>
Partition work across available nodes
Sourcepub fn execute_distributed(
&mut self,
rules: &[Rule],
facts: &[RuleAtom],
) -> Result<Vec<RuleAtom>>
pub fn execute_distributed( &mut self, rules: &[Rule], facts: &[RuleAtom], ) -> Result<Vec<RuleAtom>>
Execute distributed reasoning (optimized)
Sourcepub fn get_stats(&self) -> &DistributedStats
pub fn get_stats(&self) -> &DistributedStats
Get statistics
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Reset statistics
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get node count
Sourcepub fn elect_leader(&mut self) -> Result<String>
pub fn elect_leader(&mut self) -> Result<String>
Elect leader using simplified Raft algorithm
Sourcepub fn send_heartbeat(&mut self) -> Result<()>
pub fn send_heartbeat(&mut self) -> Result<()>
Send heartbeat from leader to all followers
Sourcepub fn check_heartbeat_timeout(&mut self) -> Result<bool>
pub fn check_heartbeat_timeout(&mut self) -> Result<bool>
Check for heartbeat timeout and trigger election if needed
Sourcepub fn get_leader(&self) -> Option<&Node>
pub fn get_leader(&self) -> Option<&Node>
Get current leader
Sourcepub fn execute_distributed_with_consensus(
&mut self,
rules: &[Rule],
facts: &[RuleAtom],
) -> Result<Vec<RuleAtom>>
pub fn execute_distributed_with_consensus( &mut self, rules: &[Rule], facts: &[RuleAtom], ) -> Result<Vec<RuleAtom>>
Execute distributed reasoning with Raft consensus
Sourcepub fn handle_node_failure(&mut self, node_id: &str) -> Result<()>
pub fn handle_node_failure(&mut self, node_id: &str) -> Result<()>
Handle node failure
Sourcepub fn recover_node(&mut self, node_id: &str) -> Result<()>
pub fn recover_node(&mut self, node_id: &str) -> Result<()>
Recover node from failure
Sourcepub fn get_cluster_health(&self) -> ClusterHealth
pub fn get_cluster_health(&self) -> ClusterHealth
Get cluster health status
Auto Trait Implementations§
impl Freeze for DistributedReasoner
impl RefUnwindSafe for DistributedReasoner
impl Send for DistributedReasoner
impl Sync for DistributedReasoner
impl Unpin for DistributedReasoner
impl UnsafeUnpin for DistributedReasoner
impl UnwindSafe for DistributedReasoner
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more