pub struct MeshClient { /* private fields */ }Expand description
Client-side mesh operations
Implementations§
Source§impl MeshClient
impl MeshClient
pub fn new(host: &str, port: u16) -> MeshClient
Sourcepub fn generate_instance_id() -> String
pub fn generate_instance_id() -> String
Generate a unique instance ID
Sourcepub async fn register(
&self,
instance_id: String,
hostname: String,
port: u16,
capabilities: Vec<String>,
agent_profiles: Vec<String>,
) -> Result<RegisterResponse, Error>
pub async fn register( &self, instance_id: String, hostname: String, port: u16, capabilities: Vec<String>, agent_profiles: Vec<String>, ) -> Result<RegisterResponse, Error>
Register this instance with a mesh registry
Sourcepub async fn heartbeat(
&self,
instance_id: &str,
metrics: Option<HashMap<String, Value>>,
) -> Result<HeartbeatResponse, Error>
pub async fn heartbeat( &self, instance_id: &str, metrics: Option<HashMap<String, Value>>, ) -> Result<HeartbeatResponse, Error>
Send heartbeat to registry
Sourcepub async fn list_instances(&self) -> Result<InstancesResponse, Error>
pub async fn list_instances(&self) -> Result<InstancesResponse, Error>
List all instances in the mesh
Sourcepub async fn deregister(&self, instance_id: &str) -> Result<(), Error>
pub async fn deregister(&self, instance_id: &str) -> Result<(), Error>
Deregister from the mesh
Sourcepub async fn send_message(
&self,
source_instance: String,
target_instance: Option<String>,
message_type: MessageType,
payload: Value,
correlation_id: Option<String>,
) -> Result<SendMessageResponse, Error>
pub async fn send_message( &self, source_instance: String, target_instance: Option<String>, message_type: MessageType, payload: Value, correlation_id: Option<String>, ) -> Result<SendMessageResponse, Error>
Send a message to another instance
Sourcepub async fn get_messages(
&self,
instance_id: &str,
) -> Result<PendingMessagesResponse, Error>
pub async fn get_messages( &self, instance_id: &str, ) -> Result<PendingMessagesResponse, Error>
Get pending messages for an instance
Trait Implementations§
Source§impl Clone for MeshClient
impl Clone for MeshClient
Source§fn clone(&self) -> MeshClient
fn clone(&self) -> MeshClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MeshClient
impl !RefUnwindSafe for MeshClient
impl Send for MeshClient
impl Sync for MeshClient
impl Unpin for MeshClient
impl !UnwindSafe for MeshClient
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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