cuprate_txpool/
tables.rs

1//! Tx-pool Database tables.
2//!
3//! # Table marker structs
4//! This module contains all the table definitions used by [`cuprate_txpool`](crate).
5//!
6//! The zero-sized structs here represents the table type;
7//! they all are essentially marker types that implement [`cuprate_database::Table`].
8//!
9//! Table structs are `CamelCase`, and their static string
10//! names used by the actual database backend are `snake_case`.
11//!
12//! For example: [`TransactionBlobs`] -> `transaction_blobs`.
13//!
14//! # Traits
15//! This module also contains a set of traits for
16//! accessing _all_ tables defined here at once.
17use cuprate_database::{define_tables, StorableVec};
18
19use crate::types::{
20    KeyImage, RawCachedVerificationState, TransactionBlobHash, TransactionHash, TransactionInfo,
21};
22
23define_tables! {
24    /// Serialized transaction blobs.
25    ///
26    /// This table contains the transaction blobs of all the transactions in the pool.
27    0 => TransactionBlobs,
28    TransactionHash => StorableVec<u8>,
29
30    /// Transaction information.
31    ///
32    /// This table contains information of all transactions currently in the pool.
33    1 => TransactionInfos,
34    TransactionHash => TransactionInfo,
35
36    /// Cached transaction verification state.
37    ///
38    /// This table contains the cached verification state of all translations in the pool.
39    2 => CachedVerificationState,
40    TransactionHash => RawCachedVerificationState,
41
42    /// Spent key images.
43    ///
44    /// This table contains the spent key images from all transactions in the pool.
45    3 => SpentKeyImages,
46    KeyImage => TransactionHash,
47
48    /// Transaction blob hashes that are in the pool.
49    4 => KnownBlobHashes,
50    TransactionBlobHash => TransactionHash,
51}