pub struct DistributedProcessTable { /* private fields */ }Expand description
Distributed process table tracking processes across all nodes.
Implementations§
Source§impl DistributedProcessTable
impl DistributedProcessTable
pub fn new() -> Self
Sourcepub fn merge(&mut self, advert: ProcessAdvertisement)
pub fn merge(&mut self, advert: ProcessAdvertisement)
Merge a process advertisement (LWW: latest timestamp wins).
Sourcepub fn locate(&self, pid: Pid, node_id: &str) -> Option<&ProcessAdvertisement>
pub fn locate(&self, pid: Pid, node_id: &str) -> Option<&ProcessAdvertisement>
Look up a process by local PID and node ID.
Sourcepub fn find_by_type(&self, agent_type: &str) -> Vec<&ProcessAdvertisement>
pub fn find_by_type(&self, agent_type: &str) -> Vec<&ProcessAdvertisement>
Find processes by agent type across all nodes.
Sourcepub fn find_by_capability(&self, capability: &str) -> Vec<&ProcessAdvertisement>
pub fn find_by_capability(&self, capability: &str) -> Vec<&ProcessAdvertisement>
Find processes offering a specific capability.
Sourcepub fn least_loaded_node(&self) -> Option<String>
pub fn least_loaded_node(&self) -> Option<String>
Find the least-loaded node for scheduling.
Sourcepub fn remove_node(&mut self, node_id: &str)
pub fn remove_node(&mut self, node_id: &str)
Remove all processes from a node (e.g., when node becomes unreachable).
Sourcepub fn mark_node_unreachable(&mut self, node_id: &str)
pub fn mark_node_unreachable(&mut self, node_id: &str)
Mark all processes on a node as unreachable.
Sourcepub fn all_advertisements(&self) -> Vec<&ProcessAdvertisement>
pub fn all_advertisements(&self) -> Vec<&ProcessAdvertisement>
Get all process advertisements (for gossip).
pub fn is_empty(&self) -> bool
Sourcepub fn assign_pid(&self, pid: u64, ring: &ConsistentHashRing) -> Option<String>
pub fn assign_pid(&self, pid: u64, ring: &ConsistentHashRing) -> Option<String>
Assign a PID to the optimal node using consistent hashing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DistributedProcessTable
impl RefUnwindSafe for DistributedProcessTable
impl Send for DistributedProcessTable
impl Sync for DistributedProcessTable
impl Unpin for DistributedProcessTable
impl UnsafeUnpin for DistributedProcessTable
impl UnwindSafe for DistributedProcessTable
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