[−][src]Struct lib3h::gateway::P2pGateway
Gateway to a P2P network.
Combines a transport and a DHT.
Tracks distributed data for that P2P network in a DHT.
P2pGateway should not post() & process()
its inner transport but call it synchrounously.
Methods
impl<T: Transport, D: Dht> P2pGateway<T, D>
[src]
Public interface
pub fn identifier(&self) -> &str
[src]
This Gateway's identifier
pub fn post_dht(&mut self, cmd: DhtCommand) -> Lib3hResult<()>
[src]
TODO #179 - using an explicit post for dht because of dumb rust compiler
impl<T: Transport, D: Dht> P2pGateway<T, D>
[src]
any Transport Constructor
pub fn new(
identifier: &str,
inner_transport: Rc<RefCell<T>>,
dht_factory: DhtFactory<D>,
dht_config: &DhtConfig
) -> Self
[src]
identifier: &str,
inner_transport: Rc<RefCell<T>>,
dht_factory: DhtFactory<D>,
dht_config: &DhtConfig
) -> Self
Constructor Bind and set advertise on construction by using the name as URL.
impl<T: Transport, D: Dht> P2pGateway<P2pGateway<T, D>, D>
[src]
P2pGateway Constructor
pub fn new_with_space(
network_gateway: Rc<RefCell<P2pGateway<T, D>>>,
space_address: &Address,
dht_factory: DhtFactory<D>,
dht_config: &DhtConfig
) -> Self
[src]
network_gateway: Rc<RefCell<P2pGateway<T, D>>>,
space_address: &Address,
dht_factory: DhtFactory<D>,
dht_config: &DhtConfig
) -> Self
Constructors
Trait Implementations
impl<T: Transport, D: Dht> Dht for P2pGateway<T, D>
[src]
Compose DHT
fn get_peer_list(&self) -> Vec<PeerData>
[src]
Peer info
fn get_peer(&self, peer_address: &str) -> Option<PeerData>
[src]
fn this_peer(&self) -> &PeerData
[src]
fn get_entry_address_list(&self) -> Vec<&Address>
[src]
Entry
fn get_aspects_of(&self, entry_address: &Address) -> Option<Vec<Address>>
[src]
fn post(&mut self, cmd: DhtCommand) -> Lib3hResult<()>
[src]
Processing
fn process(&mut self) -> Lib3hResult<(DidWork, Vec<DhtEvent>)>
[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
Auto Trait Implementations
impl<T, D> !Sync for P2pGateway<T, D>
impl<T, D> !Send for P2pGateway<T, D>
impl<T, D> Unpin for P2pGateway<T, D> where
D: Unpin,
D: Unpin,
impl<T, D> !RefUnwindSafe for P2pGateway<T, D>
impl<T, D> !UnwindSafe for P2pGateway<T, D>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self