Struct SqliteClient

Source
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

Source

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

Source§

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<()>

Store a lightning receive

Source§

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<()>

Initialize a wallet in storage with the provided properties. Read more
Source§

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<()>

Persist an incremental BDK ChangeSet. Read more
Source§

fn read_properties(&self) -> Result<Option<WalletProperties>>

Read wallet properties from storage. Read more
Source§

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>

Creates a new movement in the given state, ready to be updated. Read more
Source§

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>

Gets the movement with the given MovementId. Read more
Source§

fn get_all_movements(&self) -> Result<Vec<Movement>>

Gets every stored movement. Read more
Source§

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<()>

Remove a pending board. Read more
Source§

fn get_all_pending_board_ids(&self) -> Result<Vec<VtxoId>>

Get the VtxoId for each pending board. Read more
Source§

fn get_pending_board_by_vtxo_id( &self, vtxo_id: VtxoId, ) -> Result<Option<PendingBoard>>

Get the PendingBoard associated with the given VtxoId. Read more
Source§

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<()>

Update an existing stored pending round state Read more
Source§

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>>

Load all pending round states from the db Read more
Source§

fn store_recovered_round(&self, round: &UnconfirmedRound) -> Result<()>

Store a recovered past round
Source§

fn remove_recovered_round(&self, funding_txid: Txid) -> Result<()>

Remove a recovered past round
Source§

fn load_recovered_rounds(&self) -> Result<Vec<UnconfirmedRound>>

Load the recovered past rounds
Source§

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>>

Fetch a wallet Vtxo with its current state by ID. Read more
Source§

fn get_all_vtxos(&self) -> Result<Vec<WalletVtxo>>

Fetch all wallet VTXOs in the database. Read more
Source§

fn has_spent_vtxo(&self, id: VtxoId) -> Result<bool>

Check whether a Vtxo is already marked spent. Read more
Source§

fn remove_vtxo(&self, id: VtxoId) -> Result<Option<Vtxo>>

Remove a Vtxo by ID. Read more
Source§

fn store_vtxo_key(&self, index: u32, public_key: PublicKey) -> Result<()>

Store a newly derived/assigned Vtxo public key index mapping. Read more
Source§

fn get_last_vtxo_key_index(&self) -> Result<Option<u32>>

Get the last revealed/used Vtxo key index. Read more
Source§

fn get_public_key_idx(&self, public_key: &PublicKey) -> Result<Option<u32>>

Retrieves the derivation index of the provided PublicKey from the database Read more
Source§

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>>

Get all pending lightning sends. Read more
Source§

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<()>

Remove a lightning send. Read more
Source§

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>>

Returns a list of all pending lightning receives Read more
Source§

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<()>

Set the VTXO IDs and MovementId for a LightningReceive. Read more
Source§

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<()>

Store an entry indicating a Vtxo is being exited. Read more
Source§

fn remove_exit_vtxo_entry(&self, id: &VtxoId) -> Result<()>

Remove an exit entry for a given Vtxo ID. Read more
Source§

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<()>

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)>>

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>

Updates the state of the VTXO corresponding to the given VtxoId, provided that their current state is one of the given allowed_states. Read more
Source§

impl Clone for SqliteClient

Source§

fn clone(&self) -> SqliteClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

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

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

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

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

Source§

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
Source§

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,