hopr_api/db/
mod.rs

1mod peers;
2
3mod protocol;
4
5mod tickets;
6
7pub use peers::*;
8pub use protocol::*;
9pub use tickets::*;
10
11/// Shorthand for the `chrono` based timestamp type used in the database.
12pub type DbTimestamp = chrono::DateTime<chrono::Utc>;
13
14/// Complete set of HOPR node database APIs.
15///
16/// This trait is automatically implemented for types
17/// that implement all the individual chain API traits to be implemented with the same error.
18pub trait HoprNodeDbApi:
19    HoprDbTicketOperations<Error = Self::NodeDbError>
20    + HoprDbPeersOperations<Error = Self::NodeDbError>
21    + HoprDbProtocolOperations<Error = Self::NodeDbError>
22{
23    type NodeDbError: std::error::Error + Send + Sync + 'static;
24}
25
26impl<T, E> HoprNodeDbApi for T
27where
28    T: HoprDbTicketOperations<Error = E> + HoprDbPeersOperations<Error = E> + HoprDbProtocolOperations<Error = E>,
29    E: std::error::Error + Send + Sync + 'static,
30{
31    type NodeDbError = E;
32}