pub struct ClientDatabaseOptions<GBB, StorageBackend> {
pub write_buffer_size: usize,
pub confirmation_depth_k: BlockNumber,
pub soft_confirmation_depth: BlockNumber,
pub max_fork_tips: NonZeroUsize,
pub max_fork_tip_distance: BlockNumber,
pub genesis_block_builder: GBB,
pub storage_backend: StorageBackend,
}
Expand description
Options for ClientDatabase
Fields§
§write_buffer_size: usize
Write buffer size.
Larger buffer allows buffering more async writes for improved responsiveness but requires more RAM. Zero buffer size means all writes must be completed before returning from the operation that triggered it. Non-zero buffer means writes can happen in the background.
The recommended value is 5.
confirmation_depth_k: BlockNumber
Blocks at this depth are considered to be “confirmed” and irreversible from the consensus perspective.
This parameter allows establishing a final canonical order of blocks and eliminating any potential forks at a specified depth and beyond.
soft_confirmation_depth: BlockNumber
Soft confirmation depth for blocks.
Doesn’t prevent forking on the consensus level but makes it extremely unlikely.
This parameter determines how many blocks are retained in memory before being written to disk. Writing discarded blocks to disk is a waste of resources, so they are retained in memory before being soft-confirmed and written to disk for longer-term storage.
A smaller number reduces memory usage while increasing the probability of unnecessary disk writes. A larger number increases memory usage, while avoiding unnecessary disk writes, but also increases the chance of recent blocks not being retained on disk in case of a crash.
The recommended value is 3 blocks.
max_fork_tips: NonZeroUsize
Defines how many fork tips should be maintained in total.
As natural forks occur, there may be more than one tip in existence, with only one of them being considered “canonical”. This parameter defines how many of these tips to maintain in a sort of LRU style cache. Tips beyond this limit that were not extended for a long time will be pruned automatically.
A larger number results in higher memory usage and higher complexity of pruning algorithms.
The recommended value is 3 blocks.
max_fork_tip_distance: BlockNumber
Max distance between fork tip and the best block.
When forks are this deep, they will be pruned, even without reaching the max_fork_tips
limit. This essentially means the tip was not extended for some time, and while it is
theoretically possible for the chain to continue from this tip, the probability is so small
that it is not worth storing it.
A larger value results in higher memory usage and higher complexity of pruning algorithms.
The recommended value is 5 blocks.
genesis_block_builder: GBB
Genesis block builder is responsible to create genesis block and corresponding state for bootstrapping purposes.
storage_backend: StorageBackend
Storage backend to use for storing and retrieving storage items
Trait Implementations§
Source§impl<GBB: Clone, StorageBackend: Clone> Clone for ClientDatabaseOptions<GBB, StorageBackend>
impl<GBB: Clone, StorageBackend: Clone> Clone for ClientDatabaseOptions<GBB, StorageBackend>
Source§fn clone(&self) -> ClientDatabaseOptions<GBB, StorageBackend>
fn clone(&self) -> ClientDatabaseOptions<GBB, StorageBackend>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreimpl<GBB: Copy, StorageBackend: Copy> Copy for ClientDatabaseOptions<GBB, StorageBackend>
Auto Trait Implementations§
impl<GBB, StorageBackend> Freeze for ClientDatabaseOptions<GBB, StorageBackend>
impl<GBB, StorageBackend> RefUnwindSafe for ClientDatabaseOptions<GBB, StorageBackend>where
GBB: RefUnwindSafe,
StorageBackend: RefUnwindSafe,
impl<GBB, StorageBackend> Send for ClientDatabaseOptions<GBB, StorageBackend>
impl<GBB, StorageBackend> Sync for ClientDatabaseOptions<GBB, StorageBackend>
impl<GBB, StorageBackend> Unpin for ClientDatabaseOptions<GBB, StorageBackend>
impl<GBB, StorageBackend> UnwindSafe for ClientDatabaseOptions<GBB, StorageBackend>where
GBB: UnwindSafe,
StorageBackend: UnwindSafe,
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
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>
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>
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