Skip to main content

PoolConfig

Struct PoolConfig 

Source
#[non_exhaustive]
pub struct PoolConfig { pub lookup_timeout: Duration, pub write_timeout: Duration, pub down_for: Duration, pub l1_entries: usize, pub l1_ttl: Option<Duration>, pub ask_replica_on_miss: bool, }
Available on crate feature pool only.
Expand description

How a PooledSemanticCache waits, retries and copies.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§lookup_timeout: Duration

Longest wait for one remote lookup (a lookup asks at most the home and the replica).

§write_timeout: Duration

Longest wait for one remote write or removal.

§down_for: Duration

A node that failed or timed out is skipped this long. Zero never skips.

§l1_entries: usize

Local copies (L1) of entries for shards this node doesn’t hold; 0 keeps none.

§l1_ttl: Option<Duration>

L1 copies expire after this; None keeps them until evicted.

§ask_replica_on_miss: bool

When the home misses, ask the replica too (and copy a hit back to the home). Costs a second call per miss; finds entries right after a node joined and took over a shard.

Implementations§

Source§

impl PoolConfig

Source

pub fn new() -> Self

150 ms lookups, 2 s writes, 10 s down time, 256 L1 entries for 5 minutes, home-only misses.

Source

pub fn with_lookup_timeout(self, t: Duration) -> Self

Source

pub fn with_write_timeout(self, t: Duration) -> Self

Source

pub fn with_down_for(self, t: Duration) -> Self

Source

pub fn with_l1(self, entries: usize, ttl: Option<Duration>) -> Self

L1 with at most entries (0 turns it off) expiring after ttl.

Source

pub fn with_ask_replica_on_miss(self, ask: bool) -> Self

Trait Implementations§

Source§

impl Clone for PoolConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PoolConfig

Source§

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

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

impl Default for PoolConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for PoolConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PoolConfig

Auto Trait Implementations§

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.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.