def GCounter.inc

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

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

68# Adds 1 to the count of replica i. None when that count is 4294967295.
69def GCounter.inc(s: List<&2, U32>, i: Nat) -> Maybe<&2, List<&2, U32>>:
70  match s i:
71    case Nil{} _:
72      Some{GCounter.pad(i)}
73    case Con{+c, t} 0n:
74      GCounter.inc.at(U32.is_lt(c, U32.inc(c)), U32.inc(c), t)
75    case Con{c, t} 1n+p:
76      GCounter.cons(c, GCounter.inc(t, p))

Uses (9)

Used by (0)

No other definition uses this definition.