[Goproc] Add a service modifier that wraps a service in a goproc
Currently, a wiring spec can deploy a service into a goproc in one of two ways:
First, it can be explicitly deployed and instantiated:
goproc.CreateProcess(wiring, procName, serviceName)
bp := wiring.GetBlueprint()
bp.Instantiate(procName)
Second, it can be implicitly instantiated if some other node depends on it:
b := workflow.Define(wiring, "b", "LeafServiceImpl")
a := workflow.Define(wiring, "a", "NonLeafService", b)
goproc.CreateProcess(wiring, "proca", a)
bp := wiring.GetBlueprint()
bp.Instantiate("proca")
In the latter case, b
is not explicitly instantiated, but because a
depends on b
, the result is that b
will be implicitly instantiated within the same process as a
.
Ideally, we should be able to apply modifiers to services to define their default instantiation behavior. For example, there could be a modifier for b
that implements logic akin to "If b
is instantiated, do so in its own process".
Implementing this is fairly straightforward. It would require a new IRNode dst modifier that creates a process before instantiating the rest of the pointer. It would also require additional helper methods in the goproc
plugin for adding the "deploy to a process" modifier to services.