def adopt

cswap-bend-cli@0.1.0.0 · urec.bend:215

import cswap-bend-cli@0.1.0.0/urec.bend as Urec
import Base
import cswap-bend-cli@0.1.0.0/act.bend as Act
import cswap-bend-cli@0.1.0.0/ustore.bend as Ustore

215# Merge measurements another machine took (UsageStore.adopt): a reading
216# replaces lastGood only when newer than the stored one; `hold` (seconds)
217# keeps collectors off the slot, never past the reading's earliest window
218# reset nor an hour past the stored measurement; Some{0} lifts a hold.
219def adopt(+root: String, rs: List<&2, Reading>, hold: Maybe<&2, U32>, +now: U32) -> Act.of(AR):
220  Ustore.with_usage_lock(AR, root, adopt.act(root, rs, hold, now))

Uses (9)

Used by (1)