Enum bdk::database::any::AnyDatabase[][src]

pub enum AnyDatabase {
    Memory(MemoryDatabase),
    Sled(Tree),
}

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)
This is supported on crate feature key-value-db only.

Simple key-value embedded database based on [sled]

Trait Implementations

impl BatchDatabase for AnyDatabase[src]

type Batch = AnyBatch

Container for the operations

fn begin_batch(&self) -> Self::Batch[src]

Create a new batch container

fn commit_batch(&mut self, batch: Self::Batch) -> Result<(), Error>[src]

Consume and apply a batch of operations

impl BatchOperations for AnyDatabase[src]

fn set_script_pubkey(
    &mut self,
    script: &Script,
    keychain: KeychainKind,
    child: u32
) -> Result<(), Error>
[src]

Store a script_pubkey along with its keychain and child number.

fn set_utxo(&mut self, utxo: &LocalUtxo) -> Result<(), Error>[src]

Store a LocalUtxo

fn set_raw_tx(&mut self, transaction: &Transaction) -> Result<(), Error>[src]

Store a raw transaction

fn set_tx(&mut self, transaction: &TransactionDetails) -> Result<(), Error>[src]

Store the metadata of a transaction

fn set_last_index(
    &mut self,
    keychain: KeychainKind,
    value: u32
) -> Result<(), Error>
[src]

Store the last derivation index for a given keychain.

fn del_script_pubkey_from_path(
    &mut self,
    keychain: KeychainKind,
    child: u32
) -> Result<Option<Script>, Error>
[src]

Delete a script_pubkey given the keychain and its child number.

fn del_path_from_script_pubkey(
    &mut self,
    script: &Script
) -> Result<Option<(KeychainKind, u32)>, Error>
[src]

Delete the data related to a specific script_pubkey, meaning the keychain and the child number. Read more

fn del_utxo(&mut self, outpoint: &OutPoint) -> Result<Option<LocalUtxo>, Error>[src]

Delete a LocalUtxo given its [OutPoint]

fn del_raw_tx(&mut self, txid: &Txid) -> Result<Option<Transaction>, Error>[src]

Delete a raw transaction given its [Txid]

fn del_tx(
    &mut self,
    txid: &Txid,
    include_raw: bool
) -> Result<Option<TransactionDetails>, Error>
[src]

Delete the metadata of a transaction and optionally the raw transaction itself

fn del_last_index(
    &mut self,
    keychain: KeychainKind
) -> Result<Option<u32>, Error>
[src]

Delete the last derivation index for a keychain.

impl ConfigurableDatabase for AnyDatabase[src]

type Config = AnyDatabaseConfig

Type that contains the configuration

fn from_config(config: &Self::Config) -> Result<Self, Error>[src]

Create a new instance given a configuration

impl Database for AnyDatabase[src]

fn check_descriptor_checksum<B: AsRef<[u8]>>(
    &mut self,
    keychain: KeychainKind,
    bytes: B
) -> Result<(), Error>
[src]

Read and checks the descriptor checksum for a given keychain. Read more

fn iter_script_pubkeys(
    &self,
    keychain: Option<KeychainKind>
) -> Result<Vec<Script>, Error>
[src]

Return the list of script_pubkeys

fn iter_utxos(&self) -> Result<Vec<LocalUtxo>, Error>[src]

Return the list of LocalUtxos

fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>[src]

Return the list of raw transactions

fn iter_txs(&self, include_raw: bool) -> Result<Vec<TransactionDetails>, Error>[src]

Return the list of transactions metadata

fn get_script_pubkey_from_path(
    &self,
    keychain: KeychainKind,
    child: u32
) -> Result<Option<Script>, Error>
[src]

Fetch a script_pubkey given the child number of a keychain.

fn get_path_from_script_pubkey(
    &self,
    script: &Script
) -> Result<Option<(KeychainKind, u32)>, Error>
[src]

Fetch the keychain and child number of a given script_pubkey

fn get_utxo(&self, outpoint: &OutPoint) -> Result<Option<LocalUtxo>, Error>[src]

Fetch a LocalUtxo given its [OutPoint]

fn get_raw_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error>[src]

Fetch a raw transaction given its [Txid]

fn get_tx(
    &self,
    txid: &Txid,
    include_raw: bool
) -> Result<Option<TransactionDetails>, Error>
[src]

Fetch the transaction metadata and optionally also the raw transaction

fn get_last_index(&self, keychain: KeychainKind) -> Result<Option<u32>, Error>[src]

Return the last defivation index for a keychain.

fn increment_last_index(&mut self, keychain: KeychainKind) -> Result<u32, Error>[src]

Increment the last derivation index for a keychain and return it Read more

impl Debug for AnyDatabase[src]

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

Formats the value using the given formatter. Read more

impl From<MemoryDatabase> for AnyDatabase[src]

fn from(inner: MemoryDatabase) -> Self[src]

Performs the conversion.

impl From<Tree> for AnyDatabase[src]

fn from(inner: Tree) -> Self[src]

Performs the conversion.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

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

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

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V