[−][src]Struct interledger_service_util::MaxPacketAmountService
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, theF08: 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 aMaxPacketAmountAccount
and no store.
Methods
impl<I, S> MaxPacketAmountService<I, S>
[src]
Trait Implementations
impl<I: Clone, S: Clone> Clone for MaxPacketAmountService<I, S>
[src]
fn clone(&self) -> MaxPacketAmountService<I, S>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<I, S, A> IncomingService<A> for MaxPacketAmountService<I, S> where
I: IncomingService<A>,
S: AddressStore,
A: MaxPacketAmountAccount,
[src]
I: IncomingService<A>,
S: AddressStore,
A: MaxPacketAmountAccount,
type Future = BoxedIlpFuture
fn handle_request(&mut self, request: IncomingRequest<A>) -> Self::Future
[src]
On receive request:
- if request.prepare.amount <= request.from.max_packet_amount forward the request, else error
fn wrap<F, R>(self, f: F) -> WrappedService<F, Self, A> where
F: Fn(IncomingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone,
[src]
F: Fn(IncomingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone,
Auto Trait Implementations
impl<I, S> Send for MaxPacketAmountService<I, S> where
I: Send,
S: Send,
I: Send,
S: Send,
impl<I, S> Sync for MaxPacketAmountService<I, S> where
I: Sync,
S: Sync,
I: Sync,
S: Sync,
impl<I, S> Unpin for MaxPacketAmountService<I, S> where
I: Unpin,
S: Unpin,
I: Unpin,
S: Unpin,
impl<I, S> UnwindSafe for MaxPacketAmountService<I, S> where
I: UnwindSafe,
S: UnwindSafe,
I: UnwindSafe,
S: UnwindSafe,
impl<I, S> RefUnwindSafe for MaxPacketAmountService<I, S> where
I: RefUnwindSafe,
S: RefUnwindSafe,
I: RefUnwindSafe,
S: RefUnwindSafe,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut 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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
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
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,