[][src]Struct interledger_service_util::BalanceService

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

Balance Service

Responsible for managing the balances of the account and the interaction with the Settlement Engine

Requires an Account and a BalanceStore

Methods

impl<S, O, A> BalanceService<S, O, A> where
    S: AddressStore + BalanceStore<Account = A> + SettlementStore<Account = A>,
    O: OutgoingService<A>,
    A: Account + SettlementAccount
[src]

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

Trait Implementations

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

impl<S, O, A> OutgoingService<A> for BalanceService<S, O, A> where
    S: AddressStore + BalanceStore<Account = A> + SettlementStore<Account = A> + Clone + Send + Sync + 'static,
    O: OutgoingService<A> + Send + Clone + 'static,
    A: SettlementAccount + 'static, 
[src]

type Future = BoxedIlpFuture

fn send_request(
    &mut self,
    request: OutgoingRequest<A>
) -> Box<dyn Future<Item = Fulfill, Error = Reject> + Send>
[src]

On send message:

  1. Calls store.update_balances_for_prepare with the prepare. If it fails, it replies with a reject
  2. 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 a sendMoney call if the fulfill puts the account's balance over the settle_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

Auto Trait Implementations

impl<S, O, A> Send for BalanceService<S, O, A> where
    A: Send,
    O: Send,
    S: Send

impl<S, O, A> Sync for BalanceService<S, O, A> where
    A: Sync,
    O: Sync,
    S: Sync

impl<S, O, A> Unpin for BalanceService<S, O, A> where
    A: Unpin,
    O: Unpin,
    S: Unpin

impl<S, O, A> !UnwindSafe for BalanceService<S, O, A>

impl<S, O, A> !RefUnwindSafe for BalanceService<S, O, A>

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