|
|
@ -17,25 +17,12 @@ func (c *Cluster) Run(ctx context.Context) error { |
|
|
|
return errs.Wait() |
|
|
|
return errs.Wait() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type ModuleMapping map[MultiThreadedIOPort]MultiThreadedIOPort |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (config *ClusterConfig) BuildCluster(modules map[string]*Module) (*Cluster, error) { |
|
|
|
func (config *ClusterConfig) BuildCluster(modules map[string]*Module) (*Cluster, error) { |
|
|
|
// We assume all modules in the connection config exist
|
|
|
|
// We assume all modules in the connection config exist
|
|
|
|
for _, c := range config.Connections { |
|
|
|
for _, c := range config.Connections { |
|
|
|
|
|
|
|
conn := NewMultiThreadedIO() |
|
|
|
// For a connection like a -> b we need two channels:
|
|
|
|
|
|
|
|
// One which is the IN channel on a and the OUT channel on b
|
|
|
|
|
|
|
|
// One which is the OUT channel on a and the IN channel on b
|
|
|
|
|
|
|
|
// That means we need to create two IOs, one for each node and two channels
|
|
|
|
|
|
|
|
// The two channels then need to be passed around
|
|
|
|
|
|
|
|
// hmmmmmmm...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
outConn := &MultiThreadedIOPort{ |
|
|
|
|
|
|
|
Module: modules[c.DestNode], |
|
|
|
|
|
|
|
IOPort: c.DestPort, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
conn := NewMultiThreadedIO(outConn) |
|
|
|
|
|
|
|
modules[c.SourceNode].IO[c.SourcePort] = conn |
|
|
|
modules[c.SourceNode].IO[c.SourcePort] = conn |
|
|
|
|
|
|
|
modules[c.DestNode].IO[c.DestPort] = conn |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// for host, client := range mapping {
|
|
|
|
// for host, client := range mapping {
|
|
|
|