Closed trustmaster closed 10 years ago
New processes are actually instantiated this way:
net.AddNew("ComponentName", "processName", initialPacket)
Where initialPacket can be nil or any type accepted by constructor and ComponentName is a registered process constructor:
func newComponentName(iip interface{}) interface{} {
c := new(ComponentName)
c.Foo = iip.(PacketType).Foo
return c
}
func init() {
flow.Register("ComponentName", newComponentName)
}
In order to implement #7 with loading graph at run-time, it is required that new processes are created at run-time without having to write and compile Go code like this:
What we need is something like a component registry and a run-time process factory, that would spawn a new process given just its string component name, e.g.: