src/coordinator/OwnerOpenPolicy.bend
mylsm-lsm-store@0.6.0.0 · 19 lines · 0 definitions
1import Base
2
3# Says whether an open keeps its handle or rejects the requested options.
4type Decision is Data:
5 UseLocal{}
6 UseRemote{}
7 RejectOptions{}
8
9# Picks the handle kind that a matching open keeps.
10def matched(local: Bool) -> Decision:
11 match local:
12 case True{}: UseLocal{}
13 case False{}: UseRemote{}
14
15# Keeps the opened handle only when the requested options match the effective ones.
16def choose(local: Bool, matches: Bool) -> Decision:
17 match matches:
18 case True{}: matched(local)
19 case False{}: RejectOptions{}