pub struct Policy { /* private fields */ }Expand description
Durability ack policy: an AND-combined list of clauses.
The empty policy is rejected by the parser; an “ack immediately”
behaviour can be expressed as in_memory>=1, which is satisfied by
the primary alone.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn new(clauses: Vec<Clause>) -> Result<Policy, PolicyError>
pub fn new(clauses: Vec<Clause>) -> Result<Policy, PolicyError>
Construct a policy from clauses. Returns an error if the clause
list is empty, contains a zero-count clause, or contains a
clause whose count exceeds MAX_CLUSTER_SIZE.
Sourcepub fn clauses(&self) -> &[Clause]
pub fn clauses(&self) -> &[Clause]
Slice access for callers that need to inspect or display the policy (health endpoint, startup logging).
Sourcepub fn evaluate(&self, cursors: &CursorView<'_>) -> u64
pub fn evaluate(&self, cursors: &CursorView<'_>) -> u64
Highest sequence at which every clause is satisfied given the supplied cursor view.
Returns 0 if no sequence satisfies all clauses — typically
because at least one clause requires more nodes than are
currently connected.
Sourcepub fn evaluate_with_status(&self, cursors: &CursorView<'_>) -> EvalStatus
pub fn evaluate_with_status(&self, cursors: &CursorView<'_>) -> EvalStatus
Like evaluate but also reports whether the
policy is structurally unsatisfiable by the current cluster
shape — i.e. at least one clause’s count exceeds the number
of nodes in the view. The response stage uses this to surface a
policy_degraded health metric and emit periodic warnings; the
gate is stalled while degraded.