1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
//! # interledger-router //! //! A service that routes ILP Prepare packets to the correct next //! account based on the ILP address in the Prepare packet based //! on the routing table. //! //! A routing table could be as simple as a single entry for the empty prefix //! ("") that will route all requests to a specific outgoing account. #[macro_use] extern crate log; use bytes::Bytes; use hashbrown::HashMap; use interledger_service::{Account, AccountStore}; mod router; pub use self::router::Router; /// A trait for Store implmentations that have ILP routing tables. pub trait RouterStore: AccountStore + Clone + Send + Sync + 'static { /// **Synchronously** return a copy of the routing table. /// Note that this is synchronous because it assumes that Stores should /// keep the routing table in memory and use PubSub or polling to keep it updated. /// This ensures that individual packets can be routed without hitting the underlying store. // TODO avoid using HashMap because it means it'll be cloned a lot fn routing_table(&self) -> HashMap<Bytes, <Self::Account as Account>::AccountId>; }