Skip to main content

DieselDb

Struct DieselDb 

Source
pub struct DieselDb {
    pool: Arc<AsyncDbPool>,
}
Expand description

Async persistence handler. Owns a deadpool-managed diesel-async connection pool and implements all API-path traits from hypercall_db (analytics, integrity, liquidation, notifications, nonces, push, usernames).

Fields§

§pool: Arc<AsyncDbPool>

Implementations§

Source§

impl DieselDb

Source

pub async fn get_catalog_listing_state( &self, underlying: &str, expiry: i64, ) -> Result<Option<CatalogListingState>>

Get catalog listing state for a market (underlying + expiry). This is the listing-oriented state used by CatalogManager for reference prices and extension tracking.

Source

pub async fn insert_catalog_listing_state( &self, underlying: &str, expiry: i64, ref_price: f64, policy_version: i32, ) -> Result<()>

Insert initial catalog state for a new market.

Source

pub async fn update_extension_state( &self, underlying: &str, expiry: i64, ref_price: f64, ) -> Result<()>

Update extension timestamp and ref price for a market.

Source

pub async fn get_existing_strikes( &self, underlying: &str, expiry: i64, ) -> Result<Vec<f64>>

Get all existing strikes for a market as f64 values.

Source

pub async fn update_trading_mode_count( &self, underlying: &str, mode_str: &str, ) -> Result<usize>

Update trading_mode for instruments of a given underlying. Returns the number of rows actually changed.

Source

pub async fn try_acquire_advisory_lock_on_conn( &self, conn: &mut AsyncPgConnection, key: i64, ) -> Result<bool>

Try to acquire the advisory lock for CatalogManager. Returns true if lock was acquired, false if another instance holds it. Unlike the trait method, this operates on a specific connection that is passed in, preserving session-scoped lock semantics.

Source

pub async fn release_advisory_lock_on_conn( &self, conn: &mut AsyncPgConnection, key: i64, ) -> Result<()>

Release the advisory lock on a specific connection.

Source§

impl DieselDb

Source

pub async fn new(database_url: &str, max_size: usize) -> Result<Self>

Build a pool with TLS (NoVerifier for sslmode=require) and verify connectivity.

Source

pub async fn new_with_auth(auth: DbAuthConfig, max_size: usize) -> Result<Self>

Build a pool using DbAuthConfig for credential management.

In Password mode this behaves identically to Self::new. In RdsIam mode, each new connection fetches the latest cached IAM token so connections created after a token refresh use valid credentials.

Source

pub async fn new_no_tls(database_url: &str, max_size: usize) -> Result<Self>

Build a pool without TLS. Used for local development and tests.

Source

pub fn with_pool(pool: Arc<AsyncDbPool>) -> Self

Wrap an existing async pool (no connectivity check).

Source

pub async fn get_conn(&self) -> Result<Object<AsyncPgConnection>>

Checkout a connection from the pool.

Trait Implementations§

Source§

impl AnalyticsReader for DieselDb

Source§

fn get_historical_pnl<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, interval_ms: i64, limit: usize, include_attribution: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<HistoricalPnlPoint>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Historical equity point from DB, used by GET /historical-pnl.

When include_attribution is false, the large attribution bytea is omitted from the SELECT.

Source§

