Trait rings_node::prelude::PayloadSender
source · pub trait PayloadSender<T>where
T: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,{
// Required methods
fn session_sk(&self) -> &SessionSk;
fn dht(&self) -> Arc<PeerRing, Global>;
fn do_send_payload<'life0, 'async_trait>(
&'life0 self,
did: Did,
payload: MessagePayload<T>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided methods
fn infer_next_hop(
&self,
next_hop: Option<Did>,
destination: Did
) -> Result<Did, Error> { ... }
fn send_payload<'life0, 'async_trait>(
&'life0 self,
payload: MessagePayload<T>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn send_message<'life0, 'async_trait>(
&'life0 self,
msg: T,
destination: Did
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn send_message_by_hop<'life0, 'async_trait>(
&'life0 self,
msg: T,
destination: Did,
next_hop: Did
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn send_direct_message<'life0, 'async_trait>(
&'life0 self,
msg: T,
destination: Did
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: Sync + 'async_trait { ... }
fn send_report_message<'life0, 'life1, 'async_trait>(
&'life0 self,
payload: &'life1 MessagePayload<T>,
msg: T
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn forward_by_relay<'life0, 'life1, 'async_trait>(
&'life0 self,
payload: &'life1 MessagePayload<T>,
relay: MessageRelay
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn forward_payload<'life0, 'life1, 'async_trait>(
&'life0 self,
payload: &'life1 MessagePayload<T>,
next_hop: Option<Did>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
fn reset_destination<'life0, 'life1, 'async_trait>(
&'life0 self,
payload: &'life1 MessagePayload<T>,
next_hop: Did
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait { ... }
}
Expand description
Trait of PayloadSender
Required Methods§
sourcefn session_sk(&self) -> &SessionSk
fn session_sk(&self) -> &SessionSk
Get the session sk
Provided Methods§
sourcefn infer_next_hop(
&self,
next_hop: Option<Did>,
destination: Did
) -> Result<Did, Error>
fn infer_next_hop( &self, next_hop: Option<Did>, destination: Did ) -> Result<Did, Error>
Infer the next hop for a message by calling dht.find_successor()
.
sourcefn send_payload<'life0, 'async_trait>(
&'life0 self,
payload: MessagePayload<T>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn send_payload<'life0, 'async_trait>( &'life0 self, payload: MessagePayload<T> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
Alias for do_send_payload
that sets the next hop to payload.relay.next_hop
.
sourcefn send_message<'life0, 'async_trait>(
&'life0 self,
msg: T,
destination: Did
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn send_message<'life0, 'async_trait>( &'life0 self, msg: T, destination: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
Send a message to a specified destination.
sourcefn send_message_by_hop<'life0, 'async_trait>(
&'life0 self,
msg: T,
destination: Did,
next_hop: Did
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn send_message_by_hop<'life0, 'async_trait>( &'life0 self, msg: T, destination: Did, next_hop: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
Send a message to a specified destination by specified next hop.
sourcefn send_direct_message<'life0, 'async_trait>(
&'life0 self,
msg: T,
destination: Did
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn send_direct_message<'life0, 'async_trait>( &'life0 self, msg: T, destination: Did ) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
Send a direct message to a specified destination.
sourcefn send_report_message<'life0, 'life1, 'async_trait>(
&'life0 self,
payload: &'life1 MessagePayload<T>,
msg: T
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn send_report_message<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload<T>, msg: T ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,
Send a report message to a specified destination.
sourcefn forward_by_relay<'life0, 'life1, 'async_trait>(
&'life0 self,
payload: &'life1 MessagePayload<T>,
relay: MessageRelay
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn forward_by_relay<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload<T>, relay: MessageRelay ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,
Forward a payload message by relay. It just create a new payload, cloned data, resigned with session and send
sourcefn forward_payload<'life0, 'life1, 'async_trait>(
&'life0 self,
payload: &'life1 MessagePayload<T>,
next_hop: Option<Did>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn forward_payload<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload<T>, next_hop: Option<Did> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,
Forward a payload message, with the next hop inferred by the DHT.
sourcefn reset_destination<'life0, 'life1, 'async_trait>(
&'life0 self,
payload: &'life1 MessagePayload<T>,
next_hop: Did
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn reset_destination<'life0, 'life1, 'async_trait>( &'life0 self, payload: &'life1 MessagePayload<T>, next_hop: Did ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,
Reset the destination to a secp DID.