pub struct ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,{ /* private fields */ }
Expand description
Client database
Implementations§
Source§impl<Block, StorageBackend> ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,
StorageBackend: ClientDatabaseStorageBackend,
impl<Block, StorageBackend> ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,
StorageBackend: ClientDatabaseStorageBackend,
Sourcepub async fn open<GBB>(
options: ClientDatabaseOptions<GBB, StorageBackend>,
) -> Result<Self, ClientDatabaseError>where
GBB: FnOnce() -> GenesisBlockBuilderResult<Block>,
pub async fn open<GBB>(
options: ClientDatabaseOptions<GBB, StorageBackend>,
) -> Result<Self, ClientDatabaseError>where
GBB: FnOnce() -> GenesisBlockBuilderResult<Block>,
Open the existing database.
NOTE: The database needs to be formatted with Self::format()
before it can be used.
Sourcepub async fn format(
storage_backend: &StorageBackend,
options: ClientDatabaseFormatOptions,
) -> Result<(), ClientDatabaseFormatError>
pub async fn format( storage_backend: &StorageBackend, options: ClientDatabaseFormatOptions, ) -> Result<(), ClientDatabaseFormatError>
Format a new database
Trait Implementations§
Source§impl<Block, StorageBackend> ChainInfo<Block> for ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,
StorageBackend: ClientDatabaseStorageBackend,
impl<Block, StorageBackend> ChainInfo<Block> for ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,
StorageBackend: ClientDatabaseStorageBackend,
Source§fn best_header(&self) -> Block::Header
fn best_header(&self) -> Block::Header
Best block header
Source§fn best_header_with_details(&self) -> (Block::Header, BlockDetails)
fn best_header_with_details(&self) -> (Block::Header, BlockDetails)
Returns the best block header like [
Self::best_header()
] with additional block detailsSource§fn ancestor_header(
&self,
ancestor_block_number: BlockNumber,
descendant_block_root: &BlockRoot,
) -> Option<Block::Header>
fn ancestor_header( &self, ancestor_block_number: BlockNumber, descendant_block_root: &BlockRoot, ) -> Option<Block::Header>
Get header of ancestor block number for descendant block root
Source§fn header_with_details(
&self,
block_root: &BlockRoot,
) -> Option<(Block::Header, BlockDetails)>
fn header_with_details( &self, block_root: &BlockRoot, ) -> Option<(Block::Header, BlockDetails)>
Returns a block header like [
Self::header()
] with additional block detailsSource§impl<Block, StorageBackend> ChainInfoWrite<Block> for ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,
StorageBackend: ClientDatabaseStorageBackend,
impl<Block, StorageBackend> ChainInfoWrite<Block> for ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,
StorageBackend: ClientDatabaseStorageBackend,
Source§async fn persist_block(
&self,
block: Block,
block_details: BlockDetails,
) -> Result<(), PersistBlockError>
async fn persist_block( &self, block: Block, block_details: BlockDetails, ) -> Result<(), PersistBlockError>
Persist newly imported block
Source§impl<Block, StorageBackend> Clone for ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,
impl<Block, StorageBackend> Clone for ClientDatabase<Block, StorageBackend>where
Block: GenericOwnedBlock,
Auto Trait Implementations§
impl<Block, StorageBackend> Freeze for ClientDatabase<Block, StorageBackend>
impl<Block, StorageBackend> !RefUnwindSafe for ClientDatabase<Block, StorageBackend>
impl<Block, StorageBackend> Send for ClientDatabase<Block, StorageBackend>
impl<Block, StorageBackend> Sync for ClientDatabase<Block, StorageBackend>
impl<Block, StorageBackend> Unpin for ClientDatabase<Block, StorageBackend>
impl<Block, StorageBackend> !UnwindSafe for ClientDatabase<Block, StorageBackend>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more