[−][src]Trait lib3h::transport::transport_trait::Transport
Represents a pool of connections to remote nodes.
Methods are for synchronous processing.
Otherwise use post()
& process()
for aysnchronous processing.
Required methods
fn connect(&mut self, uri: &Url) -> TransportResult<ConnectionId>
establish a connection to a remote node
fn close(&mut self, id: &ConnectionIdRef) -> TransportResult<()>
close an existing open connection
fn close_all(&mut self) -> TransportResult<()>
close all existing open connections
fn send(
&mut self,
id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
&mut self,
id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
send a payload to remote nodes
fn send_all(&mut self, payload: &[u8]) -> TransportResult<()>
send a payload to all remote nodes
fn bind(&mut self, url: &Url) -> TransportResult<Url>
Bind to a network interface Return the advertise
fn post(&mut self, command: TransportCommand) -> TransportResult<()>
Send a command for later processing
fn process(&mut self) -> TransportResult<(DidWork, Vec<TransportEvent>)>
Process TransportProtocol messages received from owner and also poll TransportEvents received from the network.
fn connection_id_list(&self) -> TransportResult<Vec<ConnectionId>>
get a list of all open transport ids
fn get_uri(&self, id: &ConnectionIdRef) -> Option<Url>
get uri from a connectionId
Implementors
impl Transport for TransportMemory
[src]
Compose Transport
fn connection_id_list(&self) -> TransportResult<Vec<ConnectionId>>
[src]
Get list of known connectionIds
fn get_uri(&self, id: &ConnectionIdRef) -> Option<Url>
[src]
get uri from a connectionId
fn connect(&mut self, uri: &Url) -> TransportResult<ConnectionId>
[src]
Connect to another node's "bind". Get server from the uri and connect to it with a new connectionId for ourself.
fn close(&mut self, id: &ConnectionIdRef) -> TransportResult<()>
[src]
Notify server on that connectionId that we are closing connection and clear that connectionId.
fn close_all(&mut self) -> TransportResult<()>
[src]
Close all known connectionIds
fn send(
&mut self,
id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
[src]
&mut self,
id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
Send payload to known connectionIds in id_list
fn send_all(&mut self, payload: &[u8]) -> TransportResult<()>
[src]
Send to all known connectionIds
fn post(&mut self, command: TransportCommand) -> TransportResult<()>
[src]
Add Command to inbox
fn bind(&mut self, uri: &Url) -> TransportResult<Url>
[src]
Create a new server inbox for myself
fn process(&mut self) -> TransportResult<(DidWork, Vec<TransportEvent>)>
[src]
Process my TransportCommand inbox and all my server inboxes
impl<T: Transport> Transport for TransportCrypto<T>
[src]
Implement Transport trait by composing inner transport TODO #177 - passthrough for now
fn connect(&mut self, uri: &Url) -> TransportResult<ConnectionId>
[src]
fn close(&mut self, id: &ConnectionIdRef) -> TransportResult<()>
[src]
fn close_all(&mut self) -> TransportResult<()>
[src]
fn send(
&mut self,
id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
[src]
&mut self,
id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
fn send_all(&mut self, payload: &[u8]) -> TransportResult<()>
[src]
fn bind(&mut self, url: &Url) -> TransportResult<Url>
[src]
fn post(&mut self, command: TransportCommand) -> TransportResult<()>
[src]
fn process(&mut self) -> TransportResult<(DidWork, Vec<TransportEvent>)>
[src]
fn connection_id_list(&self) -> TransportResult<Vec<ConnectionId>>
[src]
fn get_uri(&self, id: &ConnectionIdRef) -> Option<Url>
[src]
impl<T: Transport, D: Dht> Transport for P2pGateway<T, D>
[src]
Compose Transport
fn connect(&mut self, uri: &Url) -> TransportResult<ConnectionId>
[src]
fn close(&mut self, id: &ConnectionIdRef) -> TransportResult<()>
[src]
fn close_all(&mut self) -> TransportResult<()>
[src]
fn send(
&mut self,
dht_id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
[src]
&mut self,
dht_id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
id_list =
- Network : transportId
- space : agentId
fn send_all(&mut self, payload: &[u8]) -> TransportResult<()>
[src]
fn bind(&mut self, url: &Url) -> TransportResult<Url>
[src]
fn post(&mut self, command: TransportCommand) -> TransportResult<()>
[src]
fn process(&mut self) -> TransportResult<(DidWork, Vec<TransportEvent>)>
[src]
Handle TransportEvents directly
fn connection_id_list(&self) -> TransportResult<Vec<ConnectionId>>
[src]
A Gateway uses its inner_dht's peerData.peer_address as connectionId
fn get_uri(&self, id: &ConnectionIdRef) -> Option<Url>
[src]
TODO: return a higher-level uri instead
impl<T: Read + Write + Debug> Transport for TransportWss<T>
[src]
fn connect(&mut self, uri: &Url) -> TransportResult<ConnectionId>
[src]
connect to a remote websocket service
fn close(&mut self, id: &ConnectionIdRef) -> TransportResult<()>
[src]
close a currently tracked connection
fn close_all(&mut self) -> TransportResult<()>
[src]
close all currently tracked connections
fn connection_id_list(&self) -> TransportResult<Vec<ConnectionId>>
[src]
get a list of all open transport ids
fn get_uri(&self, id: &ConnectionIdRef) -> Option<Url>
[src]
get uri from a connectionId
fn post(&mut self, command: TransportCommand) -> TransportResult<()>
[src]
fn process(&mut self) -> TransportResult<(DidWork, Vec<TransportEvent>)>
[src]
this should be called frequently on the event loop looks for incoming messages or processes ping/pong/close events etc
fn send(
&mut self,
id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
[src]
&mut self,
id_list: &[&ConnectionIdRef],
payload: &[u8]
) -> TransportResult<()>
send a message to one or more remote connected nodes
fn send_all(&mut self, payload: &[u8]) -> TransportResult<()>
[src]
send a message to all remote nodes