#[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: DurationLongest wait for one remote lookup (a lookup asks at most the home and the replica).
write_timeout: DurationLongest wait for one remote write or removal.
down_for: DurationA node that failed or timed out is skipped this long. Zero never skips.
l1_entries: usizeLocal 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: boolWhen 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
impl PoolConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
150 ms lookups, 2 s writes, 10 s down time, 256 L1 entries for 5 minutes, home-only misses.
pub fn with_lookup_timeout(self, t: Duration) -> Self
pub fn with_write_timeout(self, t: Duration) -> Self
pub fn with_down_for(self, t: Duration) -> Self
Sourcepub fn with_l1(self, entries: usize, ttl: Option<Duration>) -> Self
pub fn with_l1(self, entries: usize, ttl: Option<Duration>) -> Self
L1 with at most entries (0 turns it off) expiring after ttl.
pub fn with_ask_replica_on_miss(self, ask: bool) -> Self
Trait Implementations§
Source§impl Clone for PoolConfig
impl Clone for PoolConfig
Source§impl Debug for PoolConfig
impl Debug for PoolConfig
Source§impl Default for PoolConfig
impl Default for PoolConfig
Source§impl PartialEq for PoolConfig
impl PartialEq for PoolConfig
impl StructuralPartialEq for PoolConfig
Auto Trait Implementations§
impl Forget for PoolConfig
impl Freeze for PoolConfig
impl Move for PoolConfig
impl RefUnwindSafe for PoolConfig
impl Send for PoolConfig
impl Sync for PoolConfig
impl Unpin for PoolConfig
impl UnsafeUnpin for PoolConfig
impl UnwindSafe for PoolConfig
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
Mutably borrows from an owned value. Read more