pub struct LocalMesh { /* private fields */ }Implementations§
Source§impl LocalMesh
impl LocalMesh
pub fn new(name: impl Into<String>) -> LocalMesh
Sourcepub fn request_queue(&self) -> Arc<RequestQueue>
pub fn request_queue(&self) -> Arc<RequestQueue>
Get the request queue (for sharing with agent wrappers)
Source§impl LocalMesh
impl LocalMesh
Sourcepub async fn broadcast(
&self,
message: Message,
exclude: Option<&str>,
) -> Result<Vec<Result<(), Error>>, Error>
pub async fn broadcast( &self, message: Message, exclude: Option<&str>, ) -> Result<Vec<Result<(), Error>>, Error>
Broadcast a message to all agents in the mesh
Sourcepub async fn submit(
&self,
target: &str,
payload: String,
) -> Result<String, Error>
pub async fn submit( &self, target: &str, payload: String, ) -> Result<String, Error>
Submit a request (fire-and-forget). Returns request ID.
Sourcepub fn get_pending(&self) -> Vec<MeshRequest>
pub fn get_pending(&self) -> Vec<MeshRequest>
Get pending requests
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Check if there are pending requests
Sourcepub fn get_results(&self) -> Vec<MeshResult>
pub fn get_results(&self) -> Vec<MeshResult>
Get available results (removes them from queue)
Sourcepub fn peek_results(&self) -> Vec<MeshResult>
pub fn peek_results(&self) -> Vec<MeshResult>
Peek at results without removing
Sourcepub async fn send_reminders(
&self,
older_than_secs: f64,
) -> Result<Vec<String>, Error>
pub async fn send_reminders( &self, older_than_secs: f64, ) -> Result<Vec<String>, Error>
Send reminders for stale requests
Sourcepub async fn wait_for(
&self,
request_id: &str,
timeout_secs: f64,
reminder_interval_secs: f64,
) -> Result<MeshResult, Error>
pub async fn wait_for( &self, request_id: &str, timeout_secs: f64, reminder_interval_secs: f64, ) -> Result<MeshResult, Error>
Wait for a specific result with auto-reminders
Sourcepub async fn collect_results(
&self,
reminder_interval_secs: f64,
) -> Vec<MeshResult>
pub async fn collect_results( &self, reminder_interval_secs: f64, ) -> Vec<MeshResult>
Collect all results, blocking until all pending complete
Trait Implementations§
Source§impl Mesh for LocalMesh
impl Mesh for LocalMesh
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalMesh: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalMesh: 'async_trait,
Start the mesh and all registered agents. Read more
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalMesh: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalMesh: 'async_trait,
Stop the mesh and all agents. Read more
Auto Trait Implementations§
impl Freeze for LocalMesh
impl !RefUnwindSafe for LocalMesh
impl Send for LocalMesh
impl Sync for LocalMesh
impl Unpin for LocalMesh
impl !UnwindSafe for LocalMesh
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