pub trait TransactionRepository: Repository<TransactionRepoModel, String> {
Show 13 methods
// Required methods
fn find_by_relayer_id<'life0, 'life1, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
query: PaginationQuery,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn find_by_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn find_by_status_paginated<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
query: PaginationQuery,
oldest_first: bool,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn find_by_nonce<'life0, 'life1, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
nonce: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_status<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
status: TransactionStatus,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn partial_update<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
update: TransactionUpdateRequest,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_network_data<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
network_data: NetworkTransactionData,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_sent_at<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
sent_at: String,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_confirmed_at<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
confirmed_at: String,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn count_by_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete_by_ids<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<BatchDeleteResult, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_by_requests<'life0, 'async_trait>(
&'life0 self,
requests: Vec<TransactionDeleteRequest>,
) -> Pin<Box<dyn Future<Output = Result<BatchDeleteResult, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn connection_info(&self) -> Option<(Arc<RedisConnections>, String)> { ... }
}Expand description
A trait defining transaction repository operations
Required Methods§
Sourcefn find_by_relayer_id<'life0, 'life1, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
query: PaginationQuery,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_relayer_id<'life0, 'life1, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
query: PaginationQuery,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find transactions by relayer ID with pagination
Sourcefn find_by_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn find_by_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Find transactions by relayer ID and status(es).
Results are sorted by created_at descending (newest first).
Sourcefn find_by_status_paginated<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
query: PaginationQuery,
oldest_first: bool,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn find_by_status_paginated<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
query: PaginationQuery,
oldest_first: bool,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Find transactions by relayer ID and status(es) with pagination.
Results are sorted by timestamp:
- For Confirmed transactions: sorted by confirmed_at (on-chain confirmation order)
- For all other statuses: sorted by created_at (queue/processing order)
The oldest_first parameter controls sort direction:
false(default): newest first (descending) - for displaying recent transactionstrue: oldest first (ascending) - for FIFO queue processing
For multi-status queries, transactions are merged and sorted using the same rules, ensuring consistent ordering across different statuses.
Sourcefn find_by_nonce<'life0, 'life1, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
nonce: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_nonce<'life0, 'life1, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
nonce: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<TransactionRepoModel>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find a transaction by relayer ID and nonce
Sourcefn update_status<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
status: TransactionStatus,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_status<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
status: TransactionStatus,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update the status of a transaction
Sourcefn partial_update<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
update: TransactionUpdateRequest,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn partial_update<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
update: TransactionUpdateRequest,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Partially update a transaction
Sourcefn update_network_data<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
network_data: NetworkTransactionData,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_network_data<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
network_data: NetworkTransactionData,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update the network data of a transaction
Sourcefn set_sent_at<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
sent_at: String,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_sent_at<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
sent_at: String,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the sent_at timestamp of a transaction
Sourcefn set_confirmed_at<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
confirmed_at: String,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_confirmed_at<'life0, 'async_trait>(
&'life0 self,
tx_id: String,
confirmed_at: String,
) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the confirmed_at timestamp of a transaction
Sourcefn count_by_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn count_by_status<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
relayer_id: &'life1 str,
statuses: &'life2 [TransactionStatus],
) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Count transactions by status(es) without fetching full transaction data. This is an optimized O(1) operation in Redis using ZCARD.
Sourcefn delete_by_ids<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<BatchDeleteResult, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_by_ids<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<BatchDeleteResult, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete multiple transactions by their IDs in a single batch operation.
This is more efficient than calling delete_by_id multiple times as it
reduces the number of round-trips to the storage backend.
Note: This method requires fetching transaction data first to clean up indexes.
If you already have transaction data, use delete_by_requests instead for
better performance.
§Arguments
ids- List of transaction IDs to delete
§Returns
BatchDeleteResultcontaining the count of successful deletions and any failures
Sourcefn delete_by_requests<'life0, 'async_trait>(
&'life0 self,
requests: Vec<TransactionDeleteRequest>,
) -> Pin<Box<dyn Future<Output = Result<BatchDeleteResult, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_by_requests<'life0, 'async_trait>(
&'life0 self,
requests: Vec<TransactionDeleteRequest>,
) -> Pin<Box<dyn Future<Output = Result<BatchDeleteResult, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete multiple transactions using pre-extracted data.
This is the most efficient batch delete method as it doesn’t require re-fetching transaction data. Use this when you already have the transaction data (e.g., from a previous query).
§Arguments
requests- List of delete requests containing transaction data needed for cleanup
§Returns
BatchDeleteResultcontaining the count of successful deletions and any failures
Provided Methods§
Sourcefn connection_info(&self) -> Option<(Arc<RedisConnections>, String)>
fn connection_info(&self) -> Option<(Arc<RedisConnections>, String)>
Returns underlying storage Redis connections when available.
In-memory implementations return None.