Ejemplo n.º 1
0
func main() {
	edge := core.NewPipeEdge("A", "O1", "B", "I1")
	w := edge.Writer()
	r := edge.Reader()

	wg := &sync.WaitGroup{}
	wg.Add(2)

	go func() {
		defer wg.Done()
		Node2(r)
	}()

	go func() {
		defer wg.Done()
		Node1(w)
	}()

	wg.Wait()
}
Ejemplo n.º 2
0
	n.inputs[name] = reader
}

func (n *NodeMathOp) AddOutput(name string, writer io.WriteCloser) {
	n.outputs[name] = append(n.outputs[name], writer)
}

var nodes = []gflow.Node{
	NewNodeSource("A", 3),
	NewNodeMathOp("B", "+"),
	NewNodeSource("C", 2),
	NewNodePrinter("D"),
}

var edges = []gflow.Edge{
	core.NewPipeEdge("A", "O1", "B", "I1"),
	core.NewPipeEdge("C", "O1", "B", "I2"),
	core.NewPipeEdge("B", "O1", "D", "I1"),
}

func main() {
	//edge := core.NewPipeEdge("A", "O1", "B", "I1")
	//w := edge.Writer()
	//r := edge.Reader()
	var err error
	r, w, _ := os.Pipe()

	sdata := []byte("134.222")
	fmt.Println("sdata:", sdata)
	_, err = w.Write(sdata)
	if err != nil {