src/CrashPointPolicy.bend

mylsm-lsm-store@0.5.0.0 · 12 lines · 0 definitions

1import Base
2
3# Pure checkpoint policy. An unset value is represented by the empty string;
4# the non-empty guard distinguishes disabled injection from an exact match.
5def nonempty(value: String) -> Bool:
6  match value:
7    case SNil{}: False{}
8    case SCon{_, _}: True{}
9
10# Handle enabled in the crash injection policy.
11def enabled(+configured: String, requested: String) -> Bool:
12  Bool.and(nonempty(configured), String.eq(configured, requested))