Trait mpc_relay_client::NetworkTransport
source · pub trait NetworkTransport {
// Required methods
fn public_key(&self) -> &[u8] ⓘ;
fn connect<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn connect_peer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
public_key: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn send_json<'life0, 'life1, 'life2, 'async_trait, S>(
&'life0 mut self,
public_key: &'life1 [u8],
payload: &'life2 S,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
S: Serialize + Send + Sync + 'async_trait + ?Sized,
Self: 'async_trait;
fn send_blob<'life0, 'life1, 'async_trait>(
&'life0 mut self,
public_key: &'life1 [u8],
payload: Vec<u8, Global>,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn new_session<'life0, 'async_trait>(
&'life0 mut self,
participant_keys: Vec<Vec<u8, Global>, Global>,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn register_connection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
session_id: &'life1 Uuid,
peer_key: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn close_session<'life0, 'async_trait>(
&'life0 mut self,
session_id: Uuid
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn broadcast_json<'life0, 'life1, 'life2, 'life3, 'async_trait, S>(
&'life0 mut self,
session_id: &'life1 Uuid,
recipient_public_keys: &'life2 [Vec<u8, Global>],
payload: &'life3 S
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
S: Serialize + Send + Sync + 'async_trait + ?Sized,
Self: 'async_trait;
fn broadcast_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
session_id: &'life1 Uuid,
recipient_public_keys: &'life2 [Vec<u8, Global>],
payload: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
}
Expand description
Trait for network clients.
Required Methods§
sourcefn public_key(&self) -> &[u8] ⓘ
fn public_key(&self) -> &[u8] ⓘ
Public key for this client.
sourcefn connect<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn connect<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Perform initial handshake with the server.
sourcefn connect_peer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
public_key: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn connect_peer<'life0, 'life1, 'async_trait>( &'life0 mut self, public_key: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Handshake with a peer.
Peer already exists error is returned if this client is already connecting to the peer.
sourcefn send_json<'life0, 'life1, 'life2, 'async_trait, S>(
&'life0 mut self,
public_key: &'life1 [u8],
payload: &'life2 S,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
S: Serialize + Send + Sync + 'async_trait + ?Sized,
Self: 'async_trait,
fn send_json<'life0, 'life1, 'life2, 'async_trait, S>( &'life0 mut self, public_key: &'life1 [u8], payload: &'life2 S, session_id: Option<Uuid> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, S: Serialize + Send + Sync + 'async_trait + ?Sized, Self: 'async_trait,
Send a JSON message to a peer.
sourcefn send_blob<'life0, 'life1, 'async_trait>(
&'life0 mut self,
public_key: &'life1 [u8],
payload: Vec<u8, Global>,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn send_blob<'life0, 'life1, 'async_trait>( &'life0 mut self, public_key: &'life1 [u8], payload: Vec<u8, Global>, session_id: Option<Uuid> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Send a binary message to a peer.
sourcefn new_session<'life0, 'async_trait>(
&'life0 mut self,
participant_keys: Vec<Vec<u8, Global>, Global>,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn new_session<'life0, 'async_trait>( &'life0 mut self, participant_keys: Vec<Vec<u8, Global>, Global>, session_id: Option<Uuid> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Create a new session.
Do not include the public key of the initiator for the new session; it is automatically included as the session owner.
sourcefn register_connection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
session_id: &'life1 Uuid,
peer_key: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn register_connection<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, session_id: &'life1 Uuid, peer_key: &'life2 [u8] ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,
Register a peer connection in a session.
sourcefn close_session<'life0, 'async_trait>(
&'life0 mut self,
session_id: Uuid
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn close_session<'life0, 'async_trait>( &'life0 mut self, session_id: Uuid ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Close a session.
sourcefn broadcast_json<'life0, 'life1, 'life2, 'life3, 'async_trait, S>(
&'life0 mut self,
session_id: &'life1 Uuid,
recipient_public_keys: &'life2 [Vec<u8, Global>],
payload: &'life3 S
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
S: Serialize + Send + Sync + 'async_trait + ?Sized,
Self: 'async_trait,
fn broadcast_json<'life0, 'life1, 'life2, 'life3, 'async_trait, S>( &'life0 mut self, session_id: &'life1 Uuid, recipient_public_keys: &'life2 [Vec<u8, Global>], payload: &'life3 S ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, S: Serialize + Send + Sync + 'async_trait + ?Sized, Self: 'async_trait,
Broadcast a JSON message in the context of a session.
sourcefn broadcast_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
session_id: &'life1 Uuid,
recipient_public_keys: &'life2 [Vec<u8, Global>],
payload: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn broadcast_blob<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, session_id: &'life1 Uuid, recipient_public_keys: &'life2 [Vec<u8, Global>], payload: Vec<u8, Global> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,
Broadcast a binary message in the context of a session.