[−][src]Trait interledger::service::OutgoingService
Core service trait for sending OutgoingRequests that asynchronously returns an ILP Fulfill or Reject packet.
Associated Types
Loading content...Required methods
fn send_request(&mut self, request: OutgoingRequest<A>) -> Self::Future
Provided methods
fn wrap<F, R>(self, f: F) -> WrappedService<F, Self, A> where
F: Fn(OutgoingRequest<A>, Self) -> R,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
Self: Clone,
F: Fn(OutgoingRequest<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> OutgoingService<A> for Instrumented<IO> where
A: Account,
IO: OutgoingService<A> + Clone,
[src]
A: Account,
IO: OutgoingService<A> + Clone,
type Future = Instrumented<<IO as OutgoingService<A>>::Future>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> <Instrumented<IO> as OutgoingService<A>>::Future
[src]
&mut self,
request: OutgoingRequest<A>
) -> <Instrumented<IO> as OutgoingService<A>>::Future
Implementors
impl<F, A, B> OutgoingService<A> for ServiceFn<F, A> where
A: Account,
B: IntoFuture<Item = Fulfill, Error = Reject>,
F: FnMut(OutgoingRequest<A>) -> B,
<B as IntoFuture>::Future: Send,
<B as IntoFuture>::Future: 'static,
[src]
A: Account,
B: IntoFuture<Item = Fulfill, Error = Reject>,
F: FnMut(OutgoingRequest<A>) -> B,
<B as IntoFuture>::Future: Send,
<B as IntoFuture>::Future: 'static,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> <ServiceFn<F, A> as OutgoingService<A>>::Future
[src]
&mut self,
request: OutgoingRequest<A>
) -> <ServiceFn<F, A> as OutgoingService<A>>::Future
impl<F, IO, A, R> OutgoingService<A> for WrappedService<F, IO, A> where
A: Account,
F: Fn(OutgoingRequest<A>, IO) -> R,
IO: OutgoingService<A> + Clone,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
[src]
A: Account,
F: Fn(OutgoingRequest<A>, IO) -> R,
IO: OutgoingService<A> + Clone,
R: Future<Item = Fulfill, Error = Reject> + Send + 'static,
type Future = R
fn send_request(&mut self, request: OutgoingRequest<A>) -> R
[src]
impl<I, O, A> OutgoingService<A> for BtpService<I, O, A> where
A: BtpAccount + 'static,
O: OutgoingService<A> + Clone + Send + 'static,
[src]
A: BtpAccount + 'static,
O: OutgoingService<A> + Clone + Send + 'static,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> <BtpService<I, O, A> as OutgoingService<A>>::Future
[src]
&mut self,
request: OutgoingRequest<A>
) -> <BtpService<I, O, A> as OutgoingService<A>>::Future
Send an outgoing request to one of the open connections.
If there is no open connection for the Account specified in request.to
, the
request will be passed through to the next
handler.
impl<O, A> OutgoingService<A> for BtpOutgoingService<O, A> where
A: BtpAccount + 'static,
O: OutgoingService<A> + Clone,
[src]
A: BtpAccount + 'static,
O: OutgoingService<A> + Clone,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> <BtpOutgoingService<O, A> as OutgoingService<A>>::Future
[src]
&mut self,
request: OutgoingRequest<A>
) -> <BtpOutgoingService<O, A> as OutgoingService<A>>::Future
Send an outgoing request to one of the open connections.
If there is no open connection for the Account specified in request.to
, the
request will be passed through to the next
handler.
impl<O, A> OutgoingService<A> for ExpiryShortenerService<O> where
A: RoundTripTimeAccount,
O: OutgoingService<A>,
[src]
A: RoundTripTimeAccount,
O: OutgoingService<A>,
type Future = <O as OutgoingService<A>>::Future
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> <ExpiryShortenerService<O> as OutgoingService<A>>::Future
[src]
&mut self,
request: OutgoingRequest<A>
) -> <ExpiryShortenerService<O> as OutgoingService<A>>::Future
On send request:
- Get the sender and receiver's roundtrip time (default 1000ms)
- Reduce the packet's expiry by that amount
- Ensure that the packet expiry does not exceed the maximum expiry duration
- Forward the request
impl<O, S, A> OutgoingService<A> for ValidatorService<O, S, A> where
A: Account,
O: OutgoingService<A>,
S: AddressStore,
[src]
A: Account,
O: OutgoingService<A>,
S: AddressStore,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> <ValidatorService<O, S, A> as OutgoingService<A>>::Future
[src]
&mut self,
request: OutgoingRequest<A>
) -> <ValidatorService<O, S, A> as OutgoingService<A>>::Future
On sending a request:
- If the outgoing packet has expired, return a reject with the appropriate ErrorCode
- Tries to forward the request
- If no response is received before the prepare packet's expiration, it assumes that the outgoing request has timed out.
- If no timeout occurred, but still errored it will just return the reject
- If the forwarding is successful, it should receive a fulfill packet. Depending on if the hash of the fulfillment condition inside the fulfill is a preimage of the condition of the prepare:
- return the fulfill if it matches
- otherwise reject
impl<S, O, A> OutgoingService<A> for HttpClientService<S, O, A> where
A: HttpAccount,
O: OutgoingService<A>,
S: AddressStore + HttpStore,
[src]
A: HttpAccount,
O: OutgoingService<A>,
S: AddressStore + HttpStore,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> <HttpClientService<S, O, A> as OutgoingService<A>>::Future
[src]
&mut self,
request: OutgoingRequest<A>
) -> <HttpClientService<S, O, A> as OutgoingService<A>>::Future
Send an OutgoingRequest to a peer that implements the ILP-Over-HTTP.
impl<S, O, A> OutgoingService<A> for BalanceService<S, O, A> where
A: SettlementAccount + 'static,
O: OutgoingService<A> + Send + Clone + 'static,
S: AddressStore + BalanceStore<Account = A> + SettlementStore<Account = A> + Clone + Send + Sync + 'static,
[src]
A: SettlementAccount + 'static,
O: OutgoingService<A> + Send + Clone + 'static,
S: AddressStore + BalanceStore<Account = A> + SettlementStore<Account = A> + Clone + Send + Sync + 'static,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
[src]
&mut self,
request: OutgoingRequest<A>
) -> Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
On send message:
- Calls
store.update_balances_for_prepare
with the prepare. If it fails, it replies with a reject - Tries to forward the request:
- If it returns a fullfil, calls
store.update_balances_for_fulfill
and replies with the fulfill INDEPENDENTLY of if the call suceeds or fails. This makes asendMoney
call if the fulfill puts the account's balance over thesettle_threshold
- if it returns an reject calls
store.update_balances_for_reject
and replies with the fulfill INDEPENDENTLY of if the call suceeds or fails
- If it returns a fullfil, calls
impl<S, O, A> OutgoingService<A> for ExchangeRateService<S, O, A> where
A: Account + Sync + 'static,
O: OutgoingService<A> + Send + Clone + 'static,
S: AddressStore + ExchangeRateStore + Clone + Send + Sync + 'static,
[src]
A: Account + Sync + 'static,
O: OutgoingService<A> + Send + Clone + 'static,
S: AddressStore + ExchangeRateStore + Clone + Send + Sync + 'static,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
[src]
&mut self,
request: OutgoingRequest<A>
) -> Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
On send request:
- If the prepare packet's amount is 0, it just forwards
- Retrieves the exchange rate from the store (the store independently is responsible for polling the rates)
- return reject if the call to the store fails
- Calculates the exchange rate AND scales it up/down depending on how many decimals each asset requires
- Updates the amount in the prepare packet and forwards it
impl<S, O, A> OutgoingService<A> for StreamReceiverService<S, O, A> where
A: Account,
O: OutgoingService<A>,
S: StreamNotificationsStore + Send + Sync + 'static + Clone,
[src]
A: Account,
O: OutgoingService<A>,
S: StreamNotificationsStore + Send + Sync + 'static + Clone,
type Future = Box<dyn Future<Error = Reject, Item = Fulfill> + 'static + Send>
fn send_request(
&mut self,
request: OutgoingRequest<A>
) -> <StreamReceiverService<S, O, A> as OutgoingService<A>>::Future
[src]
&mut self,
request: OutgoingRequest<A>
) -> <StreamReceiverService<S, O, A> as OutgoingService<A>>::Future
Try fulfilling the request if it is for this STREAM server or pass it to the next outgoing handler if not.