def Ctl.spawn

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

import bend-kube-runtime@0.2.0.0/src/runtime.bend as Runtime
import Base
import bend-kube-runtime@0.2.0.0/src/json.bend as J
import bend-kube-runtime@0.2.0.0/src/config.bend as K
import bend-kube-runtime@0.2.0.0/src/queue.bend as Q

514# Starts a reconcile per job; each answers MDone on the channel.
515def Ctl.spawn(~rec: U32 -> J.Json -> K.Config -> IO(Q.Action), jobs: List<&2, Job>, +chan: Chan(Msg),
516  +cfg: K.Config, +idx: U32) -> IO(Unit):
517  match jobs:
518    case Nil{}:
519      IO.pure(Unit, Unit{})
520    case Con{Job{key, o}, t}:
521      IO.bind(Unit, Unit,
522        IO.spawn(Result<&1, &1, Msg, Unit>,
523          IO.bind(Q.Action, Result<&1, &1, Msg, Unit>, rec(idx, o, cfg),
524            a => Chan.send(Msg, chan, MDone{key, a}))),
525        u => Ctl.spawn(~rec, t, chan, cfg, idx))

Uses (15)

Used by (1)