def Store.apply
bend-kube-runtime@0.2.0.0 · src/store.bend:20
import bend-kube-runtime@0.2.0.0/src/store.bend as Store
import Base
import bend-kube-runtime@0.2.0.0/src/json.bend as J
import bend-kube-runtime@0.2.0.0/src/core.bend as C
import bend-kube-runtime@0.2.0.0/src/watcher.bend as W
20def Store.apply(s: Store, o: W.Out) -> Store:
21 match s o:
22 case Store{objs, buf, r} W.OInit{}:
23 Store{objs, Map.new(&2, J.Json), r}
24 case Store{objs, buf, r} W.OInitApply{+x}:
25 Store{objs, Map.set(&2, J.Json, buf, C.Obj.key(x), x), r}
26 case Store{objs, buf, r} W.OInitDone{}:
27 Store{buf, Map.new(&2, J.Json), True{}}
28 case Store{objs, buf, r} W.OApply{+x}:
29 Store{Map.set(&2, J.Json, objs, C.Obj.key(x), x), buf, r}
30 case Store{objs, buf, r} W.ODelete{+x}:
31 Store{Map.del(&2, J.Json, objs, C.Obj.key(x)), buf, r}