Storage

Trait Storage 

Source
pub trait Storage: Send + Sync {
Show 13 methods // Required methods fn delete_cached_item<'life0, 'async_trait>( &'life0 self, key: String, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_cached_item<'life0, 'async_trait>( &'life0 self, key: String, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_cached_item<'life0, 'async_trait>( &'life0 self, key: String, value: String, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_payments<'life0, 'async_trait>( &'life0 self, request: ListPaymentsRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn insert_payment<'life0, 'async_trait>( &'life0 self, payment: Payment, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_payment_metadata<'life0, 'async_trait>( &'life0 self, payment_id: String, metadata: PaymentMetadata, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_payment_by_id<'life0, 'async_trait>( &'life0 self, id: String, ) -> Pin<Box<dyn Future<Output = Result<Payment, StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_payment_by_invoice<'life0, 'async_trait>( &'life0 self, invoice: String, ) -> Pin<Box<dyn Future<Output = Result<Option<Payment>, StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn add_deposit<'life0, 'async_trait>( &'life0 self, txid: String, vout: u32, amount_sats: u64, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn delete_deposit<'life0, 'async_trait>( &'life0 self, txid: String, vout: u32, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_deposits<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<DepositInfo>, StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn update_deposit<'life0, 'async_trait>( &'life0 self, txid: String, vout: u32, payload: UpdateDepositPayload, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_lnurl_metadata<'life0, 'async_trait>( &'life0 self, metadata: Vec<SetLnurlMetadataItem>, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Trait for persistent storage

Required Methods§

Source

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

Source

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

Source

fn set_cached_item<'life0, 'async_trait>( &'life0 self, key: String, value: String, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn list_payments<'life0, 'async_trait>( &'life0 self, request: ListPaymentsRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists payments with optional filters and pagination

§Arguments
  • list_payments_request - The request to list payments
§Returns

A vector of payments or a StorageError

Source

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

Inserts a payment into storage

§Arguments
  • payment - The payment to insert
§Returns

Success or a StorageError

Source

fn set_payment_metadata<'life0, 'async_trait>( &'life0 self, payment_id: String, metadata: PaymentMetadata, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Inserts payment metadata into storage

§Arguments
  • payment_id - The ID of the payment
  • metadata - The metadata to insert
§Returns

Success or a StorageError

Source

fn get_payment_by_id<'life0, 'async_trait>( &'life0 self, id: String, ) -> Pin<Box<dyn Future<Output = Result<Payment, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a payment by its ID

§Arguments
  • id - The ID of the payment to retrieve
§Returns

The payment if found or None if not found

Source

fn get_payment_by_invoice<'life0, 'async_trait>( &'life0 self, invoice: String, ) -> Pin<Box<dyn Future<Output = Result<Option<Payment>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a payment by its invoice

§Arguments
  • invoice - The invoice of the payment to retrieve
§Returns

The payment if found or None if not found

Source

fn add_deposit<'life0, 'async_trait>( &'life0 self, txid: String, vout: u32, amount_sats: u64, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add a deposit to storage

§Arguments
  • txid - The transaction ID of the deposit
  • vout - The output index of the deposit
  • amount_sats - The amount of the deposit in sats
§Returns

Success or a StorageError

Source

fn delete_deposit<'life0, 'async_trait>( &'life0 self, txid: String, vout: u32, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Removes an unclaimed deposit from storage

§Arguments
  • txid - The transaction ID of the deposit
  • vout - The output index of the deposit
§Returns

Success or a StorageError

Source

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

Lists all unclaimed deposits from storage

§Returns

A vector of DepositInfo or a StorageError

Source

fn update_deposit<'life0, 'async_trait>( &'life0 self, txid: String, vout: u32, payload: UpdateDepositPayload, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Updates or inserts unclaimed deposit details

§Arguments
  • txid - The transaction ID of the deposit
  • vout - The output index of the deposit
  • payload - The payload for the update
§Returns

Success or a StorageError

Source

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

Implementors§