def Plan.add

bend-kube-runtime@0.2.0.0 · src/runtime.bend:660

import bend-kube-runtime@0.2.0.0/src/runtime.bend as Runtime
import Base
import bend-kube-runtime@0.2.0.0/src/core.bend as C

660# Adds a subscription: to the watch of the same key, or as a new watch.
661def Plan.add(ws: List<&2, Watch>, +api: C.Api, +label: String, +sub: Sub, hit: Bool) -> List<&2, Watch>:
662  match ws hit:
663    case Con{Watch{a, l, ss}, t} True{}:
664      Watch{a, l, List.append(&2, Sub, ss, [sub])} <> t
665    case Con{+w, +t} False{}:
666      w <> Plan.add(t, api, label, sub, Plan.hit(t, Watch.key(api, label)))
667    case Nil{} _:
668      [Watch{api, label, [sub]}]

Uses (9)

Used by (1)