[][src]Crate interledger_service

interledger-service

This is the core abstraction used across the Interledger.rs implementation.

Inspired by tower, all of the components of this implementation are "services" that take a request type and asynchronously return a result. Every component uses the same interface so that services can be reused and combined into different bundles of functionality.

The Interledger service traits use requests that contain ILP Prepare packets and the related from/to Accounts and asynchronously return either an ILP Fullfill or Reject packet. Implementations of Stores (wrappers around databases) can attach additional information to the Account records, which are then passed through the service chain.

Example Service Bundles

The following examples illustrate how different Services can be chained together to create different bundles of functionality.

SPSP Sender

SPSP Client --> ValidatorService --> RouterService --> HttpOutgoingService

Connector

HttpServerService --> ValidatorService --> RouterService --> BalanceAndExchangeRateService --> ValidatorService --> HttpOutgoingService

STREAM Receiver

HttpServerService --> ValidatorService --> StreamReceiverService

Structs

AuthToken
IncomingRequest

A struct representing an incoming ILP Prepare packet or an outgoing one before the next hop is set.

OutgoingRequest

A struct representing an ILP Prepare packet with the incoming and outgoing accounts set.

ServiceFn

A service created by incoming_service_fn or outgoing_service_fn

Username

Usernames can be unicode and must be between 2 and 32 characters.

WrappedService

A service that wraps another one with a function that will be called on every request.

Traits

Account

The base trait that Account types from other Services extend. This trait only assumes that the account has an ID that can be compared with others.

AccountStore

The base Store trait that can load a given account based on the ID.

AddressStore
IncomingService

Core service trait for handling IncomingRequests that asynchronously returns an ILP Fulfill or Reject packet.

OutgoingService

Core service trait for sending OutgoingRequests that asynchronously returns an ILP Fulfill or Reject packet.

Functions

incoming_service_fn

Create an IncomingService that calls the given handler for each request.

outgoing_service_fn

Create an OutgoingService that calls the given handler for each request.

Type Definitions

BoxedIlpFuture

A future that returns an ILP Fulfill or Reject packet.