Skip to main content

Module expr

Module expr 

Source
Expand description

Expression algebra for defining quorum systems.

An Expr describes which sets of nodes form a quorum:

  • Node: a single node
  • Or (a + b): any one child is a quorum
  • And (a * b): every child is needed
  • Choose (choose): any k of the children

Or, And, and Choose are always non-empty and Choose always has 1 <= k <= children.len(). Their fields are private so those invariants cannot be broken after construction.

Structs§

And
AND combinator: all children must be satisfied.
Choose
CHOOSE combinator: at least k children must be satisfied.
Node
A node in a quorum system.
Or
OR combinator: at least one child must be satisfied.

Enums§

Expr
An expression describing which sets of nodes form a quorum.

Traits§

Element
Trait for types that can be used as node identifiers in quorum expressions.

Functions§

choose
Create a choose expression. Returns Or when k == 1, And when k == n, and Choose otherwise.
majority
Create a majority quorum expression. Requires floor(n/2) + 1 children to be satisfied.