pub struct SqliteHeaderDb { /* private fields */ }Expand description
Header storage implementation with SQL Lite.
Implementations§
Source§impl SqliteHeaderDb
impl SqliteHeaderDb
Sourcepub fn new(
network: Network,
path: Option<PathBuf>,
) -> Result<Self, SqlInitializationError>
pub fn new( network: Network, path: Option<PathBuf>, ) -> Result<Self, SqlInitializationError>
Create a new SqliteHeaderDb with an optional file path. If no path is provided,
the file will be stored in a data subdirectory where the program is ran.
Trait Implementations§
Source§impl Debug for SqliteHeaderDb
impl Debug for SqliteHeaderDb
Source§impl HeaderStore for SqliteHeaderDb
impl HeaderStore for SqliteHeaderDb
Source§type Error = SqlHeaderStoreError
type Error = SqlHeaderStoreError
Errors that may occur within a
HeaderStore.Source§fn load<'a>(
&'a mut self,
range: impl RangeBounds<u32> + Send + Sync + 'a,
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<u32, Header>, Self::Error>> + Send + 'a>>
fn load<'a>( &'a mut self, range: impl RangeBounds<u32> + Send + Sync + 'a, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<u32, Header>, Self::Error>> + Send + 'a>>
Load the headers of the canonical chain for the specified range.
Source§fn stage(&mut self, changes: BlockHeaderChanges)
fn stage(&mut self, changes: BlockHeaderChanges)
Stage changes to the chain to be written in the future.
Source§fn write(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + '_>>
fn write( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + '_>>
Commit the changes by writing them to disk.
Source§fn height_of<'a>(
&'a mut self,
hash: &'a BlockHash,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, Self::Error>> + Send + 'a>>
fn height_of<'a>( &'a mut self, hash: &'a BlockHash, ) -> Pin<Box<dyn Future<Output = Result<Option<u32>, Self::Error>> + Send + 'a>>
Return the height of a block hash in the database, if it exists.
Auto Trait Implementations§
impl Freeze for SqliteHeaderDb
impl !RefUnwindSafe for SqliteHeaderDb
impl Send for SqliteHeaderDb
impl Sync for SqliteHeaderDb
impl Unpin for SqliteHeaderDb
impl !UnwindSafe for SqliteHeaderDb
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