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
impl Store
Sourcepub fn new(db: Arc<Database>, wallet_name: String) -> Result<Self, StoreError>
pub fn new(db: Arc<Database>, wallet_name: String) -> Result<Self, StoreError>
This function creates a brand new Store.
Sourcepub fn create_tables<A: AnchorWithMetaData>(&self) -> Result<(), StoreError>
pub fn create_tables<A: AnchorWithMetaData>(&self) -> Result<(), StoreError>
This function creates or opens (if already created) all redb tables corresponding to a
Wallet.
Sourcepub fn create_local_chain_tables(&self) -> Result<(), StoreError>
pub fn create_local_chain_tables(&self) -> Result<(), StoreError>
This function creates or opens (if already created) the redb tables corresponding to local_chain.
Sourcepub fn create_tx_graph_tables<A: AnchorWithMetaData>(
&self,
) -> Result<(), StoreError>
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.
Sourcepub fn create_indexer_tables(&self) -> Result<(), StoreError>
pub fn create_indexer_tables(&self) -> Result<(), StoreError>
This function creates or opens (if already created) the redb tables corresponding to
indexer.
Sourcepub fn create_keychains_table(&self) -> Result<(), StoreError>
pub fn create_keychains_table(&self) -> Result<(), StoreError>
This function creates or opens (if already created) the keychains redb table corresponding to the wallet.
Sourcepub fn create_network_table(&self) -> Result<(), StoreError>
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.
Sourcepub fn persist_wallet(&self, changeset: &ChangeSet) -> Result<(), StoreError>
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.
Sourcepub fn persist_tx_graph<A: AnchorWithMetaData>(
&self,
changeset: &ChangeSet<A>,
) -> Result<(), StoreError>
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.
Sourcepub fn persist_indexer(&self, changeset: &ChangeSet) -> Result<(), StoreError>
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.
Sourcepub fn persist_keychains(
&self,
changeset: &BTreeMap<u64, Descriptor<DescriptorPublicKey>>,
) -> Result<(), StoreError>
pub fn persist_keychains( &self, changeset: &BTreeMap<u64, Descriptor<DescriptorPublicKey>>, ) -> Result<(), StoreError>
This function persists the descriptors into our db.
Sourcepub fn persist_network(
&self,
network: &Option<Network>,
) -> Result<(), StoreError>
pub fn persist_network( &self, network: &Option<Network>, ) -> Result<(), StoreError>
This function persists the Network into our db.
Sourcepub fn persist_local_chain(
&self,
changeset: &ChangeSet,
) -> Result<(), StoreError>
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.
Sourcepub fn read_wallet(&self, changeset: &mut ChangeSet) -> Result<(), StoreError>
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
Sourcepub fn read_tx_graph<A: AnchorWithMetaData>(
&self,
changeset: &mut ChangeSet<A>,
) -> Result<(), StoreError>
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.
Sourcepub fn read_indexer(&self, changeset: &mut ChangeSet) -> Result<(), StoreError>
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.
Sourcepub fn read_keychains(
&self,
desc_changeset: &mut BTreeMap<u64, Descriptor<DescriptorPublicKey>>,
) -> Result<(), StoreError>
pub fn read_keychains( &self, desc_changeset: &mut BTreeMap<u64, Descriptor<DescriptorPublicKey>>, ) -> Result<(), StoreError>
This function loads descriptors from db.
Sourcepub fn read_network(
&self,
network: &mut Option<Network>,
) -> Result<(), StoreError>
pub fn read_network( &self, network: &mut Option<Network>, ) -> Result<(), StoreError>
This function loads the Network from our db.
Sourcepub fn read_local_chain(
&self,
changeset: &mut ChangeSet,
) -> Result<(), StoreError>
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.