pub enum AnyDatabase {
Memory(MemoryDatabase),
Sled(Tree),
Sqlite(SqliteDatabase),
}
Expand description
Type that can contain any of the Database
types defined by the library
It allows switching database type at runtime.
See this module’s documentation for a usage example.
Variants
Memory(MemoryDatabase)
In-memory ephemeral database
Sled(Tree)
key-value-db
only.Simple key-value embedded database based on sled
Sqlite(SqliteDatabase)
sqlite
only.Sqlite embedded database using rusqlite
Trait Implementations
sourceimpl BatchDatabase for AnyDatabase
impl BatchDatabase for AnyDatabase
sourceimpl BatchOperations for AnyDatabase
impl BatchOperations for AnyDatabase
sourcefn set_script_pubkey(
&mut self,
script: &Script,
keychain: KeychainKind,
child: u32
) -> Result<(), Error>
fn set_script_pubkey(
&mut self,
script: &Script,
keychain: KeychainKind,
child: u32
) -> Result<(), Error>
Store a script_pubkey along with its keychain and child number.
sourcefn set_raw_tx(&mut self, transaction: &Transaction) -> Result<(), Error>
fn set_raw_tx(&mut self, transaction: &Transaction) -> Result<(), Error>
Store a raw transaction
sourcefn set_tx(&mut self, transaction: &TransactionDetails) -> Result<(), Error>
fn set_tx(&mut self, transaction: &TransactionDetails) -> Result<(), Error>
Store the metadata of a transaction
sourcefn set_last_index(
&mut self,
keychain: KeychainKind,
value: u32
) -> Result<(), Error>
fn set_last_index(
&mut self,
keychain: KeychainKind,
value: u32
) -> Result<(), Error>
Store the last derivation index for a given keychain.
sourcefn del_script_pubkey_from_path(
&mut self,
keychain: KeychainKind,
child: u32
) -> Result<Option<Script>, Error>
fn del_script_pubkey_from_path(
&mut self,
keychain: KeychainKind,
child: u32
) -> Result<Option<Script>, Error>
Delete a script_pubkey given the keychain and its child number.
sourcefn del_path_from_script_pubkey(
&mut self,
script: &Script
) -> Result<Option<(KeychainKind, u32)>, Error>
fn del_path_from_script_pubkey(
&mut self,
script: &Script
) -> Result<Option<(KeychainKind, u32)>, Error>
Delete the data related to a specific script_pubkey, meaning the keychain and the child number. Read more
sourcefn del_raw_tx(&mut self, txid: &Txid) -> Result<Option<Transaction>, Error>
fn del_raw_tx(&mut self, txid: &Txid) -> Result<Option<Transaction>, Error>
Delete a raw transaction given its Txid
sourcefn del_tx(
&mut self,
txid: &Txid,
include_raw: bool
) -> Result<Option<TransactionDetails>, Error>
fn del_tx(
&mut self,
txid: &Txid,
include_raw: bool
) -> Result<Option<TransactionDetails>, Error>
Delete the metadata of a transaction and optionally the raw transaction itself
sourcefn del_last_index(
&mut self,
keychain: KeychainKind
) -> Result<Option<u32>, Error>
fn del_last_index(
&mut self,
keychain: KeychainKind
) -> Result<Option<u32>, Error>
Delete the last derivation index for a keychain.
sourceimpl ConfigurableDatabase for AnyDatabase
impl ConfigurableDatabase for AnyDatabase
type Config = AnyDatabaseConfig
type Config = AnyDatabaseConfig
Type that contains the configuration
sourcefn from_config(config: &Self::Config) -> Result<Self, Error>
fn from_config(config: &Self::Config) -> Result<Self, Error>
Create a new instance given a configuration
sourceimpl Database for AnyDatabase
impl Database for AnyDatabase
sourcefn check_descriptor_checksum<B: AsRef<[u8]>>(
&mut self,
keychain: KeychainKind,
bytes: B
) -> Result<(), Error>
fn check_descriptor_checksum<B: AsRef<[u8]>>(
&mut self,
keychain: KeychainKind,
bytes: B
) -> Result<(), Error>
Read and checks the descriptor checksum for a given keychain. Read more
sourcefn iter_script_pubkeys(
&self,
keychain: Option<KeychainKind>
) -> Result<Vec<Script>, Error>
fn iter_script_pubkeys(
&self,
keychain: Option<KeychainKind>
) -> Result<Vec<Script>, Error>
Return the list of script_pubkeys
sourcefn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>
fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>
Return the list of raw transactions
sourcefn iter_txs(&self, include_raw: bool) -> Result<Vec<TransactionDetails>, Error>
fn iter_txs(&self, include_raw: bool) -> Result<Vec<TransactionDetails>, Error>
Return the list of transactions metadata
sourcefn get_script_pubkey_from_path(
&self,
keychain: KeychainKind,
child: u32
) -> Result<Option<Script>, Error>
fn get_script_pubkey_from_path(
&self,
keychain: KeychainKind,
child: u32
) -> Result<Option<Script>, Error>
Fetch a script_pubkey given the child number of a keychain.
sourcefn get_path_from_script_pubkey(
&self,
script: &Script
) -> Result<Option<(KeychainKind, u32)>, Error>
fn get_path_from_script_pubkey(
&self,
script: &Script
) -> Result<Option<(KeychainKind, u32)>, Error>
Fetch the keychain and child number of a given script_pubkey
sourcefn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>
fn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>
Fetch a raw transaction given its Txid
sourcefn get_tx(
&self,
txid: &Txid,
include_raw: bool
) -> Result<Option<TransactionDetails>, Error>
fn get_tx(
&self,
txid: &Txid,
include_raw: bool
) -> Result<Option<TransactionDetails>, Error>
Fetch the transaction metadata and optionally also the raw transaction
sourcefn get_last_index(&self, keychain: KeychainKind) -> Result<Option<u32>, Error>
fn get_last_index(&self, keychain: KeychainKind) -> Result<Option<u32>, Error>
Return the last derivation index for a keychain.
sourcefn increment_last_index(&mut self, keychain: KeychainKind) -> Result<u32, Error>
fn increment_last_index(&mut self, keychain: KeychainKind) -> Result<u32, Error>
Increment the last derivation index for a keychain and return it Read more
sourceimpl Debug for AnyDatabase
impl Debug for AnyDatabase
sourceimpl From<MemoryDatabase> for AnyDatabase
impl From<MemoryDatabase> for AnyDatabase
sourcefn from(inner: MemoryDatabase) -> Self
fn from(inner: MemoryDatabase) -> Self
Converts to this type from the input type.
sourceimpl From<SqliteDatabase> for AnyDatabase
impl From<SqliteDatabase> for AnyDatabase
sourcefn from(inner: SqliteDatabase) -> Self
fn from(inner: SqliteDatabase) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for AnyDatabase
impl Send for AnyDatabase
impl !Sync for AnyDatabase
impl Unpin for AnyDatabase
impl !UnwindSafe for AnyDatabase
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more