pub struct SqliteClient { /* private fields */ }Expand description
An implementation of the BarkPersister using rusqlite. Changes are persisted using the given PathBuf.
Implementations§
Source§impl SqliteClient
impl SqliteClient
Sourcepub fn open(db_file: impl AsRef<Path>) -> Result<SqliteClient>
pub fn open(db_file: impl AsRef<Path>) -> Result<SqliteClient>
Open a new SqliteClient with the given file path
Trait Implementations§
Source§impl BarkPersister for SqliteClient
impl BarkPersister for SqliteClient
Source§fn get_vtxos_by_state(&self, state: &[VtxoStateKind]) -> Result<Vec<WalletVtxo>>
fn get_vtxos_by_state(&self, state: &[VtxoStateKind]) -> Result<Vec<WalletVtxo>>
Get all VTXOs that are in one of the provided states
Source§fn store_lightning_receive(
&self,
payment_hash: PaymentHash,
preimage: Preimage,
invoice: &Bolt11Invoice,
htlc_recv_cltv_delta: BlockDelta,
) -> Result<()>
fn store_lightning_receive( &self, payment_hash: PaymentHash, preimage: Preimage, invoice: &Bolt11Invoice, htlc_recv_cltv_delta: BlockDelta, ) -> Result<()>
Store a lightning receive
Source§fn fetch_lightning_receive_by_payment_hash(
&self,
payment_hash: PaymentHash,
) -> Result<Option<LightningReceive>>
fn fetch_lightning_receive_by_payment_hash( &self, payment_hash: PaymentHash, ) -> Result<Option<LightningReceive>>
Fetch a lightning receive by payment hash
Source§fn init_wallet(&self, properties: &WalletProperties) -> Result<()>
fn init_wallet(&self, properties: &WalletProperties) -> Result<()>
Initialize a wallet in storage with the provided properties. Read more
Source§fn initialize_bdk_wallet(&self) -> Result<ChangeSet>
fn initialize_bdk_wallet(&self) -> Result<ChangeSet>
Initialize the onchain BDK wallet and return any previously stored ChangeSet. Read more
Source§fn store_bdk_wallet_changeset(&self, changeset: &ChangeSet) -> Result<()>
fn store_bdk_wallet_changeset(&self, changeset: &ChangeSet) -> Result<()>
Persist an incremental BDK ChangeSet. Read more
Source§fn read_properties(&self) -> Result<Option<WalletProperties>>
fn read_properties(&self) -> Result<Option<WalletProperties>>
Read wallet properties from storage. Read more
Source§fn check_recipient_exists(&self, recipient: &str) -> Result<bool>
fn check_recipient_exists(&self, recipient: &str) -> Result<bool>
Check whether a recipient identifier already exists. Read more
Source§fn create_new_movement(
&self,
status: MovementStatus,
subsystem: &MovementSubsystem,
time: DateTime<Local>,
) -> Result<MovementId>
fn create_new_movement( &self, status: MovementStatus, subsystem: &MovementSubsystem, time: DateTime<Local>, ) -> Result<MovementId>
Creates a new movement in the given state, ready to be updated. Read more
Source§fn update_movement(&self, movement: &Movement) -> Result<()>
fn update_movement(&self, movement: &Movement) -> Result<()>
Persists the given movement state. Read more
Source§fn get_movement_by_id(&self, movement_id: MovementId) -> Result<Movement>
fn get_movement_by_id(&self, movement_id: MovementId) -> Result<Movement>
Gets the movement with the given MovementId. Read more
Source§fn store_pending_board(
&self,
vtxo: &Vtxo,
funding_tx: &Transaction,
movement_id: MovementId,
) -> Result<()>
fn store_pending_board( &self, vtxo: &Vtxo, funding_tx: &Transaction, movement_id: MovementId, ) -> Result<()>
Store a pending board. Read more
Source§fn remove_pending_board(&self, vtxo_id: &VtxoId) -> Result<()>
fn remove_pending_board(&self, vtxo_id: &VtxoId) -> Result<()>
Remove a pending board. Read more
Source§fn get_pending_board_by_vtxo_id(
&self,
vtxo_id: VtxoId,
) -> Result<Option<PendingBoard>>
fn get_pending_board_by_vtxo_id( &self, vtxo_id: VtxoId, ) -> Result<Option<PendingBoard>>
Source§fn store_round_state_lock_vtxos(
&self,
round_state: &RoundState,
) -> Result<RoundStateId>
fn store_round_state_lock_vtxos( &self, round_state: &RoundState, ) -> Result<RoundStateId>
Store a new ongoing round state and lock the VTXOs in round Read more
Source§fn update_round_state(&self, state: &StoredRoundState) -> Result<()>
fn update_round_state(&self, state: &StoredRoundState) -> Result<()>
Update an existing stored pending round state Read more
Source§fn remove_round_state(&self, round_state: &StoredRoundState) -> Result<()>
fn remove_round_state(&self, round_state: &StoredRoundState) -> Result<()>
Remove a pending round state from the db Read more
Source§fn load_round_states(&self) -> Result<Vec<StoredRoundState>>
fn load_round_states(&self) -> Result<Vec<StoredRoundState>>
Load all pending round states from the db Read more
Source§fn store_recovered_round(&self, round: &UnconfirmedRound) -> Result<()>
fn store_recovered_round(&self, round: &UnconfirmedRound) -> Result<()>
Store a recovered past round
Source§fn remove_recovered_round(&self, funding_txid: Txid) -> Result<()>
fn remove_recovered_round(&self, funding_txid: Txid) -> Result<()>
Remove a recovered past round
Source§fn load_recovered_rounds(&self) -> Result<Vec<UnconfirmedRound>>
fn load_recovered_rounds(&self) -> Result<Vec<UnconfirmedRound>>
Load the recovered past rounds
Source§fn store_vtxos(&self, vtxos: &[(&Vtxo, &VtxoState)]) -> Result<()>
fn store_vtxos(&self, vtxos: &[(&Vtxo, &VtxoState)]) -> Result<()>
Stores the given VTXOs in the given VtxoState.
Source§fn get_wallet_vtxo(&self, id: VtxoId) -> Result<Option<WalletVtxo>>
fn get_wallet_vtxo(&self, id: VtxoId) -> Result<Option<WalletVtxo>>
Source§fn get_all_vtxos(&self) -> Result<Vec<WalletVtxo>>
fn get_all_vtxos(&self) -> Result<Vec<WalletVtxo>>
Fetch all wallet VTXOs in the database. Read more
Source§fn store_new_pending_lightning_send(
&self,
invoice: &Invoice,
amount: &Amount,
vtxos: &[VtxoId],
movement_id: MovementId,
) -> Result<LightningSend>
fn store_new_pending_lightning_send( &self, invoice: &Invoice, amount: &Amount, vtxos: &[VtxoId], movement_id: MovementId, ) -> Result<LightningSend>
Store a new pending lightning send. Read more
Source§fn get_all_pending_lightning_send(&self) -> Result<Vec<LightningSend>>
fn get_all_pending_lightning_send(&self) -> Result<Vec<LightningSend>>
Get all pending lightning sends. Read more
Source§fn finish_lightning_send(
&self,
payment_hash: PaymentHash,
preimage: Option<Preimage>,
) -> Result<()>
fn finish_lightning_send( &self, payment_hash: PaymentHash, preimage: Option<Preimage>, ) -> Result<()>
Mark a lightning send as finished. Read more
Source§fn remove_lightning_send(&self, payment_hash: PaymentHash) -> Result<()>
fn remove_lightning_send(&self, payment_hash: PaymentHash) -> Result<()>
Remove a lightning send. Read more
Source§fn get_lightning_send(
&self,
payment_hash: PaymentHash,
) -> Result<Option<LightningSend>>
fn get_lightning_send( &self, payment_hash: PaymentHash, ) -> Result<Option<LightningSend>>
Get a lightning send by payment hash Read more
Source§fn get_all_pending_lightning_receives(&self) -> Result<Vec<LightningReceive>>
fn get_all_pending_lightning_receives(&self) -> Result<Vec<LightningReceive>>
Returns a list of all pending lightning receives Read more
Source§fn set_preimage_revealed(&self, payment_hash: PaymentHash) -> Result<()>
fn set_preimage_revealed(&self, payment_hash: PaymentHash) -> Result<()>
Mark a Lightning receive preimage as revealed (e.g., after settlement). Read more
Source§fn update_lightning_receive(
&self,
payment_hash: PaymentHash,
htlc_vtxo_ids: &[VtxoId],
movement_id: MovementId,
) -> Result<()>
fn update_lightning_receive( &self, payment_hash: PaymentHash, htlc_vtxo_ids: &[VtxoId], movement_id: MovementId, ) -> Result<()>
Source§fn finish_pending_lightning_receive(
&self,
payment_hash: PaymentHash,
) -> Result<()>
fn finish_pending_lightning_receive( &self, payment_hash: PaymentHash, ) -> Result<()>
Remove a Lightning receive by its payment hash. Read more
Source§fn store_exit_vtxo_entry(&self, exit: &StoredExit) -> Result<()>
fn store_exit_vtxo_entry(&self, exit: &StoredExit) -> Result<()>
Source§fn get_exit_vtxo_entries(&self) -> Result<Vec<StoredExit>>
fn get_exit_vtxo_entries(&self) -> Result<Vec<StoredExit>>
List all VTXOs currently tracked as being exited. Read more
Source§fn store_exit_child_tx(
&self,
exit_txid: Txid,
child_tx: &Transaction,
origin: ExitTxOrigin,
) -> Result<()>
fn store_exit_child_tx( &self, exit_txid: Txid, child_tx: &Transaction, origin: ExitTxOrigin, ) -> Result<()>
Store a child transaction related to an exit transaction. Read more
Source§fn get_exit_child_tx(
&self,
exit_txid: Txid,
) -> Result<Option<(Transaction, ExitTxOrigin)>>
fn get_exit_child_tx( &self, exit_txid: Txid, ) -> Result<Option<(Transaction, ExitTxOrigin)>>
Retrieve a stored child transaction for a given exit transaction ID. Read more
Source§fn update_vtxo_state_checked(
&self,
vtxo_id: VtxoId,
new_state: VtxoState,
allowed_old_states: &[VtxoStateKind],
) -> Result<WalletVtxo>
fn update_vtxo_state_checked( &self, vtxo_id: VtxoId, new_state: VtxoState, allowed_old_states: &[VtxoStateKind], ) -> Result<WalletVtxo>
Source§impl Clone for SqliteClient
impl Clone for SqliteClient
Source§fn clone(&self) -> SqliteClient
fn clone(&self) -> SqliteClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SqliteClient
impl RefUnwindSafe for SqliteClient
impl Send for SqliteClient
impl Sync for SqliteClient
impl Unpin for SqliteClient
impl UnwindSafe for SqliteClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request