Trait rings_core::message::PayloadSender

source ·
pub trait PayloadSender {
Show 13 methods // Required methods fn session_sk(&self) -> &SessionSk; fn dht(&self) -> Arc<PeerRing>; fn is_connected(&self, did: Did) -> bool; fn do_send_payload<'life0, 'async_trait>( &'life0 self, did: Did, payload: MessagePayload ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn infer_next_hop( &self, destination: Did, next_hop: Option<Did> ) -> Result<Did> { ... } fn send_payload<'life0, 'async_trait>( &'life0 self, payload: MessagePayload ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn send_message_by_hop<'life0, 'async_trait, T>( &'life0 self, msg: T, destination: Did, next_hop: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>> where T: Serialize + Send + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn send_message<'life0, 'async_trait, T>( &'life0 self, msg: T, destination: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>> where T: Serialize + Send + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn send_direct_message<'life0, 'async_trait, T>( &'life0 self, msg: T, destination: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>> where T: Serialize + Send + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn send_report_message<'life0, 'life1, 'async_trait, T>( &'life0 self, payload: &'life1 MessagePayload, msg: T ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where T: Serialize + Send + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn forward_by_relay<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload, relay: MessageRelay ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn forward_payload<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload, next_hop: Option<Did> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn reset_destination<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload, next_hop: Did ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

Trait of PayloadSender

Required Methods§

source

fn session_sk(&self) -> &SessionSk

Get the session sk

source

fn dht(&self) -> Arc<PeerRing>

Get access to DHT.

source

fn is_connected(&self, did: Did) -> bool

Used to check if destination is already connected when infer_next_hop

source

fn do_send_payload<'life0, 'async_trait>( &'life0 self, did: Did, payload: MessagePayload ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a message payload to a specified DID.

Provided Methods§

source

fn infer_next_hop(&self, destination: Did, next_hop: Option<Did>) -> Result<Did>

Infer the next hop for a message by calling dht.find_successor().

source

fn send_payload<'life0, 'async_trait>( &'life0 self, payload: MessagePayload ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Alias for do_send_payload that sets the next hop to payload.relay.next_hop.

source

fn send_message_by_hop<'life0, 'async_trait, T>( &'life0 self, msg: T, destination: Did, next_hop: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
where T: Serialize + Send + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Send a message to a specified destination by specified next hop.

source

fn send_message<'life0, 'async_trait, T>( &'life0 self, msg: T, destination: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
where T: Serialize + Send + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Send a message to a specified destination.

source

fn send_direct_message<'life0, 'async_trait, T>( &'life0 self, msg: T, destination: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'async_trait>>
where T: Serialize + Send + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Send a direct message to a specified destination.

source

fn send_report_message<'life0, 'life1, 'async_trait, T>( &'life0 self, payload: &'life1 MessagePayload, msg: T ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where T: Serialize + Send + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a report message to a specified destination.

source

fn forward_by_relay<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload, relay: MessageRelay ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Forward a payload message by relay. It just create a new payload, cloned data, resigned with session and send

source

fn forward_payload<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload, next_hop: Option<Did> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Forward a payload message, with the next hop inferred by the DHT.

source

fn reset_destination<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload, next_hop: Did ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reset the destination to a secp DID.

Object Safety§

This trait is not object safe.

Implementors§