Exemple #1
0
func NewMakeInterfaceOp() *mapper.Op {
	fn := func(in interface{}) []interface{} {
		return []interface{}{in}
	}

	return mapper.NewOp(fn, "MakeInterfaceOp")
}
Exemple #2
0
func NewMakeProtobufMessageOp() stream.Operator {
	fn := func(in interface{}) []proto.Message {
		return []proto.Message{in.(proto.Message)}
	}

	return mapper.NewOp(fn, "MakeProtobufMessageOp")
}
func TestNoOrder(t *testing.T) {

	input := make(chan stream.Object)

	passthruFn := func(in int) []int {
		return []int{in}
	}

	FirstOp := mapper.NewOp(passthruFn, "First PT no")
	FirstOp.SetIn(input)
	SecondOp := mapper.NewOp(passthruFn, "2nd PT no")

	ch := stream.NewChain()
	ch.Add(FirstOp)
	ch.Add(SecondOp)

	output := SecondOp.Out()
	ch.Start()

	go func() {
		for i := 0; i < 10000; i++ {
			input <- i
		}
	}()

	found := false
	for i := 0; i < 10000; i++ {
		val := <-output
		if val != i {
			found = true
		}
	}

	if !found {
		t.Error("Weird no out of order stuff found")
	}
	ch.Stop()
	ch.Wait()
}
Exemple #4
0
func NewDropOp() *mapper.Op {
	dropfn := func(input stream.Object, out mapper.Outputer) {
	}

	return mapper.NewOp(dropfn, "DropRop")
}