Struct bdk_chain::local_chain::ChangeSet
source · pub struct ChangeSet {
pub blocks: BTreeMap<u32, Option<BlockHash>>,
}
Expand description
The ChangeSet
represents changes to LocalChain
.
Fields§
§blocks: BTreeMap<u32, Option<BlockHash>>
Changes to the LocalChain
blocks.
The key represents the block height, and the value either represents added a new CheckPoint
(if Some
), or removing a CheckPoint
(if None
).
Implementations§
source§impl ChangeSet
impl ChangeSet
sourcepub const SCHEMA_NAME: &'static str = "bdk_localchain"
pub const SCHEMA_NAME: &'static str = "bdk_localchain"
Schema name for the changeset.
sourcepub const BLOCKS_TABLE_NAME: &'static str = "bdk_blocks"
pub const BLOCKS_TABLE_NAME: &'static str = "bdk_blocks"
Name of sqlite table that stores blocks of LocalChain
.
sourcepub fn init_sqlite_tables(db_tx: &Transaction<'_>) -> Result<()>
pub fn init_sqlite_tables(db_tx: &Transaction<'_>) -> Result<()>
Initialize sqlite tables for persisting local_chain::LocalChain
.
sourcepub fn from_sqlite(db_tx: &Transaction<'_>) -> Result<Self>
pub fn from_sqlite(db_tx: &Transaction<'_>) -> Result<Self>
Construct a LocalChain
from sqlite database.
Remember to call Self::init_sqlite_tables
beforehand.
sourcepub fn persist_to_sqlite(&self, db_tx: &Transaction<'_>) -> Result<()>
pub fn persist_to_sqlite(&self, db_tx: &Transaction<'_>) -> Result<()>
Persist changeset
to the sqlite database.
Remember to call Self::init_sqlite_tables
beforehand.
Trait Implementations§
source§impl<'de> Deserialize<'de> for ChangeSet
impl<'de> Deserialize<'de> for ChangeSet
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for ChangeSet
impl PartialEq for ChangeSet
impl StructuralPartialEq for ChangeSet
Auto Trait Implementations§
impl Freeze for ChangeSet
impl RefUnwindSafe for ChangeSet
impl Send for ChangeSet
impl Sync for ChangeSet
impl Unpin for ChangeSet
impl UnwindSafe for ChangeSet
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