pub enum DiscardPolicy {
New,
Old,
}Expand description
What a bounded bucket does when it reaches max_bytes (NATS-specific).
This is a real semantic choice, not a tuning knob — it decides what the bucket gives up at capacity:
Variants§
New
Reject new writes when full, preserving every existing entry (NATS
discard:new). Correct for config buckets (certs, configs read as the
source of truth) where silently dropping a live value is unacceptable — but
it FREEZES writes at capacity (err 10077). Pair it with max_age so the
bucket is trimmed before it ever fills.
Old
Evict the oldest messages when full (NATS discard:old): a hard size
ceiling that never rejects. Correct for high-churn log buckets whose
consumers hold the durable fold (e.g. routing origins): the bucket is a
bounded change-feed, not the source of truth, so an evicted entry is
recovered from the consumer’s fold (and the CursorExpired resync path),
while writers never freeze.
Trait Implementations§
Source§impl Clone for DiscardPolicy
impl Clone for DiscardPolicy
Source§fn clone(&self) -> DiscardPolicy
fn clone(&self) -> DiscardPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DiscardPolicy
Source§impl Debug for DiscardPolicy
impl Debug for DiscardPolicy
Source§impl Default for DiscardPolicy
impl Default for DiscardPolicy
Source§fn default() -> DiscardPolicy
fn default() -> DiscardPolicy
impl Eq for DiscardPolicy
Source§impl PartialEq for DiscardPolicy
impl PartialEq for DiscardPolicy
Source§fn eq(&self, other: &DiscardPolicy) -> bool
fn eq(&self, other: &DiscardPolicy) -> bool
self and other values to be equal, and is used by ==.