pub struct ClusterClient { /* private fields */ }
Expand description
Client for interacting with a cluster
Implementations§
Source§impl ClusterClient
impl ClusterClient
pub fn new( cmd_tx: Sender<SubnetCommand>, event_rx: Receiver<SubnetEvent>, ) -> Self
Sourcepub const fn available_patterns(&self) -> &HashMap<String, Pattern>
pub const fn available_patterns(&self) -> &HashMap<String, Pattern>
returns an immutable reference to the available patterns
Sourcepub fn available_patterns_mut(&mut self) -> &mut HashMap<String, Pattern>
pub fn available_patterns_mut(&mut self) -> &mut HashMap<String, Pattern>
returns a mutable reference to the available patterns
Sourcepub const fn peers(&self) -> &HashMap<NodeId, PeerInfo>
pub const fn peers(&self) -> &HashMap<NodeId, PeerInfo>
returns an immutable reference to the peers
Sourcepub fn peers_mut(&mut self) -> &mut HashMap<NodeId, PeerInfo>
pub fn peers_mut(&mut self) -> &mut HashMap<NodeId, PeerInfo>
returns a mutable reference to the peers
Sourcepub async fn find_learning_nodes(&self) -> Vec<NodeId>
pub async fn find_learning_nodes(&self) -> Vec<NodeId>
Find nodes that can learn patterns
Sourcepub fn get_patterns_for_class(&self, class: Triads) -> Vec<&Pattern>
pub fn get_patterns_for_class(&self, class: Triads) -> Vec<&Pattern>
Get patterns for a specific chord class
Sourcepub fn get_peers(&self) -> &HashMap<NodeId, PeerInfo>
pub fn get_peers(&self) -> &HashMap<NodeId, PeerInfo>
Get all known peers with their capabilities
Sourcepub fn get_peers_with_capability(
&self,
capability: &str,
) -> Vec<(NodeId, &PeerInfo)>
pub fn get_peers_with_capability( &self, capability: &str, ) -> Vec<(NodeId, &PeerInfo)>
Get peers with a specific capability
Sourcepub async fn process_events(&mut self) -> Result<()>
pub async fn process_events(&mut self) -> Result<()>
Process received events from the cluster
Share a specific pattern with the network
Sourcepub async fn request_pattern_sharing(&self) -> Result<(), NetworkError>
pub async fn request_pattern_sharing(&self) -> Result<(), NetworkError>
Request all nodes to share their patterns
Sourcepub async fn connect(&self, addr: Multiaddr) -> Result<NodeId, NetworkError>
pub async fn connect(&self, addr: Multiaddr) -> Result<NodeId, NetworkError>
Connect to a peer address
Sourcepub async fn request_resource_status(&self) -> Result<(), NetworkError>
pub async fn request_resource_status(&self) -> Result<(), NetworkError>
Request resource status from all peers
Sourcepub async fn allocate_task(
&self,
task_type: String,
work_units: Vec<WorkUnit>,
) -> Result<(), NetworkError>
pub async fn allocate_task( &self, task_type: String, work_units: Vec<WorkUnit>, ) -> Result<(), NetworkError>
Allocate work units to network nodes
Sourcepub async fn learn_network_patterns(&self) -> Result<(), NetworkError>
pub async fn learn_network_patterns(&self) -> Result<(), NetworkError>
Learn patterns that have been shared on the network
Sourcepub async fn distribute_surface_patterns(&self) -> Result<(), NetworkError>
pub async fn distribute_surface_patterns(&self) -> Result<(), NetworkError>
Distribute surface patterns to the network
Sourcepub async fn form_processing_cluster(
&self,
task_type: String,
) -> Result<Vec<PeerId>, NetworkError>
pub async fn form_processing_cluster( &self, task_type: String, ) -> Result<Vec<PeerId>, NetworkError>
Form a processing cluster for a specific task type
Sourcepub async fn synchronize_memory(&self) -> Result<(), NetworkError>
pub async fn synchronize_memory(&self) -> Result<(), NetworkError>
Synchronize memory across the network
Sourcepub async fn dynamic_work_distribution(
&self,
operations: Vec<(EdgeId, Vec<LPR>)>,
) -> Result<(), NetworkError>
pub async fn dynamic_work_distribution( &self, operations: Vec<(EdgeId, Vec<LPR>)>, ) -> Result<(), NetworkError>
Create a dynamic work distribution for a set of operations
Sourcepub async fn topology_aware_learning(&self) -> Result<(), NetworkError>
pub async fn topology_aware_learning(&self) -> Result<(), NetworkError>
Enable topology-aware learning
Sourcepub async fn shutdown(&self) -> Result<(), NetworkError>
pub async fn shutdown(&self) -> Result<(), NetworkError>
Shutdown the network
Auto Trait Implementations§
impl Freeze for ClusterClient
impl RefUnwindSafe for ClusterClient
impl Send for ClusterClient
impl Sync for ClusterClient
impl Unpin for ClusterClient
impl UnwindSafe for ClusterClient
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
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