Skip to content
kix /docs
Install the CLI

Reference kix helpers

kix.availability

Helpers for comparing an availability level and mapping it to package defaults.

Packages receive their resolved availability level as the availability function argument. kix.availability exposes the ordered level vocabulary and helpers for turning that value into package behavior.

The levels, from lowest to highest, are none, pod, node, and zone.

kix.availability.pick availability {
none = 1;
pod = 2;
node = 2;
zone = 3;
}

Returns the table entry for availability. Every level is required; an incomplete table is an evaluation error.

Use pick for option defaults such as replica counts, quorum sizes, or storage replication factors. The mapping belongs to the package because only the package knows what each level requires.

Under a package ceiling (meta.availability.max), the package never sees a level above the ceiling, so pick returns the entry at the ceiling. When only some workloads cannot reach the higher levels, or the limit depends on configuration, put availability.max on those builder calls instead and keep the full table.

kix.availability.atLeast "node" availability

Returns true when availability is node or zone. Use it for a feature that becomes useful at a threshold, such as enabling an automatic-failover topology.

Under a package ceiling, a threshold above the ceiling is an evaluation error: the test could never be true.

kix.availability.rank level returns the zero-based position of a level. kix.availability.levels is the ordered list of all four strings. Most package code should use pick or atLeast, which express the decision directly.

An unknown level passed to any comparison helper is an evaluation error.