pub trait TransportPort: Send + Sync {
// Required methods
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
owner: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn claim<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
message_id: &'life2 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn mailbox<'life0, 'life1, 'async_trait>(
&'life0 self,
owner: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Mailbox>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A message bus / mailbox transport.
§Atomic claim contract
claim MUST be atomic: at most one caller may
successfully claim a given message. Implementations realize this via a
compare-and-swap on a state/lease field (e.g. a lockfile + CAS), so that
concurrent workers never double-process. A failed claim returns
crate::error::SubstrateError::ClaimConflict.
Required Methods§
Sourcefn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Publish message to its recipient’s mailbox.
Sourcefn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
owner: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
owner: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return all messages currently addressed to owner.
Sourcefn claim<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
message_id: &'life2 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn claim<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
owner: &'life1 str,
message_id: &'life2 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Atomically claim message_id for exclusive processing (CAS-lease).
Returns the claimed message, or ClaimConflict if already held.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".