pub trait Storage: Send + Sync {
Show 23 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: StorageListPaymentsRequest,
) -> 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 insert_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 get_payments_by_parent_ids<'life0, 'async_trait>(
&'life0 self,
parent_payment_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<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;
fn add_outgoing_change<'life0, 'async_trait>(
&'life0 self,
record: UnversionedRecordChange,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn complete_outgoing_sync<'life0, 'async_trait>(
&'life0 self,
record: Record,
local_revision: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_pending_outgoing_changes<'life0, 'async_trait>(
&'life0 self,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<OutgoingChange>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_last_revision<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn insert_incoming_records<'life0, 'async_trait>(
&'life0 self,
records: Vec<Record>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_incoming_record<'life0, 'async_trait>(
&'life0 self,
record: Record,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_incoming_records<'life0, 'async_trait>(
&'life0 self,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<IncomingChange>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_latest_outgoing_change<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<OutgoingChange>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_record_from_incoming<'life0, 'async_trait>(
&'life0 self,
record: Record,
) -> 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§
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,
Sourcefn list_payments<'life0, 'async_trait>(
&'life0 self,
request: StorageListPaymentsRequest,
) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_payments<'life0, 'async_trait>(
&'life0 self,
request: StorageListPaymentsRequest,
) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn 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 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,
Sourcefn insert_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 insert_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,
Sourcefn 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_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,
Sourcefn 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 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,
Sourcefn get_payments_by_parent_ids<'life0, 'async_trait>(
&'life0 self,
parent_payment_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<Payment>>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_payments_by_parent_ids<'life0, 'async_trait>(
&'life0 self,
parent_payment_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<Payment>>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn 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 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,
Sourcefn 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 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,
Sourcefn 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 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,
Sourcefn 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 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,
fn add_outgoing_change<'life0, 'async_trait>(
&'life0 self,
record: UnversionedRecordChange,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete_outgoing_sync<'life0, 'async_trait>(
&'life0 self,
record: Record,
local_revision: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_pending_outgoing_changes<'life0, 'async_trait>(
&'life0 self,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<OutgoingChange>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn get_last_revision<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_last_revision<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the last committed sync revision.
The sync_revision table tracks the highest revision that has been committed
(i.e. acknowledged by the server or received from it). It does NOT include
pending outgoing queue ids. This value is used by the sync protocol to
request changes from the server.
Sourcefn insert_incoming_records<'life0, 'async_trait>(
&'life0 self,
records: Vec<Record>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert_incoming_records<'life0, 'async_trait>(
&'life0 self,
records: Vec<Record>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert incoming records from remote sync
Sourcefn delete_incoming_record<'life0, 'async_trait>(
&'life0 self,
record: Record,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_incoming_record<'life0, 'async_trait>(
&'life0 self,
record: Record,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete an incoming record after it has been processed
Sourcefn get_incoming_records<'life0, 'async_trait>(
&'life0 self,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<IncomingChange>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_incoming_records<'life0, 'async_trait>(
&'life0 self,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<IncomingChange>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get incoming records that need to be processed, up to the specified limit
Sourcefn get_latest_outgoing_change<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<OutgoingChange>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_latest_outgoing_change<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<OutgoingChange>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the latest outgoing record if any exists
Sourcefn update_record_from_incoming<'life0, 'async_trait>(
&'life0 self,
record: Record,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_record_from_incoming<'life0, 'async_trait>(
&'life0 self,
record: Record,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update the sync state record from an incoming record