[][src]Struct interledger_router::Router

pub struct Router<S, O> { /* fields omitted */ }

Interledger Router

The Router implements an incoming service and includes an outgoing service. It determines the next account to forward to and passes it on. Both incoming and outgoing services can respond to requests but many just pass the request on. The Router requires a RouterStore, which keeps track of the entire routing table. Once the Router receives a Prepare, it checks its destination and if it finds it in the routing table

The router implements the IncomingService trait and uses the routing table to determine the to (or "next hop") Account for the given request.

Note that the router does not:

  • apply exchange rates or fees to the Prepare packet
  • adjust account balances
  • reduce the Prepare packet's expiry

That is done by OutgoingServices.


impl<S, O> Router<S, O> where
    S: RouterStore,
    O: OutgoingService<S::Account>, 

pub fn new(store: S, next: O) -> Self[src]

Trait Implementations

impl<S: Clone, O: Clone> Clone for Router<S, O>[src]

impl<S, O> IncomingService<<S as AccountStore>::Account> for Router<S, O> where
    S: AddressStore + RouterStore,
    O: OutgoingService<S::Account> + Clone + Send + 'static, 

type Future = BoxedIlpFuture

fn handle_request(
    &mut self,
    request: IncomingRequest<S::Account>
) -> Self::Future

Figures out the next node to pass the received Prepare packet to.

Firstly, it checks if there is a direct path for that account and uses that. If not it scans through the routing table and checks if the route prefix matches the prepare packet's destination or if it's a catch-all address (i.e. empty prefix)

Auto Trait Implementations

impl<S, O> Send for Router<S, O> where
    O: Send,
    S: Send

impl<S, O> Sync for Router<S, O> where
    O: Sync,
    S: Sync

impl<S, O> Unpin for Router<S, O> where
    O: Unpin,
    S: Unpin

impl<S, O> UnwindSafe for Router<S, O> where
    O: UnwindSafe,
    S: UnwindSafe

impl<S, O> RefUnwindSafe for Router<S, O> where
    O: RefUnwindSafe,
    S: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 

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

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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