def Lease.decide

bend-kube-runtime@0.2.0.0 · src/lease.bend:111

import bend-kube-runtime@0.2.0.0/src/lease.bend as Lease
import Base
import bend-kube-runtime@0.2.0.0/src/json.bend as J

111# One round: the Lease read (None when absent), us, what we saw before,
112# our clock in ms, the lease duration in seconds, and the time to stamp.
113def Lease.decide(cur: Maybe<&2, J.Json>, ns: String, name: String, +me: String, o: Obs,
114  +now_ms: U32, +dur: U32, +now: String) -> Decision:
115  match cur:
116    case None{}:
117      Decision{LCreate{Lease.fresh(ns, name, me, dur, now)}, Obs{me, now, now_ms}}
118    case Some{+l}:
119      Lease.decide.got(l, me, o, now_ms, dur, now)

Uses (9)

Used by (1)