pub struct BlockEngineConfig<K, V, P>{ /* private fields */ }Expand description
Config for the block-based disk cache engine.
The block-based disk cache engine is suitable for general cache entries with size from 2K to hundreds of MiBs.
Each cache entry will be aligned to a multiplier of 4K on disk, hence too small cache entries will lead to heavy internal fragmentation.
The disk cache evicts cache entries in block unit.
Implementations§
Source§impl<K, V, P> BlockEngineConfig<K, V, P>
impl<K, V, P> BlockEngineConfig<K, V, P>
Sourcepub fn new(device: Arc<dyn Device>) -> Self
pub fn new(device: Arc<dyn Device>) -> Self
Create a new block-based disk cache engine builder with default configurations.
Sourcepub fn with_block_size(self, block_size: usize) -> Self
pub fn with_block_size(self, block_size: usize) -> Self
Set the block size for the block-based disk cache engine.
Block is the minimal cache eviction unit for the block-based disk cache, its size also limits the max cacheable entry size.
The block size must be 4K-aligned. the given value is not 4K-aligned, it will be automatically aligned up.
Default: 16 MiB.
Sourcepub fn with_indexer_shards(self, indexer_shards: usize) -> Self
pub fn with_indexer_shards(self, indexer_shards: usize) -> Self
Set the shard num of the indexer. Each shard has its own lock.
Default: 64.
Sourcepub fn with_recover_concurrency(self, recover_concurrency: usize) -> Self
pub fn with_recover_concurrency(self, recover_concurrency: usize) -> Self
Set the recover concurrency for the disk cache store.
Default: 8.
Sourcepub fn with_flushers(self, flushers: usize) -> Self
pub fn with_flushers(self, flushers: usize) -> Self
Set the flusher count for the disk cache store.
The flusher count limits how many blocks can be concurrently written.
Default: 1.
Sourcepub fn with_admission_filter(self, filter: StorageFilter) -> Self
pub fn with_admission_filter(self, filter: StorageFilter) -> Self
Set the admission filter for th disk cache store.
The admission filter is used to pick the entries that can be inserted into the disk cache store.
Default: Admit all.
Sourcepub fn with_reclaimers(self, reclaimers: usize) -> Self
pub fn with_reclaimers(self, reclaimers: usize) -> Self
Set the reclaimer count for the disk cache store.
The reclaimer count limits how many blocks can be concurrently reclaimed.
Default: 1.
Sourcepub fn with_buffer_pool_size(self, buffer_pool_size: usize) -> Self
pub fn with_buffer_pool_size(self, buffer_pool_size: usize) -> Self
Set the total flush buffer pool size.
Each flusher shares a volume at threshold / flushers.
If the buffer of the flush queue exceeds the threshold, the further entries will be ignored.
Default: 16 MiB.
Sourcepub fn with_blob_index_size(self, blob_index_size: usize) -> Self
pub fn with_blob_index_size(self, blob_index_size: usize) -> Self
Set the blob index size for each blob.
A larger blob index size can hold more blob entries, but it will also increase the io size of each blob part write.
NOTE: The size will be aligned up to a multiplier of 4K.
Default: 4 KiB
Sourcepub fn with_submit_queue_size_threshold(
self,
submit_queue_size_threshold: usize,
) -> Self
pub fn with_submit_queue_size_threshold( self, submit_queue_size_threshold: usize, ) -> Self
Set the submit queue size threshold.
If the total entry estimated size in the submit queue exceeds the threshold, the further entries will be ignored.
Default: buffer_pool_size * 2.
Sourcepub fn with_clean_block_threshold(self, clean_block_threshold: usize) -> Self
pub fn with_clean_block_threshold(self, clean_block_threshold: usize) -> Self
Set the clean block threshold for the disk cache store.
The reclaimers only work when the clean block count is equal to or lower than the clean block threshold.
Default: the same value as the reclaimers.
Sourcepub fn with_eviction_pickers(
self,
eviction_pickers: Vec<Box<dyn EvictionPicker>>,
) -> Self
pub fn with_eviction_pickers( self, eviction_pickers: Vec<Box<dyn EvictionPicker>>, ) -> Self
Set the eviction pickers for th disk cache store.
The eviction picker is used to pick the block to reclaim.
The eviction pickers are applied in order. If the previous eviction picker doesn’t pick any block, the next one will be applied.
If no eviction picker picks a block, a block will be picked randomly.
Default: [ invalid ratio picker { threshold = 0.8 }, fifo picker ]
Sourcepub fn with_reinsertion_filter(self, filter: StorageFilter) -> Self
pub fn with_reinsertion_filter(self, filter: StorageFilter) -> Self
Set the reinsertion filter for th disk cache store.
The reinsertion filter is used to pick the entries that can be reinsertion into the disk cache store while reclaiming.
Note: Only extremely important entries should be picked. If too many entries are picked, both insertion and reinsertion will be stuck.
Default: Reject all.
Sourcepub fn with_tombstone_log(self, enable: bool) -> Self
pub fn with_tombstone_log(self, enable: bool) -> Self
Enable the tombstone log.
For updatable cache, either the tombstone log or crate::engine::RecoverMode::None must be enabled to prevent
from the phantom entries after reopen.
Trait Implementations§
Source§impl<K, V, P> Debug for BlockEngineConfig<K, V, P>
impl<K, V, P> Debug for BlockEngineConfig<K, V, P>
Source§impl<K, V, P> EngineConfig<K, V, P> for BlockEngineConfig<K, V, P>
impl<K, V, P> EngineConfig<K, V, P> for BlockEngineConfig<K, V, P>
Source§impl<K, V, P> From<BlockEngineConfig<K, V, P>> for Box<dyn EngineConfig<K, V, P>>
impl<K, V, P> From<BlockEngineConfig<K, V, P>> for Box<dyn EngineConfig<K, V, P>>
Source§fn from(builder: BlockEngineConfig<K, V, P>) -> Self
fn from(builder: BlockEngineConfig<K, V, P>) -> Self
Auto Trait Implementations§
impl<K, V, P> Freeze for BlockEngineConfig<K, V, P>
impl<K, V, P> !RefUnwindSafe for BlockEngineConfig<K, V, P>
impl<K, V, P> Send for BlockEngineConfig<K, V, P>
impl<K, V, P> Sync for BlockEngineConfig<K, V, P>
impl<K, V, P> Unpin for BlockEngineConfig<K, V, P>
impl<K, V, P> !UnwindSafe for BlockEngineConfig<K, V, P>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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