[][src]Struct lib3h::gateway::P2pGateway

pub struct P2pGateway<T: Transport, D: Dht> { /* fields omitted */ }

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]

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]

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_entry_address_list(&self) -> Vec<&Address>[src]

Entry

fn post(&mut self, cmd: DhtCommand) -> Lib3hResult<()>[src]

Processing

impl<T: Transport, D: Dht> Transport for P2pGateway<T, D>[src]

Compose Transport

fn send(
    &mut self,
    dht_id_list: &[&ConnectionIdRef],
    payload: &[u8]
) -> TransportResult<()>
[src]

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

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]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self