[][src]Struct interledger_service_util::MaxPacketAmountService

pub struct MaxPacketAmountService<I, S> { /* fields omitted */ }

MaxPacketAmount Service

This service is used by nodes to limit the maximum value of each packet they are willing to forward. Nodes may limit the packet amount for a variety of reasons:

  • Liquidity: a node operator may not way to allow a single high-value packet to tie up a large portion of its liquidity at once (especially because they do not know whether the packet will be fulfilled or rejected)
  • Security: each packet carries some risk, due to the possibility that a node's failure to pass back the fulfillment within the available time window would cause that node to lose money. Keeping the value of each individual packet low may help reduce the impact of such a failure Signaling: nodes SHOULD set the maximum packet amount lower than the maximum amount in flight (also known as the payment or money bandwidth). T04: Insufficient Liquidity errors do not communicate to the sender how much they can send, largely because the "available liquidity" may be time based or based on the rate of other payments going through and thus difficult to communicate effectively. In contrast, the F08: Amount Too Large error conveys the maximum back to the sender, because this limit is assumed to be a static value, and alllows sender-side software like STREAM implementations to respond accordingly. Therefore, setting the maximum packet amount lower than the total money bandwidth allows client implementations to quickly adjust their packet amounts to appropriate levels. Requires a MaxPacketAmountAccount and no store.

Methods

impl<I, S> MaxPacketAmountService<I, S>[src]

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

Trait Implementations

impl<I: Clone, S: Clone> Clone for MaxPacketAmountService<I, S>[src]

impl<I, S, A> IncomingService<A> for MaxPacketAmountService<I, S> where
    I: IncomingService<A>,
    S: AddressStore,
    A: MaxPacketAmountAccount
[src]

type Future = BoxedIlpFuture

fn handle_request(&mut self, request: IncomingRequest<A>) -> Self::Future[src]

On receive request:

  1. if request.prepare.amount <= request.from.max_packet_amount forward the request, else error

Auto Trait Implementations

impl<I, S> Send for MaxPacketAmountService<I, S> where
    I: Send,
    S: Send

impl<I, S> Sync for MaxPacketAmountService<I, S> where
    I: Sync,
    S: Sync

impl<I, S> Unpin for MaxPacketAmountService<I, S> where
    I: Unpin,
    S: Unpin

impl<I, S> UnwindSafe for MaxPacketAmountService<I, S> where
    I: UnwindSafe,
    S: UnwindSafe

impl<I, S> RefUnwindSafe for MaxPacketAmountService<I, S> where
    I: RefUnwindSafe,
    S: RefUnwindSafe

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<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

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

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