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 schema_v0() -> String
pub fn schema_v0() -> String
Get v0 of sqlite local_chain::ChangeSet schema
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
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