pub struct Contract {
pub history_kind: HistoryKind,
pub history_depth: i32,
pub max_samples: i32,
pub max_instances: i32,
pub max_samples_per_instance: i32,
pub cleanup_delay: Duration,
}Expand description
Retention contract for a topic, derived from its
DurabilityServiceQosPolicy. The cold store MUST enforce exactly this and
nothing tighter (the memory budget is a separate, non-retention knob).
Fields§
§history_kind: HistoryKindKEEP_LAST (ring per instance at history_depth) or KEEP_ALL
(bounded only by the max_* caps).
history_depth: i32KEEP_LAST depth per instance (<= 0 is normalized to 1).
max_samples: i32Global sample cap (LENGTH_UNLIMITED = unbounded).
max_instances: i32Instance-count cap (LENGTH_UNLIMITED = unbounded).
max_samples_per_instance: i32Per-instance sample cap under KEEP_ALL (LENGTH_UNLIMITED = unbounded).
cleanup_delay: DurationDelay after an instance is unregistered before its samples are purged.
Implementations§
Source§impl Contract
impl Contract
Sourcepub fn from_qos(qos: &DurabilityServiceQosPolicy) -> Self
pub fn from_qos(qos: &DurabilityServiceQosPolicy) -> Self
Derives the contract from the durability-service QoS policy.
Sourcepub fn keep_all() -> Self
pub fn keep_all() -> Self
A KEEP_ALL contract with all caps unlimited and no cleanup delay — the
sensible default for a durability service that should retain full
history (the DurabilityServiceQosPolicy default is KEEP_LAST(1),
which is rarely what a service wants).
Sourcepub fn effective_depth(&self) -> usize
pub fn effective_depth(&self) -> usize
Effective KEEP_LAST depth (<= 0 normalized to 1, per DDS default).
Sourcepub fn samples_bounded(&self) -> bool
pub fn samples_bounded(&self) -> bool
true if max_samples is bounded.
Sourcepub fn instances_bounded(&self) -> bool
pub fn instances_bounded(&self) -> bool
true if max_instances is bounded.
Sourcepub fn per_instance_bounded(&self) -> bool
pub fn per_instance_bounded(&self) -> bool
true if max_samples_per_instance is bounded.