fn get_all_trades<'life0, 'async_trait>( &'life0 self, limit: usize, offset: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<TradeRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Paginated trade history, ordered by timestamp descending.
Source§

fn get_trades_by_option<'life0, 'life1, 'async_trait>( &'life0 self, option_id: &'life1 str, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<TradeRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Trades for a specific option symbol (e.g. “BTC-20260131-100000-C”).
Source§

fn get_trades_by_underlying<'life0, 'life1, 'async_trait>( &'life0 self, underlying: &'life1 str, limit: usize, offset: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<TradeRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Trades for all instruments with the given underlying (e.g. “BTC”).
Source§

fn get_trades_by_account<'life0, 'life1, 'async_trait>( &'life0 self, account: &'life1 WalletAddress, limit: usize, offset: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<TradeRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Trades where the wallet was either maker or taker.
Source§

fn get_trades_for_symbol_in_range<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, start_time_ms: i64, end_time_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<TradeRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Trades for a symbol within a time range (inclusive, ascending order).
Source§

fn get_fills_by_account<'life0, 'life1, 'async_trait>( &'life0 self, account: &'life1 WalletAddress, limit: usize, offset: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<FillRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fills for a wallet, ordered by timestamp descending.
Source§

fn get_orders_by_account<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, account: &'life1 WalletAddress, status: Option<&'life2 str>, limit: usize, offset: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<OrderRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Orders for a wallet, optionally filtered by status. Descending by timestamp.
Source§

fn trade_history_exists_for_symbol<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether any trades exist for a symbol.
Source§

fn historical_theo_history_exists_for_symbol<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether any historical theo snapshots exist for a symbol.
Source§

fn get_historical_theos<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, interval_ms: i64, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<HistoricalTheoPoint>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Historical theoretical price snapshots for a symbol at the given interval.
Source§

fn get_historical_theos_batch<'life0, 'life1, 'async_trait>( &'life0 self, symbols: &'life1 [String], interval_ms: i64, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<HistoricalTheoPoint>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Batch fetch historical theos for multiple symbols at once.
Source§

fn get_vol_surface_history<'life0, 'life1, 'async_trait>( &'life0 self, underlying: &'life1 str, interval_ms: i64, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<VolSurfaceSnapshot>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Historical vol surface snapshots for an underlying at the given interval.
Source§

fn load_bbo_snapshots_since<'life0, 'async_trait>( &'life0 self, cutoff_ts: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<BboSnapshotRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

BBO snapshots since a cutoff timestamp, ordered by symbol then time.
Source§

fn get_bbo_reference_asks<'life0, 'life1, 'async_trait>( &'life0 self, symbols: &'life1 [String], cutoff_ts: i64, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, BboReferenceData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reference best-ask prices for 24h-change calculation. Falls back to the earliest available snapshot if no data exists before the cutoff.
Source§

fn get_settlement_payouts<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, limit: i64, offset: i64, symbol: Option<&'life2 str>, ledger_applied: Option<bool>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<SettlementPayoutRecord>, i64)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Settlement payouts for a wallet with optional filters. Returns (rows, total_count).
Source§

fn get_seen_settlement_payout_ids<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, payout_ids: &'life2 [i64], ) -> Pin<Box<dyn Future<Output = Result<HashSet<i64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Which payout IDs have been marked as “seen” by the user.
Source§

fn get_client_ids_by_order_ids<'life0, 'life1, 'async_trait>( &'life0 self, order_ids: &'life1 [i64], ) -> Pin<Box<dyn Future<Output = Result<HashMap<i64, Option<String>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Batch lookup of client_ids by order_ids. Missing orders are omitted.
Source§

fn get_theo_marks_at_timestamp<'life0, 'life1, 'async_trait>( &'life0 self, symbols: &'life1 [String], timestamp_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Decimal>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Latest theoretical marks for symbols at or before a timestamp.
Source§

fn get_deposit_withdraw_events<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<Vec<LedgerEventTimeDelta>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deposit and withdraw ledger events for a wallet, ascending by time.
Source§

fn get_settled_pnl_by_symbol<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, before_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Decimal)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Net realized PnL per symbol for a wallet, scoped to events at or before the given timestamp. Covers fill_premium, fill_realized_pnl, and settlement_realized_pnl event types.
Source§

fn get_fills_since_timestamp<'life0, 'async_trait>( &'life0 self, cutoff_timestamp: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<FillBackfillRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Recent fills since a cutoff timestamp, ascending by time. Used for cache backfill (market stats).
Source§

impl AnalyticsWriter for DieselDb

Source§

fn upsert_historical_pnl_batch<'life0, 'life1, 'async_trait>( &'life0 self, interval_ms: i64, timestamp_ms: i64, snapshots: &'life1 [(WalletAddress, Decimal, Option<Vec<u8>>)], max_periods: i64, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upsert PnL snapshots for a batch of wallets, pruning beyond max_periods.
Source§

fn upsert_historical_theo_batch<'life0, 'life1, 'async_trait>( &'life0 self, interval_ms: i64, timestamp_ms: i64, snapshots: &'life1 [(String, Decimal)], max_periods: i64, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upsert theo price snapshots for a batch of symbols, pruning beyond max_periods.
Source§

fn upsert_vol_surface_snapshot<'life0, 'life1, 'async_trait>( &'life0 self, interval_ms: i64, timestamp_ms: i64, underlying: &'life1 str, surface_json: Value, max_periods: i64, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upsert a vol surface JSON snapshot, pruning beyond max_periods.
Source§

fn upsert_bbo_snapshots<'life0, 'life1, 'async_trait>( &'life0 self, snapshot_ts: i64, snapshots: &'life1 [NewBboSnapshotInput], ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upsert BBO snapshots for multiple symbols at a given timestamp.
Source§

fn delete_bbo_snapshots_older_than<'life0, 'async_trait>( &'life0 self, cutoff_ts: i64, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete BBO snapshots older than cutoff_ts. Returns count deleted.
Source§

fn mark_settlement_payouts_seen<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, payout_ids: &'life2 [i64], ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Mark settlement payout IDs as “seen” for a wallet (idempotent).
Source§

impl AsyncDirectiveOutboxReader for DieselDb

Source§

fn directive_outbox_exists<'life0, 'life1, 'async_trait>( &'life0 self, directive_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether a directive outbox row exists for the given directive_id.
Source§

fn get_directive_status<'life0, 'life1, 'async_trait>( &'life0 self, directive_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DirectiveStatusRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up the delivery status of a single directive by its ID.
Source§

fn get_withdrawal_history<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirectiveStatusRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return withdrawal directive history for a wallet, most recent first.
Source§

fn list_directive_outbox_delivery_metrics<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirectiveOutboxDeliveryMetricsRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return retryable directive delivery backlog grouped by stable low-cardinality labels.
Source§

fn list_recent_directive_outbox_rows<'life0, 'async_trait>( &'life0 self, limit: i64, offset: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirectiveOutboxRecentRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return recent directive outbox rows for operator debugging.
Source§

impl AsyncDirectiveOutboxWriter for DieselDb

Source§

fn record_directive_submitter_submission<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request_id: &'life1 str, submitter_address: &'life2 Address, submitter_nonce: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Store the submitter-owned submission pointer for a directive. Read more
Source§

fn persist_directive_transaction_update<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, request_id: &'life1 str, status: TransactionStatus, tx_hash: Option<&'life2 str>, error: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Persist transaction-submitter status updates for a directive. Read more
Source§

impl AsyncTransactionSubmitterStore for DieselDb

Source§

fn max_nonce_for_submitter<'life0, 'life1, 'async_trait>( &'life0 self, submitter: &'life1 SubmitterId, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn record_submission<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, record: &'life1 SubmissionRecord, attempts: &'life2 [SubmissionAttemptRecord], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn update_submission_status<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, submitter: &'life1 SubmitterId, nonce: SubmittedNonce, status: SubmissionStatus, primary_tx_hash: Option<&'life2 str>, terminal_error: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn list_pending_submissions<'life0, 'async_trait>( &'life0 self, after_submission_id: i64, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<PendingSubmissionRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl BootstrapReader for DieselDb

Source§

fn get_all_active_instruments<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<InstrumentRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load all active instruments (status = ‘ACTIVE’).
Source§

fn get_all_instruments<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<InstrumentRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load all instruments regardless of status.
Source§

fn get_instrument_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count of all instruments in the database.
Source§

impl CatalogReader for DieselDb

Source§

fn get_market_catalog_state<'life0, 'life1, 'async_trait>( &'life0 self, underlying: &'life1 str, expiry: i64, ) -> Pin<Box<dyn Future<Output = Result<Option<MarketCatalogState>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get catalog state for a market (keyed by underlying + expiry).
Source§

fn get_instruments_for_settlement<'life0, 'life1, 'async_trait>( &'life0 self, underlying: &'life1 str, expiry: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<CatalogInstrument>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all instruments for a given underlying and expiry (for settlement).
Source§

fn get_distinct_strikes<'life0, 'life1, 'async_trait>( &'life0 self, underlying: &'life1 str, expiry: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Decimal>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get distinct strike prices for an underlying and expiry.
Source§

fn get_markets_for_underlying<'life0, 'life1, 'async_trait>( &'life0 self, underlying: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, i64)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all markets (underlying, expiry) for an underlying.
Source§

fn get_instruments_count<'life0, 'life1, 'async_trait>( &'life0 self, underlying: &'life1 str, expiry: i64, ) -> Pin<Box<dyn Future<Output = Result<i32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count existing instruments for a market.
Source§

fn market_exists<'life0, 'life1, 'async_trait>( &'life0 self, underlying: &'life1 str, expiry: i64, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a market exists (underlying + expiry).
Source§

fn instrument_exists<'life0, 'life1, 'async_trait>( &'life0 self, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether an instrument exists by symbol.
Source§

impl CatalogWriter for DieselDb

Source§

fn upsert_market_catalog_state<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 MarketCatalogState, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert or update market catalog state. On conflict (market already exists), only last_extension_at and last_extension_ref_price are updated – the initial listing fields (ref_price_at_listing, listed_at, listing_policy_version) are immutable after creation.
Source§

fn update_trading_mode_for_underlying<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, underlying: &'life1 str, trading_mode: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update trading mode for all instruments of an underlying.
Source§

impl CompetitionReader for DieselDb

Source§

fn list_competitions<'life0, 'life1, 'async_trait>( &'life0 self, state_filter: Option<&'life1 str>, from_ts_ms: Option<i64>, to_ts_ms: Option<i64>, now_ts_ms: i64, limit: i64, offset: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<CompetitionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List competitions with optional state/time filters and pagination.
Source§

fn get_competition_by_id<'life0, 'async_trait>( &'life0 self, competition_id: i64, ) -> Pin<Box<dyn Future<Output = Result<Option<CompetitionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a single competition by ID.
Source§

fn get_active_competition<'life0, 'async_trait>( &'life0 self, now_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Option<CompetitionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the currently active competition (start <= now < end).
Source§

fn get_latest_completed_competition<'life0, 'async_trait>( &'life0 self, now_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Option<CompetitionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the most recently completed competition (end <= now).
Source§

fn get_competitions_to_finalize<'life0, 'async_trait>( &'life0 self, now_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<CompetitionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get competitions that have ended but not yet been finalized.
Source§

fn get_finalized_stats<'life0, 'async_trait>( &'life0 self, competition_id: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<CompetitionFinalStatsRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get finalized leaderboard stats for a competition.
Source§

fn get_competition_fills_before<'life0, 'async_trait>( &'life0 self, cutoff_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<CompetitionFillRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all competition fill events up to a cutoff timestamp, excluding market maker wallets, ordered by timestamp ascending.
Source§

fn get_historical_theo_marks<'life0, 'life1, 'async_trait>( &'life0 self, symbols: &'life1 [String], cutoff_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<TheoMarkRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get historical theoretical marks for symbols at or before a timestamp.
Source§

fn get_display_usernames_batch<'life0, 'life1, 'async_trait>( &'life0 self, wallet_strings: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<Vec<WalletUsernameRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get display usernames for a batch of wallets.
Source§

fn get_display_username<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the approved username for a single wallet.
Source§

fn get_profile_image_url<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get profile image URL for a wallet.
Source§

fn compute_ledger_profile_stats<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, now_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<WalletLedgerStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Compute ledger stats (deposits, withdrawals, realized PnL, 24h PnL) for a wallet.
Source§

fn get_account_first_seen_ts_ms<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<Option<i64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the first seen timestamp for a wallet from ledger events.
Source§

fn get_realized_pnl_by_symbol<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, window_start: Option<i64>, window_end: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<SymbolPnlRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get per-symbol realized PnL for a wallet within an optional time window.
Source§

fn get_profile_trade_history<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, window_start: Option<i64>, window_end: Option<i64>, from_ts_ms: Option<i64>, to_ts_ms: Option<i64>, symbol: Option<&'life2 str>, limit: i64, offset: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<ProfileFillRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get profile trade history with optional competition window and filters.
Source§

fn get_platform_wallet_metrics<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PlatformWalletMetrics>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get platform-wide realized PnL and volume per wallet (for medal computation).
Source§

impl CompetitionWriter for DieselDb

Source§

fn create_competition<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 CompetitionUpsertInput, ) -> Pin<Box<dyn Future<Output = Result<CompetitionRecord, CompetitionWriteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new competition. Returns OverlapViolation if the window conflicts.
Source§

fn update_competition<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, competition_id: i64, name: &'life1 str, description: Option<&'life2 str>, rules_url: Option<&'life3 str>, rules_content: Option<&'life4 str>, win_conditions: &'life5 [String], primary_win_condition: &'life6 str, start_ts_ms: i64, end_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<CompetitionRecord, CompetitionWriteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait,

Update an existing competition by ID. All fields are pre-resolved by caller. Returns OverlapViolation if the new window conflicts.
Source§

fn delete_competition<'life0, 'async_trait>( &'life0 self, competition_id: i64, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete a competition by ID. Returns number of rows deleted.
Source§

fn record_competition_fill<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 CompetitionFillInput, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Record a competition fill event (idempotent via ON CONFLICT DO NOTHING).
Source§

fn finalize_competition<'life0, 'life1, 'async_trait>( &'life0 self, competition_id: i64, stats: &'life1 [CompetitionFinalStatsInput], ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Finalize a competition: insert final stats rows in a transaction. Uses pg_advisory_xact_lock to prevent double-finalization. Returns the number of rows inserted.
Source§

fn set_profile_image_url<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, profile_image_url: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set profile image URL for a wallet. Returns the previous URL (if any).
Source§

impl FaucetWriter for DieselDb

Source§

fn persist_faucet_credit<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, amount: Decimal, limit: Decimal, window_start_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<FaucetCreditResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Atomically check credit limit and record a deposit audit event. Returns error if the credit would exceed the per-window limit.
Source§

impl IntegrityReader for DieselDb

Source§

fn get_integrity_query_results<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = IntegrityQueryResults> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run all 9 integrity checks on a single connection and return the aggregated results. This is the only method called in production.
Source§

fn get_settlement_integrity<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(i64, i64, i64, Decimal)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Settlement stats: (total, applied, pending, total_payout_value). Test-only - production uses get_integrity_query_results.
Source§

fn get_open_interest_by_underlying<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Decimal)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Open interest grouped by underlying currency. Test-only - production uses get_integrity_query_results.
Source§

impl LiquidationReader for DieselDb

Source§

fn get_liquidation_state<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<Option<LiquidationStateRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Current liquidation state for a wallet (or None if healthy and never tracked).
Source§

fn get_all_liquidation_states<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<LiquidationStateRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

All liquidation states across all wallets.
Source§

fn get_liquidation_history<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, limit: i64, offset: i64, ) -> Pin<Box<dyn Future<Output = Result<(Vec<LiquidationHistoryRecord>, i64)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Paginated liquidation history for a wallet. Returns (rows, total_count).
Source§

fn get_recent_liquidation_history<'life0, 'async_trait>( &'life0 self, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<LiquidationHistoryRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Most recent liquidation history entries across all wallets.
Source§

fn get_liquidation_auction<'life0, 'life1, 'async_trait>( &'life0 self, auction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<LiquidationAuctionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load a single auction by ID.
Source§

fn get_max_liquidation_observed_block<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Highest last_observed_block across all auction rows.
Source§

fn get_active_auctions_for_wallet<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<Vec<LiquidationAuctionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl LiquidationWriter for DieselDb

Source§

fn save_liquidation_state<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 LiquidationStateRecord, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upsert liquidation state for a wallet.
Source§

fn delete_liquidation_state<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn insert_liquidation_history<'life0, 'life1, 'async_trait>( &'life0 self, entry: &'life1 LiquidationHistoryRecord, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert a liquidation history audit trail entry. Returns the new row ID.
Source§

fn create_liquidation_auction<'life0, 'life1, 'async_trait>( &'life0 self, auction: &'life1 LiquidationAuctionRecord, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new liquidation auction record.
Source§

fn update_liquidation_auction<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, auction_id: &'life1 str, updates: &'life2 LiquidationAuctionUpdate, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update fields on an existing auction (status, timestamps, winner, etc).
Source§

fn claim_and_apply_liquidation_bonus<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, winner: &'life1 WalletAddress, liquidated_wallet: &'life2 WalletAddress, auction_id: &'life3 str, resolution_tx_hash: &'life4 str, bonus: Decimal, event_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<LiquidationBonusApplyResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Claim and apply a liquidation bonus to the winner’s account.
Source§

impl NonceReader for DieselDb

Source§

fn get_rsm_signer_nonce<'life0, 'life1, 'async_trait>( &'life0 self, signer: &'life1 WalletAddress, ) -> Pin<Box<dyn Future<Output = Result<Option<RsmSignerNonceRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load the current nonce state for a signer address.
Source§

impl NonceWriter for DieselDb

Source§

fn save_rsm_signer_nonce<'life0, 'life1, 'async_trait>( &'life0 self, record: &'life1 RsmSignerNonceRecord, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save or update a signer nonce record.
Source§

fn reserve_next_rsm_signer_nonce<'life0, 'life1, 'async_trait>( &'life0 self, signer: &'life1 WalletAddress, initial_nonce: u64, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn claim_rsm_signer_request<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, request_id: &'life1 str, signer: &'life2 WalletAddress, account: &'life3 WalletAddress, action: &'life4 [u8], initial_nonce: u64, ) -> Pin<Box<dyn Future<Output = Result<RsmSignerRequestClaim>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Claim a signer request slot, returning a nonce for signing. Read more
Source§

fn complete_rsm_signer_request<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, request_id: &'life1 str, directive: &'life2 [u8], signature: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<RsmSignerRequestRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Mark a pending request as completed with the signed directive.
Source§

impl NotificationReader for DieselDb

Source§

fn list_notifications<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 str, before_id: Option<i64>, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<NotificationRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List notifications for a wallet, ordered by id descending. If before_id is set, only return notifications with id < before_id.
Source§

fn count_unread_notifications<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count unread notifications for a wallet.
Source§

impl NotificationWriter for DieselDb

Source§

fn insert_notification<'life0, 'async_trait>( &'life0 self, input: NewNotificationInput, ) -> Pin<Box<dyn Future<Output = Result<NotificationRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Insert a new notification, returning the inserted row.
Source§

fn mark_notifications_read<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 str, ids: &'life2 [i64], now: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Mark specific notification ids as read for a wallet. Returns the number of rows updated.
Source§

fn mark_all_notifications_read<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 str, now: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark all unread notifications as read for a wallet. Returns the number of rows updated.
Source§

impl PmSettlementProjectionReader for DieselDb

Source§

fn list_pm_settlement_pools<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PmSettlementPoolProjection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn pm_settlement_pool_gate_counts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PmSettlementPoolGateCounts>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn list_pm_settlement_accounts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PmSettlementAccountProjection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn pm_settlement_account_gate_counts<'life0, 'async_trait>( &'life0 self, now_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<PmSettlementAccountGateCounts>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn list_pm_settlement_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PmSettlementEventProjection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn list_pm_settlement_interest_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PmSettlementInterestEventProjection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn list_pm_settlement_repayment_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PmSettlementRepaymentEventProjection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn list_pm_recovery_plans<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PmRecoveryPlanProjection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn list_pm_recovery_actions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PmRecoveryActionProjection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn pm_recovery_action_gate_counts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PmRecoveryActionGateCounts>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl PushSubscriptionReader for DieselDb

Source§

fn get_push_subscriptions<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PushSubscriptionRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load all push subscriptions for a wallet.
Source§

fn count_push_subscriptions<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count push subscriptions for a wallet.
Source§

fn push_subscription_exists<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 str, endpoint: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check if a specific endpoint exists for a wallet.
Source§

impl PushSubscriptionWriter for DieselDb

Source§

fn upsert_push_subscription<'life0, 'async_trait>( &'life0 self, input: UpsertPushSubscriptionInput, ) -> Pin<Box<dyn Future<Output = Result<PushSubscriptionRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Upsert a push subscription (insert or update on conflict). On conflict (wallet_address, endpoint), updates auth_key, p256dh_key, and preferences.
Source§

fn update_push_preferences<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 str, endpoint: &'life2 str, preferences: Value, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update preferences for an existing subscription. Returns true if a row was updated.
Source§

fn delete_push_subscription<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 str, endpoint: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a push subscription by wallet + endpoint. Returns true if a row was deleted.
Source§

fn delete_push_subscription_by_id<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete a push subscription by id.
Source§

impl TransactionSubmitterReader for DieselDb

Source§

fn get_submission_by_nonce<'life0, 'life1, 'async_trait>( &'life0 self, submitter: &'life1 SubmitterId, nonce: SubmittedNonce, ) -> Pin<Box<dyn Future<Output = Result<Option<SubmissionDetailRow>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl UsernameReader for DieselDb

Source§

fn get_username_by_wallet<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UsernameRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up the username for a wallet (case-insensitive wallet match).
Source§

fn get_username_by_name<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UsernameRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reverse lookup: find the wallet that owns a username (case-insensitive).
Source§

impl UsernameWriter for DieselDb

Source§

fn set_username<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 str, username: &'life2 str, now: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(UsernameRecord, Option<String>), UsernameWriteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set (insert or update) the username for a wallet. Returns the final row and the previous username (if any) on success. Returns UsernameWriteError::UniqueViolation when the username is taken.
Source§

fn delete_username<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UsernameRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete the username for a wallet. Returns the deleted row if one existed.
Source§

impl ValidatorRsmStateAsyncReader for DieselDb

Source§

fn get_validator_rsm_root_summary<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, version: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<ValidatorRsmRootSummary>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_validator_rsm_current_state<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, ) -> Pin<Box<dyn Future<Output = Result<Option<ValidatorRsmCurrentState>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_validator_rsm_current_root_summary<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, ) -> Pin<Box<dyn Future<Output = Result<Option<ValidatorRsmRootSummary>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_rsm_block_by_height<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<RsmBlockView>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_rsm_block_by_hash<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, hash: [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<RsmBlockView>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_latest_rsm_block<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, ) -> Pin<Box<dyn Future<Output = Result<Option<RsmBlockView>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn list_rsm_blocks<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, from_height: Option<u64>, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<RsmBlockView>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_rsm_block_commands<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<RsmBlockCommand>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

§

fn get_rsm_block_data<'life0, 'async_trait>( &'life0 self, environment: ValidatorRsmEnvironment, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<RsmBlockData>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AggregateExpressionMethods for T

§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> IntoSql for T

§

fn into_sql<T>(self) -> Self::Expression
where Self: Sized + AsExpression<T>, T: SqlType + TypedExpressionType,

Convert self to an expression for Diesel’s query builder. Read more
§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T, Conn> RunQueryDsl<Conn> for T

§

fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> <Conn as AsyncConnectionCore>::ExecuteFuture<'conn, 'query>
where Conn: AsyncConnectionCore + Send, Self: ExecuteDsl<Conn> + 'query,

Executes the given command, returning the number of rows affected. Read more
§

fn load<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a Vec with the returned rows. Read more
§

fn load_stream<'conn, 'query, U>( self, conn: &'conn mut Conn, ) -> Self::LoadFuture<'conn>
where Conn: AsyncConnectionCore, U: 'conn, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a [Stream] with the returned rows. Read more
§

fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, LoadNext<Pin<Box<Self::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, and returns the affected row. Read more
§

fn get_results<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, returning an Vec with the affected rows. Read more
§

fn first<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, LoadNext<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LimitDsl, Self::Output: LoadQuery<'query, Conn, U> + Send + 'query,

Attempts to load a single record. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WindowExpressionMethods for T

§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,