def cas.pick

cswap-bend-cli@0.1.0.0 · usage/gate.bend:86

import cswap-bend-cli@0.1.0.0/usage/gate.bend as Gate
import Base
import cswap-bend-cli@0.1.0.0/fs.bend as Fs
import cswap-bend-cli@0.1.0.0/json.bend as Json

86# CAS on the lineage: write the successor only when the store still holds the
87# generation we consumed; a moved store keeps its newer lineage.
88def cas.pick(+same: Bool, +path: String, +text: String, +new: String, +acct: Json.Json, +now_cred: String) -> IO(Fs.Res(Gated)):
89  match same:
90    case True{}:
91      write.back(path, text, new, acct)
92    case False{}:
93      done.g(gated.ok(now_cred, Some{now_cred}))

Uses (10)

Used by (1)