Struct ClientDatabaseOptions

Source
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>

Source§

fn clone(&self) -> ClientDatabaseOptions<GBB, StorageBackend>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<GBB: Debug, StorageBackend: Debug> Debug for ClientDatabaseOptions<GBB, StorageBackend>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<GBB: Copy, StorageBackend: Copy> Copy for ClientDatabaseOptions<GBB, StorageBackend>

Auto Trait Implementations§

§

impl<GBB, StorageBackend> Freeze for ClientDatabaseOptions<GBB, StorageBackend>
where GBB: Freeze, StorageBackend: Freeze,

§

impl<GBB, StorageBackend> RefUnwindSafe for ClientDatabaseOptions<GBB, StorageBackend>
where GBB: RefUnwindSafe, StorageBackend: RefUnwindSafe,

§

impl<GBB, StorageBackend> Send for ClientDatabaseOptions<GBB, StorageBackend>
where GBB: Send, StorageBackend: Send,

§

impl<GBB, StorageBackend> Sync for ClientDatabaseOptions<GBB, StorageBackend>
where GBB: Sync, StorageBackend: Sync,

§

impl<GBB, StorageBackend> Unpin for ClientDatabaseOptions<GBB, StorageBackend>
where GBB: Unpin, StorageBackend: Unpin,

§

impl<GBB, StorageBackend> UnwindSafe for ClientDatabaseOptions<GBB, StorageBackend>
where GBB: UnwindSafe, StorageBackend: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> JsonSchemaMaybe for T