pub struct MemoryDatabase { /* private fields */ }
Expand description
In-memory ephemeral database
This database can be used as a temporary storage for wallets that are not kept permanently on
a device, or on platforms that don’t provide a filesystem, like wasm32
.
Once it’s dropped its content will be lost.
If you are looking for a permanent storage solution, you can try with the default key-value
database called sled
. See the database
module documentation for more details.
Implementations§
Trait Implementations§
Source§impl BatchDatabase for MemoryDatabase
impl BatchDatabase for MemoryDatabase
Source§type Batch = MemoryDatabase
type Batch = MemoryDatabase
Container for the operations
Source§fn begin_batch(&self) -> Self::Batch
fn begin_batch(&self) -> Self::Batch
Create a new batch container
Source§impl BatchOperations for MemoryDatabase
impl BatchOperations for MemoryDatabase
Source§fn set_script_pubkey(
&mut self,
script: &Script,
keychain: KeychainKind,
path: u32,
) -> Result<(), Error>
fn set_script_pubkey( &mut self, script: &Script, keychain: KeychainKind, path: u32, ) -> Result<(), Error>
Store a script_pubkey along with its keychain and child number.
Source§fn set_raw_tx(&mut self, transaction: &Transaction) -> Result<(), Error>
fn set_raw_tx(&mut self, transaction: &Transaction) -> Result<(), Error>
Store a raw transaction
Source§fn set_tx(&mut self, transaction: &TransactionDetails) -> Result<(), Error>
fn set_tx(&mut self, transaction: &TransactionDetails) -> Result<(), Error>
Store the metadata of a transaction
Source§fn 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.
Source§fn del_script_pubkey_from_path(
&mut self,
keychain: KeychainKind,
path: u32,
) -> Result<Option<Script>, Error>
fn del_script_pubkey_from_path( &mut self, keychain: KeychainKind, path: u32, ) -> Result<Option<Script>, Error>
Delete a script_pubkey given the keychain and its child number.
Source§fn 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.
Source§fn 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
Source§fn 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
Source§fn 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.
Source§impl Database for MemoryDatabase
impl Database for MemoryDatabase
Source§fn 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
Source§fn 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
Source§fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>
fn iter_raw_txs(&self) -> Result<Vec<Transaction>, Error>
Return the list of raw transactions
Source§fn 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
Source§fn get_script_pubkey_from_path(
&self,
keychain: KeychainKind,
path: u32,
) -> Result<Option<Script>, Error>
fn get_script_pubkey_from_path( &self, keychain: KeychainKind, path: u32, ) -> Result<Option<Script>, Error>
Fetch a script_pubkey given the child number of a keychain.
Source§fn 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
Source§fn 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
Source§fn 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
Source§fn 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.
Source§fn 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
Source§impl Debug for MemoryDatabase
impl Debug for MemoryDatabase
Source§impl Default for MemoryDatabase
impl Default for MemoryDatabase
Source§fn default() -> MemoryDatabase
fn default() -> MemoryDatabase
Returns the “default value” for a type. Read more
Source§impl From<<MemoryDatabase as BatchDatabase>::Batch> for AnyBatch
impl From<<MemoryDatabase as BatchDatabase>::Batch> for AnyBatch
Source§fn from(inner: <MemoryDatabase as BatchDatabase>::Batch) -> Self
fn from(inner: <MemoryDatabase as BatchDatabase>::Batch) -> Self
Converts to this type from the input type.
Source§impl From<MemoryDatabase> for AnyDatabase
impl From<MemoryDatabase> for AnyDatabase
Source§fn from(inner: MemoryDatabase) -> Self
fn from(inner: MemoryDatabase) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for MemoryDatabase
impl !RefUnwindSafe for MemoryDatabase
impl Send for MemoryDatabase
impl Sync for MemoryDatabase
impl Unpin for MemoryDatabase
impl !UnwindSafe for MemoryDatabase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more