Struct foyer::HybridCacheBuilderPhaseStorage

source ·
pub struct HybridCacheBuilderPhaseStorage<K, V, S>{ /* private fields */ }
Expand description

Hybrid cache builder modify the disk cache configurations.

Implementations§

source§

impl<K, V, S> HybridCacheBuilderPhaseStorage<K, V, S>

source

pub fn with_device_config(self, device_config: impl Into<DeviceConfig>) -> Self

Set device config for the disk cache store.

source

pub fn with_flush(self, flush: bool) -> Self

Enable/disable sync after writes.

Default: false.

source

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.

source

pub fn with_recover_mode(self, recover_mode: RecoverMode) -> Self

Set the recover mode for the disk cache store.

See more in RecoverMode.

Default: RecoverMode::Quiet.

source

pub fn with_recover_concurrency(self, recover_concurrency: usize) -> Self

Set the recover concurrency for the disk cache store.

Default: 8.

source

pub fn with_flushers(self, flushers: usize) -> Self

Set the flusher count for the disk cache store.

The flusher count limits how many regions can be concurrently written.

Default: 1.

source

pub fn with_reclaimers(self, reclaimers: usize) -> Self

Set the reclaimer count for the disk cache store.

The reclaimer count limits how many regions can be concurrently reclaimed.

Default: 1.

source

pub fn with_buffer_threshold(self, threshold: usize) -> Self

👎Deprecated since 0.11.4: The function will be renamed to “with_buffer_pool_size()”, use it instead.

Set the total flush buffer threshold.

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.

source

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.

source

pub fn with_clean_region_threshold(self, clean_region_threshold: usize) -> Self

Set the clean region threshold for the disk cache store.

The reclaimers only work when the clean region count is equal to or lower than the clean region threshold.

Default: the same value as the reclaimers.

source

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 region to reclaim.

The eviction pickers are applied in order. If the previous eviction picker doesn’t pick any region, the next one will be applied.

If no eviction picker picks a region, a region will be picked randomly.

Default: [ invalid ratio picker { threshold = 0.8 }, fifo picker ]

source

pub fn with_admission_picker( self, admission_picker: Arc<dyn AdmissionPicker<Key = K>>, ) -> Self

Set the admission pickers for th disk cache store.

The admission picker is used to pick the entries that can be inserted into the disk cache store.

Default: [AdmitAllPicker].

source

pub fn with_reinsertion_picker( self, reinsertion_picker: Arc<dyn ReinsertionPicker<Key = K>>, ) -> Self

Set the reinsertion pickers for th disk cache store.

The reinsertion picker 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: [RejectAllPicker].

source

pub fn with_compression(self, compression: Compression) -> Self

Set the compression algorithm of the disk cache store.

Default: Compression::None.

source

pub fn with_tombstone_log_config( self, tombstone_log_config: TombstoneLogConfig, ) -> Self

Enable the tombstone log with the given config.

For updatable cache, either the tombstone log or RecoverMode::None must be enabled to prevent from the phantom entries after reopen.

source

pub fn with_runtime_config(self, runtime_config: RuntimeConfig) -> Self

Configure the dedicated runtime for the disk cache store.

source

pub async fn build(self) -> Result<HybridCache<K, V, S>>

Build and open the hybrid cache with the given configurations.

Auto Trait Implementations§

§

impl<K, V, S> !Freeze for HybridCacheBuilderPhaseStorage<K, V, S>

§

impl<K, V, S> !RefUnwindSafe for HybridCacheBuilderPhaseStorage<K, V, S>

§

impl<K, V, S> Send for HybridCacheBuilderPhaseStorage<K, V, S>

§

impl<K, V, S> Sync for HybridCacheBuilderPhaseStorage<K, V, S>

§

impl<K, V, S> Unpin for HybridCacheBuilderPhaseStorage<K, V, S>

§

impl<K, V, S> !UnwindSafe for HybridCacheBuilderPhaseStorage<K, V, S>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

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

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

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

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

Initializes a with the given initializer. Read more
source§

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

Dereferences the given pointer. Read more
source§

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

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> Value for T
where T: Send + Sync + 'static,