pub struct DistributedRuntime { /* private fields */ }Expand description
Distributed runtime coordinator
Implementations§
Source§impl DistributedRuntime
impl DistributedRuntime
Sourcepub fn register_node(&self, node: NodeInfo) -> Result<()>
pub fn register_node(&self, node: NodeInfo) -> Result<()>
Register a node in the cluster
Sourcepub fn unregister_node(&self, node_id: Uuid) -> Result<()>
pub fn unregister_node(&self, node_id: Uuid) -> Result<()>
Unregister a node
Sourcepub async fn send_to_agent(
&self,
from_agent: Uuid,
to_agent: Uuid,
payload: Value,
message_type: String,
) -> Result<()>
pub async fn send_to_agent( &self, from_agent: Uuid, to_agent: Uuid, payload: Value, message_type: String, ) -> Result<()>
Send message to agent on any node
Sourcepub fn get_agent_node(&self, agent_id: Uuid) -> Option<Uuid>
pub fn get_agent_node(&self, agent_id: Uuid) -> Option<Uuid>
Get node for agent
Sourcepub fn get_healthy_nodes(&self) -> Vec<NodeInfo>
pub fn get_healthy_nodes(&self) -> Vec<NodeInfo>
Get healthy nodes
Sourcepub fn find_best_node(&self) -> Option<Uuid>
pub fn find_best_node(&self) -> Option<Uuid>
Find best node for new agent (load balancing)
Sourcepub fn heartbeat(
&self,
node_id: Uuid,
cpu_usage: f32,
memory_usage: f32,
) -> Result<()>
pub fn heartbeat( &self, node_id: Uuid, cpu_usage: f32, memory_usage: f32, ) -> Result<()>
Heartbeat to update node status
Sourcepub fn check_node_health(&self, timeout_seconds: i64) -> Vec<Uuid>
pub fn check_node_health(&self, timeout_seconds: i64) -> Vec<Uuid>
Check for dead nodes (no heartbeat)
Sourcepub fn try_recv_message(&self) -> Option<DistributedMessage>
pub fn try_recv_message(&self) -> Option<DistributedMessage>
Try to receive a message from the queue (non-blocking)
Sourcepub async fn receive_messages<F>(&self, handler: F) -> Result<()>
pub async fn receive_messages<F>(&self, handler: F) -> Result<()>
Receive messages with a handler (blocking until handler returns)
Sourcepub async fn process_pending_messages<F>(&self, handler: F) -> Result<usize>
pub async fn process_pending_messages<F>(&self, handler: F) -> Result<usize>
Process pending messages with a batch handler
Sourcepub fn pending_message_count(&self) -> usize
pub fn pending_message_count(&self) -> usize
Get the number of pending messages in the queue
Sourcepub fn total_messages_sent(&self) -> usize
pub fn total_messages_sent(&self) -> usize
Get the total number of messages sent through this node
Sourcepub fn total_messages_received(&self) -> usize
pub fn total_messages_received(&self) -> usize
Get the total number of messages received by this node
Sourcepub fn get_message_stats(&self) -> MessageStats
pub fn get_message_stats(&self) -> MessageStats
Get message processing statistics
Sourcepub fn reset_message_stats(&self)
pub fn reset_message_stats(&self)
Reset message statistics
Auto Trait Implementations§
impl Freeze for DistributedRuntime
impl RefUnwindSafe for DistributedRuntime
impl Send for DistributedRuntime
impl Sync for DistributedRuntime
impl Unpin for DistributedRuntime
impl UnwindSafe for DistributedRuntime
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 more