4 ms·
Can someone explain how `Spawn` ships the closure for execution to a remote host? I'm quite curious to know. I had a grep through the source, but I only found o
by peterwaller 13y ago
Can someone explain how `Spawn` ships the closure for execution to a remote host? I'm quite curious to know. I had a grep through the source, but I only found one [1] implementation of `Spawn` accepting a function as a parameter in the code base. This hides the true implementation, which I'm struggling to find. Any hints?
[1] https://github.com/tumblr/gocircuit/blob/master/src/circuit/use/circuit/bind.go#L84 https://github.com/tumblr/gocircuit/blob/master/src/circuit/...
- sesteel 13y agoI am thinking it translates your program into multiple go programs, compiles them, and then deploys them.
- jbp 13y agohttp://www.gocircuit.org/spawn.html http://www.gocircuit.org/spawn.html
- peterwaller 13y agoI found that earlier - unless I'm missing something, it doesn't actually explain how the closure is packaged. Does the worker need compiled-in knowledge of what the master wants to execute in advance, for example? It's not clear to me.
- jbp 13y agoIt looks like at this time Spawn doesn't support the closures yet. http://www.gocircuit.org/lang.html#worker-functions http://www.gocircuit.org/lang.html#worker-functions: "The need for boilerplate will be removed in an upcoming Circuit Compiler" From https://github.com/tumblr/gocircuit/blob/master/src/circuit/use/circuit/bind.go#L75 https://github.com/tumblr/gocircuit/blob/master/src/circuit/...: "The worker function fn, whose type must have previously been registered with RegisterFunc" And it looks like only function type id is communicated to worker: https://github.com/tumblr/gocircuit/blob/master/src/circuit/sys/lang/func.go#L115 https://github.com/tumblr/gocircuit/blob/master/src/circuit/...