[−][src]Trait interledger::service::IncomingService
Core service trait for handling IncomingRequests that asynchronously returns an ILP Fulfill or Reject packet.
Associated Types
Loading content...Required methods
fn handle_request(&mut self, request: IncomingRequest<A>) -> Self::Future
Provided methods
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,
F: Fn(IncomingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone,
Wrap the given service such that the provided function will be called to handle each request. That function can return immediately, modify the request before passing it on, and/or handle the result of calling the inner service.
Implementations on Foreign Types
impl<IO, A> IncomingService<A> for Instrumented<IO> where
A: Account,
IO: IncomingService<A> + Clone,
[src]
A: Account,
IO: IncomingService<A> + Clone,
type Future = Instrumented<<IO as IncomingService<A>>::Future>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <Instrumented<IO> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <Instrumented<IO> as IncomingService<A>>::Future
Implementors
impl<F, A, B> IncomingService<A> for ServiceFn<F, A> where
A: Account,
B: IntoFuture<Item = Fulfill, Error = Reject>,
F: FnMut(IncomingRequest<A>) -> B,
<B as IntoFuture>::Future: Send,
<B as IntoFuture>::Future: 'static,
[src]
A: Account,
B: IntoFuture<Item = Fulfill, Error = Reject>,
F: FnMut(IncomingRequest<A>) -> B,
<B as IntoFuture>::Future: Send,
<B as IntoFuture>::Future: 'static,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <ServiceFn<F, A> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <ServiceFn<F, A> as IncomingService<A>>::Future
impl<F, IO, A, R> IncomingService<A> for WrappedService<F, IO, A> where
A: Account,
F: Fn(IncomingRequest<A>, IO) -> R,
IO: IncomingService<A> + Clone,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
[src]
A: Account,
F: Fn(IncomingRequest<A>, IO) -> R,
IO: IncomingService<A> + Clone,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
type Future = R
fn handle_request(&mut self, request: IncomingRequest<A>) -> R
[src]
impl<I, A> IncomingService<A> for IldcpService<I, A> where
A: Account,
I: IncomingService<A>,
[src]
A: Account,
I: IncomingService<A>,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <IldcpService<I, A> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <IldcpService<I, A> as IncomingService<A>>::Future
impl<I, A> IncomingService<A> for SettlementMessageService<I, A> where
A: SettlementAccount + Account,
I: IncomingService<A> + Send,
[src]
A: SettlementAccount + Account,
I: IncomingService<A> + Send,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <SettlementMessageService<I, A> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <SettlementMessageService<I, A> as IncomingService<A>>::Future
impl<I, O, S, A> IncomingService<A> for CcpRouteManager<I, O, S, A> where
A: CcpRoutingAccount + Send + Sync + 'static,
I: IncomingService<A> + Clone + Send + Sync + 'static,
O: OutgoingService<A> + Clone + Send + Sync + 'static,
S: AddressStore + RouteManagerStore<Account = A> + Clone + Send + Sync + 'static,
[src]
A: CcpRoutingAccount + Send + Sync + 'static,
I: IncomingService<A> + Clone + Send + Sync + 'static,
O: OutgoingService<A> + Clone + Send + Sync + 'static,
S: AddressStore + RouteManagerStore<Account = A> + Clone + Send + Sync + 'static,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <CcpRouteManager<I, O, S, A> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <CcpRouteManager<I, O, S, A> as IncomingService<A>>::Future
Handle the IncomingRequest if it is a CCP protocol message or pass it on to the next handler if not
impl<I, S, A> IncomingService<A> for EchoService<I, S, A> where
A: Account,
I: IncomingService<A>,
S: AddressStore,
[src]
A: Account,
I: IncomingService<A>,
S: AddressStore,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <EchoService<I, S, A> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <EchoService<I, S, A> as IncomingService<A>>::Future
impl<I, S, A> IncomingService<A> for MaxPacketAmountService<I, S> where
A: MaxPacketAmountAccount,
I: IncomingService<A>,
S: AddressStore,
[src]
A: MaxPacketAmountAccount,
I: IncomingService<A>,
S: AddressStore,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <MaxPacketAmountService<I, S> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <MaxPacketAmountService<I, S> as IncomingService<A>>::Future
On receive request:
- if request.prepare.amount <= request.from.max_packet_amount forward the request, else error
impl<I, S, A> IncomingService<A> for ValidatorService<I, S, A> where
A: Account,
I: IncomingService<A>,
S: AddressStore,
[src]
A: Account,
I: IncomingService<A>,
S: AddressStore,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <ValidatorService<I, S, A> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <ValidatorService<I, S, A> as IncomingService<A>>::Future
On receiving a request:
- If the prepare packet in the request is not expired, forward it, otherwise return a reject
impl<S, I, A> IncomingService<A> for RateLimitService<S, I, A> where
A: RateLimitAccount + Sync + 'static,
I: IncomingService<A> + Clone + Send + Sync + 'static,
S: AddressStore + RateLimitStore<Account = A> + Clone + Send + Sync + 'static,
[src]
A: RateLimitAccount + Sync + 'static,
I: IncomingService<A> + Clone + Send + Sync + 'static,
S: AddressStore + RateLimitStore<Account = A> + Clone + Send + Sync + 'static,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<A>
) -> <RateLimitService<S, I, A> as IncomingService<A>>::Future
[src]
&mut self,
request: IncomingRequest<A>
) -> <RateLimitService<S, I, A> as IncomingService<A>>::Future
On receiving a request:
- Apply rate limit based on the sender of the request and the amount in the prepare packet in the request
- If no limits were hit forward the request
- If it succeeds, OK
- If the request forwarding failed, the client should not be charged towards their throughput limit, so they are refunded, and return a reject
- If the limit was hit, return a reject with the appropriate ErrorCode.
impl<S, O> IncomingService<<S as AccountStore>::Account> for Router<S, O> where
O: OutgoingService<<S as AccountStore>::Account> + Clone + Send + 'static,
S: AddressStore + RouterStore,
[src]
O: OutgoingService<<S as AccountStore>::Account> + Clone + Send + 'static,
S: AddressStore + RouterStore,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn handle_request(
&mut self,
request: IncomingRequest<<S as AccountStore>::Account>
) -> <Router<S, O> as IncomingService<<S as AccountStore>::Account>>::Future
[src]
&mut self,
request: IncomingRequest<<S as AccountStore>::Account>
) -> <Router<S, O> as IncomingService<<S as AccountStore>::Account>>::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)