Exemplo n.º 1
0
        public static Stream <TOutput, TTime> MakeStage(Stream <TInput, TTime> stream, Func <int, Stage <TTime>, UnaryVertex <TInput, TOutput, TTime> > factory, Expression <Func <TInput, int> > inputPartitionBy, Expression <Func <TOutput, int> > outputPartitionBy, string name)
        {
            var stage = Foundry.NewStage(stream.Context, factory, name);

            var input1 = stage.NewInput(stream, (message, shard) => shard.MessageReceived(message), inputPartitionBy);
            var output = stage.NewOutput(shard => shard.Output, outputPartitionBy);

            return(output);
        }
Exemplo n.º 2
0
        public static void MakeStage(Stream <TOutput, TTime> stream, Func <int, Stage <TTime>, SinkVertex <TOutput, TTime> > factory, Expression <Func <TOutput, int> > partitionedBy, string name)
        {
            var stage = Foundry.NewStage(stream.Context, factory, name);

            stage.NewInput(stream, (message, shard) => shard.MessageReceived(message), partitionedBy);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Used to write records to files.
 /// </summary>
 /// <typeparam name="S">Record type</typeparam>
 /// <param name="input">Source of records</param>
 /// <param name="format">Format string for filename; {0} replaced with shard id</param>
 /// <param name="action">Operation to apply to each record and the output stream. Often (r,s) => s.Write(r);</param>
 public static void WriteToFiles<S>(this StageOutput<S, Epoch> input, string format, Action<S, System.IO.BinaryWriter> action)
 {
     Foundry.NewStage(input, (i, v) => new Writer<S>(i, v, action, format), null, "Writer");
 }