Struct Store

Source
pub struct Store { /* private fields */ }
Expand description

Persists the bdk_chain and bdk_wallet structures in a redb database.

This is the primary struct of this crate. It holds the database corresponding to a wallet. It also holds the table names of redb tables which are specific to each wallet in a database file.

Implementations§

Source§

impl Store

Source

pub fn new(db: Arc<Database>, wallet_name: String) -> Result<Self, StoreError>

This function creates a brand new Store.

Source

pub fn create_tables<A: AnchorWithMetaData>(&self) -> Result<(), StoreError>

This function creates or opens (if already created) all redb tables corresponding to a Wallet.

Source

pub fn create_local_chain_tables(&self) -> Result<(), StoreError>

This function creates or opens (if already created) the redb tables corresponding to local_chain.

Source

pub fn create_tx_graph_tables<A: AnchorWithMetaData>( &self, ) -> Result<(), StoreError>

This function creates or opens (if already created) the redb tables corresponding to TxGraph.

Source

pub fn create_indexer_tables(&self) -> Result<(), StoreError>

This function creates or opens (if already created) the redb tables corresponding to indexer.

Source

pub fn create_keychains_table(&self) -> Result<(), StoreError>

This function creates or opens (if already created) the keychains redb table corresponding to the wallet.

Source

pub fn create_network_table(&self) -> Result<(), StoreError>

This function creates or opens (if already created) the Network redb table. This table is common to all wallets persisted in the database file.

Source

pub fn persist_wallet(&self, changeset: &ChangeSet) -> Result<(), StoreError>

This function persists the Wallet into our db. It persists each field by calling corresponding persistence functions.

Source

pub fn persist_tx_graph<A: AnchorWithMetaData>( &self, changeset: &ChangeSet<A>, ) -> Result<(), StoreError>

This function persists the TxGraph into our db. It persists each field by calling corresponding persistence functions.

Source

pub fn persist_indexer(&self, changeset: &ChangeSet) -> Result<(), StoreError>

This function persists the indexer structures into our db. It persists each field by calling corresponding persistence functions.

Source

pub fn persist_keychains( &self, changeset: &BTreeMap<u64, Descriptor<DescriptorPublicKey>>, ) -> Result<(), StoreError>

This function persists the descriptors into our db.

Source

pub fn persist_network( &self, network: &Option<Network>, ) -> Result<(), StoreError>

This function persists the Network into our db.

Warning: Do Not use with MAINNET
Source

pub fn persist_local_chain( &self, changeset: &ChangeSet, ) -> Result<(), StoreError>

This function persists the LocalChain structure into our db. It persists each field by calling corresponding persistence functions.

Source

pub fn read_wallet(&self, changeset: &mut ChangeSet) -> Result<(), StoreError>

This function loads the Wallet by calling corresponding load functions for each of its fields.s

Source

pub fn read_tx_graph<A: AnchorWithMetaData>( &self, changeset: &mut ChangeSet<A>, ) -> Result<(), StoreError>

This function loads the TxGraph from db. It loads each field by calling corresponding load functions.

Source

pub fn read_indexer(&self, changeset: &mut ChangeSet) -> Result<(), StoreError>

This function loads the indexer structures from our db. It loads each field by calling corresponding load functions.

Source

pub fn read_keychains( &self, desc_changeset: &mut BTreeMap<u64, Descriptor<DescriptorPublicKey>>, ) -> Result<(), StoreError>

This function loads descriptors from db.

Source

pub fn read_network( &self, network: &mut Option<Network>, ) -> Result<(), StoreError>

This function loads the Network from our db.

Warning: Do Not use with MAINNET
Source

pub fn read_local_chain( &self, changeset: &mut ChangeSet, ) -> Result<(), StoreError>

This function loads the LocalChain structure from our db. It loads each field by calling corresponding load functions.

Trait Implementations§

Source§

impl Debug for Store

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl WalletPersister for Store

Source§

type Error = StoreError

Error type of the persister.
Source§

fn initialize(persister: &mut Self) -> Result<ChangeSet, Self::Error>

Initialize the persister and load all data. Read more
Source§

fn persist( persister: &mut Self, changeset: &ChangeSet, ) -> Result<(), Self::Error>

Persist the given changeset to the persister. Read more

Auto Trait Implementations§

§

impl Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl !UnwindSafe for Store

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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