pub struct SqliteDatabase {
    pub path: PathBuf,
    pub connection: Connection,
}
Expand description

Sqlite database stored on filesystem

This is a permanent storage solution for devices and platforms that provide a filesystem. crate::database

Fields§

§path: PathBuf

Path on the local filesystem to store the sqlite file

§connection: Connection

A rusqlite connection object to the sqlite database

Implementations§

source§

impl SqliteDatabase

source

pub fn new<T: AsRef<Path>>(path: T) -> Self

Instantiate a new SqliteDatabase instance by creating a connection to the database stored at path

Trait Implementations§

source§

impl BatchDatabase for SqliteDatabase

§

type Batch = SqliteDatabase

Container for the operations
source§

fn begin_batch(&self) -> Self::Batch

Create a new batch container
source§

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

Consume and apply a batch of operations
source§

impl BatchOperations for SqliteDatabase

source§

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.
source§

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

Store a LocalUtxo
source§

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

Store a raw transaction
source§

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>

Store the last derivation index for a given keychain.
source§

fn set_sync_time(&mut self, ct: SyncTime) -> Result<(), Error>

Store the sync time
source§

fn del_script_pubkey_from_path( &mut self, keychain: KeychainKind, child: u32 ) -> Result<Option<ScriptBuf>, 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>

Delete the data related to a specific script_pubkey, meaning the keychain and the child number.
source§

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

Delete a LocalUtxo given its OutPoint
source§

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>

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>

Delete the last derivation index for a keychain.
source§

fn del_sync_time(&mut self) -> Result<Option<SyncTime>, Error>

Reset the sync time to None Read more
source§

impl ConfigurableDatabase for SqliteDatabase

§

type Config = SqliteDbConfiguration

Type that contains the configuration
source§

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

Create a new instance given a configuration
source§

impl Database for SqliteDatabase

source§

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

Return the list of script_pubkeys
source§

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

Return the list of LocalUtxos
source§

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>

Return the list of transactions metadata
source§

fn get_script_pubkey_from_path( &self, keychain: KeychainKind, child: u32 ) -> Result<Option<ScriptBuf>, 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>

Fetch the keychain and child number of a given script_pubkey
source§

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

Fetch a LocalUtxo given its OutPoint
source§

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>

Fetch the transaction metadata and optionally also the raw transaction
source§

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

Return the last derivation index for a keychain.
source§

fn get_sync_time(&self) -> Result<Option<SyncTime>, Error>

Return the sync time, if present
source§

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 SqliteDatabase

source§

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

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

impl From<<SqliteDatabase as BatchDatabase>::Batch> for AnyBatch

source§

fn from(inner: <SqliteDatabase as BatchDatabase>::Batch) -> Self

Converts to this type from the input type.
source§

impl From<SqliteDatabase> for AnyDatabase

source§

fn from(inner: SqliteDatabase) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V