def KCounter.get

bend-kit-crdt@0.2.0.0 · crdt.bend:233

import bend-kit-crdt@0.2.0.0/crdt.bend as Crdt
import Base

233# The count of replica k: the largest count under an ID that cmp makes equal to k.
234def KCounter.get(~K: Data, ~cmp: K -> K -> Cmp, s: KCounter<K>, +k: K) -> U32:
235  match s:
236    case KNil{}:
237      0
238    case KCon{id, c, r}:
239      U32.max(KCounter.hit(cmp(k, id), c), KCounter.get(~K, ~cmp, r, k))

Uses (5)

Used by (1)