Package com.rpl.rama

Interface Block

All Known Subinterfaces:
Block.Impl, Block.MultiOutImpl, Block.OutImpl

public interface Block
Core API for specifying dataflow code using the builder pattern. On module deployment compiles to efficient bytecode. For learning, a Block can be executed directly using the execute method.

Parameters with "arg" in the name can be a var, value, or Expr.
See Also:
  • Method Details

    • create

      static Block.Impl create()
      Creates an empty Block that can have additional code attached. Block.each(Ops.PRINTLN) is the same as Block.create().each(Ops.PRINTLN)
    • anchor

      static Block.Impl anchor(String anchor)
      Attaches a no-op node with the given anchor
      Parameters:
      anchor - Label for the node
      See Also:
    • atomicBlock

      static Block.Impl atomicBlock(Block block)
      Runs subblock until it completes synchronously. Then runs code following atomicBlock exactly one time.
      Parameters:
      block - Subblock
      See Also:
    • branch

      static Block.Impl branch(String anchor, Block block)
    • each

      static <R> Block.OutImpl each(RamaFunction0<R> op)
      Invokes a function of zero arguments. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, R> Block.OutImpl each(RamaFunction1<T0,R> op, Object arg0)
      Invokes a function of one argument. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, R> Block.OutImpl each(RamaFunction2<T0,T1,R> op, Object arg0, Object arg1)
      Invokes a function of two arguments. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, R> Block.OutImpl each(RamaFunction3<T0,T1,T2,R> op, Object arg0, Object arg1, Object arg2)
      Invokes a function of three arguments. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, R> Block.OutImpl each(RamaFunction4<T0,T1,T2,T3,R> op, Object arg0, Object arg1, Object arg2, Object arg3)
      Invokes a function of four arguments. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, T4, R> Block.OutImpl each(RamaFunction5<T0,T1,T2,T3,T4,R> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)
      Invokes a function of five arguments. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, T4, T5, R> Block.OutImpl each(RamaFunction6<T0,T1,T2,T3,T4,T5,R> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
      Invokes a function of six arguments. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, T4, T5, T6, R> Block.OutImpl each(RamaFunction7<T0,T1,T2,T3,T4,T5,T6,R> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6)
      Invokes a function of seven arguments. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, T4, T5, T6, T7, R> Block.OutImpl each(RamaFunction8<T0,T1,T2,T3,T4,T5,T6,T7,R> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7)
      Invokes a function of eight arguments. Each argument can be a value, var, or Expr. A function always emits exactly one time. Output can be captured with a call to out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      Invokes an operation of zero arguments. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0> Block.MultiOutImpl each(RamaOperation1<T0> op, Object arg0)
      Invokes an operation of one argument. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1> Block.MultiOutImpl each(RamaOperation2<T0,T1> op, Object arg0, Object arg1)
      Invokes an operation of two arguments. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2> Block.MultiOutImpl each(RamaOperation3<T0,T1,T2> op, Object arg0, Object arg1, Object arg2)
      Invokes an operation of three arguments. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3> Block.MultiOutImpl each(RamaOperation4<T0,T1,T2,T3> op, Object arg0, Object arg1, Object arg2, Object arg3)
      Invokes an operation of four arguments. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, T4> Block.MultiOutImpl each(RamaOperation5<T0,T1,T2,T3,T4> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)
      Invokes an operation of five arguments. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, T4, T5> Block.MultiOutImpl each(RamaOperation6<T0,T1,T2,T3,T4,T5> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
      Invokes an operation of six arguments. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, T4, T5, T6> Block.MultiOutImpl each(RamaOperation7<T0,T1,T2,T3,T4,T5,T6> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6)
      Invokes an operation of seven arguments. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • each

      static <T0, T1, T2, T3, T4, T5, T6, T7> Block.MultiOutImpl each(RamaOperation8<T0,T1,T2,T3,T4,T5,T6,T7> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7)
      Invokes an operation of eight arguments. Each argument can be a value, var, or Expr. An operation can emit any number of times to any number of output streams. Output can be captured with calls to outStream and out following this node. Built-in functions and operations can be found as static fields of the Ops class.
      Parameters:
      op - Operation to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      Invokes a function of zero arguments that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      static <T0> Block.OutImpl eachAsync(RamaFunction1<T0,CompletableFuture> op, Object arg0)
      Invokes a function of one argument that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      static <T0, T1> Block.OutImpl eachAsync(RamaFunction2<T0,T1,CompletableFuture> op, Object arg0, Object arg1)
      Invokes a function of two arguments that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      static <T0, T1, T2> Block.OutImpl eachAsync(RamaFunction3<T0,T1,T2,CompletableFuture> op, Object arg0, Object arg1, Object arg2)
      Invokes a function of three arguments that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      static <T0, T1, T2, T3> Block.OutImpl eachAsync(RamaFunction4<T0,T1,T2,T3,CompletableFuture> op, Object arg0, Object arg1, Object arg2, Object arg3)
      Invokes a function of four arguments that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      static <T0, T1, T2, T3, T4> Block.OutImpl eachAsync(RamaFunction5<T0,T1,T2,T3,T4,CompletableFuture> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)
      Invokes a function of five arguments that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      static <T0, T1, T2, T3, T4, T5> Block.OutImpl eachAsync(RamaFunction6<T0,T1,T2,T3,T4,T5,CompletableFuture> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
      Invokes a function of six arguments that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      static <T0, T1, T2, T3, T4, T5, T6> Block.OutImpl eachAsync(RamaFunction7<T0,T1,T2,T3,T4,T5,T6,CompletableFuture> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6)
      Invokes a function of seven arguments that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • eachAsync

      static <T0, T1, T2, T3, T4, T5, T6, T7> Block.OutImpl eachAsync(RamaFunction8<T0,T1,T2,T3,T4,T5,T6,T7,CompletableFuture> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7)
      Invokes a function of eight arguments that returns its result asynchronously via a returned CompletableFuture. This is used to interact with external systems without blocking the task thread. Each argument can be a value, var, or Expr. Output can be captured with a call to out following this node. The var bound by out is the value delivered to the returned CompletableFuture.
      Parameters:
      op - Function to execute. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static Block.Impl customPartition(RamaFunction1<Integer,Integer> op)
      Changes task to task ID specified by custom partitioner function with one argument. Custom partitioner function receives all dataflow arguments followed by the number of tasks in the module.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0> Block.Impl customPartition(RamaFunction2<Integer,T0,Integer> op, Object arg0)
      Changes task to task ID specified by custom partitioner function with two arguments. Custom partitioner function receives all dataflow arguments followed by the number of tasks in the module.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1> Block.Impl customPartition(RamaFunction3<Integer,T0,T1,Integer> op, Object arg0, Object arg1)
      Changes task to task ID specified by custom partitioner function with three arguments. Custom partitioner function receives all dataflow arguments followed by the number of tasks in the module.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2> Block.Impl customPartition(RamaFunction4<Integer,T0,T1,T2,Integer> op, Object arg0, Object arg1, Object arg2)
      Changes task to task ID specified by custom partitioner function with four arguments. Custom partitioner function receives all dataflow arguments followed by the number of tasks in the module.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2, T3> Block.Impl customPartition(RamaFunction5<Integer,T0,T1,T2,T3,Integer> op, Object arg0, Object arg1, Object arg2, Object arg3)
      Changes task to task ID specified by custom partitioner function with five arguments. Custom partitioner function receives all dataflow arguments followed by the number of tasks in the module.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2, T3, T4> Block.Impl customPartition(RamaFunction6<Integer,T0,T1,T2,T3,T4,Integer> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)
      Changes task to task ID specified by custom partitioner function with six arguments. Custom partitioner function receives all dataflow arguments followed by the number of tasks in the module.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2, T3, T4, T5> Block.Impl customPartition(RamaFunction7<Integer,T0,T1,T2,T3,T4,T5,Integer> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
      Changes task to task ID specified by custom partitioner function with seven arguments. Custom partitioner function receives all dataflow arguments followed by the number of tasks in the module.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2, T3, T4, T5, T6> Block.Impl customPartition(RamaFunction8<Integer,T0,T1,T2,T3,T4,T5,T6,Integer> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6)
      Changes task to task ID specified by custom partitioner function with eight arguments. Custom partitioner function receives all dataflow arguments followed by the number of tasks in the module.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static Block.Impl customPartition(String pobjectVar, RamaFunction1<Integer,Integer> op)
      Changes to task containing PState partition specified by custom partitioner function with one argument. Custom partitioner function receives all dataflow arguments followed by the number of partitions of the PState.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0> Block.Impl customPartition(String pobjectVar, RamaFunction2<Integer,T0,Integer> op, Object arg0)
      Changes to task containing PState partition specified by custom partitioner function with two arguments. Custom partitioner function receives all dataflow arguments followed by the number of partitions of the PState.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1> Block.Impl customPartition(String pobjectVar, RamaFunction3<Integer,T0,T1,Integer> op, Object arg0, Object arg1)
      Changes to task containing PState partition specified by custom partitioner function with three arguments. Custom partitioner function receives all dataflow arguments followed by the number of partitions of the PState.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2> Block.Impl customPartition(String pobjectVar, RamaFunction4<Integer,T0,T1,T2,Integer> op, Object arg0, Object arg1, Object arg2)
      Changes to task containing PState partition specified by custom partitioner function with four arguments. Custom partitioner function receives all dataflow arguments followed by the number of partitions of the PState.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2, T3> Block.Impl customPartition(String pobjectVar, RamaFunction5<Integer,T0,T1,T2,T3,Integer> op, Object arg0, Object arg1, Object arg2, Object arg3)
      Changes to task containing PState partition specified by custom partitioner function with five arguments. Custom partitioner function receives all dataflow arguments followed by the number of partitions of the PState.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2, T3, T4> Block.Impl customPartition(String pobjectVar, RamaFunction6<Integer,T0,T1,T2,T3,T4,Integer> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)
      Changes to task containing PState partition specified by custom partitioner function with six arguments. Custom partitioner function receives all dataflow arguments followed by the number of partitions of the PState.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2, T3, T4, T5> Block.Impl customPartition(String pobjectVar, RamaFunction7<Integer,T0,T1,T2,T3,T4,T5,Integer> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
      Changes to task containing PState partition specified by custom partitioner function with seven arguments. Custom partitioner function receives all dataflow arguments followed by the number of partitions of the PState.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • customPartition

      static <T0, T1, T2, T3, T4, T5, T6> Block.Impl customPartition(String pobjectVar, RamaFunction8<Integer,T0,T1,T2,T3,T4,T5,T6,Integer> op, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6)
      Changes to task containing PState partition specified by custom partitioner function with eight arguments. Custom partitioner function receives all dataflow arguments followed by the number of partitions of the PState.
      Parameters:
      op - Custom partitioner function. Can also be specified as a lambda or method reference.
      See Also:
    • groupBy

      static Block.Impl groupBy(String var0, Block groupByBlock)
      Groups input by one key and performs aggregations in the specified block on each group of data independently. Only usable in batchBlock. Emits into postagg the vars for keys and results of aggregations.
      Parameters:
      groupByBlock - Block containing aggregation code
      See Also:
    • groupBy

      static Block.Impl groupBy(String var0, String var1, Block groupByBlock)
      Groups input by two keys and performs aggregations in the specified block on each group of data independently. Only usable in batchBlock. Emits into postagg the vars for keys and results of aggregations.
      Parameters:
      groupByBlock - Block containing aggregation code
      See Also:
    • groupBy

      static Block.Impl groupBy(String var0, String var1, String var2, Block groupByBlock)
      Groups input by three keys and performs aggregations in the specified block on each group of data independently. Only usable in batchBlock. Emits into postagg the vars for keys and results of aggregations.
      Parameters:
      groupByBlock - Block containing aggregation code
      See Also:
    • groupBy

      static Block.Impl groupBy(String var0, String var1, String var2, String var3, Block groupByBlock)
      Groups input by four keys and performs aggregations in the specified block on each group of data independently. Only usable in batchBlock. Emits into postagg the vars for keys and results of aggregations.
      Parameters:
      groupByBlock - Block containing aggregation code
      See Also:
    • groupBy

      static Block.Impl groupBy(String var0, String var1, String var2, String var3, String var4, Block groupByBlock)
      Groups input by five keys and performs aggregations in the specified block on each group of data independently. Only usable in batchBlock. Emits into postagg the vars for keys and results of aggregations.
      Parameters:
      groupByBlock - Block containing aggregation code
      See Also:
    • groupBy

      static Block.Impl groupBy(String var0, String var1, String var2, String var3, String var4, String var5, Block groupByBlock)
      Groups input by six keys and performs aggregations in the specified block on each group of data independently. Only usable in batchBlock. Emits into postagg the vars for keys and results of aggregations.
      Parameters:
      groupByBlock - Block containing aggregation code
      See Also:
    • hook

      static Block.Impl hook(String anchor)
      Changes attachment point for subsequent code to node with given anchor
      Parameters:
      anchor - Label of node to attach to
      See Also:
    • ifTrue

      static Block.Impl ifTrue(Object arg, Block thenBlock)
      If argument is truthy (not null or boolean false), runs thenBlock. In either case, continues to the code following the ifTrue.
      Parameters:
      arg - Value, var, or Expr to test for truthiness (not null or boolean false). Common to use an Expr here.
      thenBlock - Subblock run if condition passes
      See Also:
    • ifTrue

      static Block.Impl ifTrue(Object arg, Block thenBlock, Block elseBlock)
      If argument is truthy (not null or boolean false), runs thenBlock – otherwise, runs elseBlock. In either case, continues to the code following the ifTrue.
      Parameters:
      arg - Value, var, or Expr to test for truthiness (not null or boolean false). Common to use an Expr here.
      thenBlock - Subblock run if condition passes
      elseBlock - Subblock run if condition does not pass
      See Also:
    • keepTrue

      static Block.Impl keepTrue(Object arg)
      Continues dataflow execution only if arg is truthy (not null or boolean false).
      Parameters:
      arg - Value, var, or Expr
      See Also:
    • unify

      static Block.Impl unify(String anchor1, String anchor2, String... anchors)
      Attaches subsequent code to each of the anchors specified, merging computation flowing out of those nodes. After the unify the only vars in scope are vars that exist in all parent branches. Must unify at least two nodes.
      See Also:
    • loop

      static Block.OutImpl loop(Block loopBlock)
      Creates a dataflow loop with the given body. emitLoop is used to emit from the loop, and continueLoop is used to execute the loop body again. A loop call can be optionally followed by a call to out to capture any output emitted as vars.
      Parameters:
      loopBlock - Body of the loop
      See Also:
    • loopWithVars

      static Block.OutImpl loopWithVars(LoopVars loopVars, Block loopBlock)
      Creates a dataflow loop with the given vars and body. emitLoop is used to emit from the loop, and continueLoop is used to execute the loop body again. The vars are given initial values and updated with each call to continueLoop. A loopWithVars call can be optionally followed by a call to out to capture any output emitted as vars.
      Parameters:
      loopVars - Declaration of vars for each iteration of loop
      loopBlock - Body of the loop
      See Also:
    • continueLoop

      static Block.Impl continueLoop(Object... args)
      Executes another iteration of the loop. Can only be used within loop or loopWithVars. When used with loopWithVars, must provide as input values for all loop vars for the next loop iteration.
      Parameters:
      args - Values for loop vars for next iteration of loop
      See Also:
    • emitLoop

      static Block.Impl emitLoop(Object... args)
      Emits from a loop. Can only be used within loop or loopWithVars. This is only way for code following loop or loopWithVars to execute.
      Parameters:
      args - Values to emit
      See Also:
    • select

      static Block.OutImpl select(Object arg, Path path)
      Changes to task for given PState containing data for given Path and then performs a localSelect. PState reference can be colocated PState or mirror PState. Code after select stays on new task and does not go back to original task.
      Parameters:
      arg - PState or object to query. Only changes tasks if PState var.
      path - Path definition
      See Also:
    • select

      static Block.OutImpl select(Object arg, Path path, SelectOptions options)
      Changes to task for given PState containing data for given Path and then performs a localSelect. PState reference can be colocated PState or mirror PState. Code after select stays on new task and does not go back to original task.
      Parameters:
      arg - PState or object to query. Only changes tasks if PState var.
      path - Path definition
      options - Options for select call
      See Also:
    • localSelect

      static Block.OutImpl localSelect(String pstateVar, Path path)
      Navigates into the PState partition on current task using the given Path. Emits once for every value navigated to. Use out to capture emits into subsequent dataflow code.
      Parameters:
      pstateVar - PState to query
      path - Path definition
      See Also:
    • localSelect

      static Block.OutImpl localSelect(String pstateVar, Path path, SelectOptions options)
      Navigates into the PState partition on current task using the given Path. Emits once for every value navigated to. Use out to capture emits into subsequent dataflow code.
      Parameters:
      pstateVar - PState to query
      path - Path definition
      options - Options for localSelect call
      See Also:
    • localTransform

      static Block.Impl localTransform(String pstateVar, Path path)
      Executes transform Path on the PState partition on current task.
      Parameters:
      pstateVar - PState to modify
      path - Path definition
      See Also:
    • localClear

      static Block.Impl localClear(String pstateVar)
      Removes all data from the PState partition on current task. Can only be used with PStates owned by stream topologies. Extremely expensive to run for large PState partitions.
      Parameters:
      pstateVar - PState to clear
      See Also:
    • hashPartition

      static Block.Impl hashPartition(Object arg)
      Changes tasks based on hash of argument modulo number of tasks in module. The same argument always hashes to the same task.
      Parameters:
      arg - Value, var, or Expr
      See Also:
    • hashPartition

      static Block.Impl hashPartition(String pobjectVar, Object arg)
      Changes tasks based on hash of argument modulo number of partitions of given depot or PState. The same argument always hashes to the same task.
      Parameters:
      pobjectVar - Depot or PState reference
      arg - Value, var, or Expr
      See Also:
    • allPartition

      static Block.Impl allPartition()
      Executes subsequent code on all tasks in module
      See Also:
    • allPartition

      static Block.Impl allPartition(String pobjectVar)
      Executes subsequent code on all partitions of given depot or PState
      Parameters:
      pobjectVar - Depot or PState reference
      See Also:
    • globalPartition

      static Block.Impl globalPartition()
      Changes to task 0
      See Also:
    • globalPartition

      static Block.Impl globalPartition(String pobjectVar)
      Changes to partition 0 of given depot or PState. For colocated depots and PStates this will be task 0.
      Parameters:
      pobjectVar - Depot or PState reference
      See Also:
    • shufflePartition

      static Block.Impl shufflePartition()
      Changes to a random task chosen uniformly.
      See Also:
    • directPartition

      static Block.Impl directPartition(Object argTaskId)
      Changes to specified task ID
      Parameters:
      argTaskId - Value, var, or Expr
      See Also:
    • directPartition

      static Block.Impl directPartition(String pobjectVar, Object argPartitionId)
      Changes to specified partition of the given depot or PState
      Parameters:
      pobjectVar - Depot or PState reference
      argPartitionId - Value, var, or Expr
      See Also:
    • pathPartition

      static Block.Impl pathPartition(String pstateVar, Path path)
      Changes to task for given PState containing data for given Path
      Parameters:
      pstateVar - PState reference
      path - Path definition
      See Also:
    • originPartition

      static Block.Impl originPartition()
      Changes back to starting task for a query topology invocation. Can only be used in query topologies and must be final partitioner used.
      See Also:
    • agg

      static Block.OutImpl agg(Agg agg)
      Aggregates input in a batch block to a single value. Capture output with out.
      Parameters:
      agg - Aggregator to use
      See Also:
    • agg

      static Block.Impl agg(String pstateVar, Agg agg)
      Update PState partition on current task with given aggregator. Can be used in batch blocks or regular blocks.
      Parameters:
      pstateVar - PState reference
      agg - Aggregator to use
      See Also:
    • limitAgg

      static Block.Impl limitAgg(LimitAgg limitAgg)
      Limits incoming data to a fixed amount according to optional sort options. Only usable in batch blocks and operates during agg and post-agg phases.
      Parameters:
      limitAgg - Definition of aggregator
      See Also:
    • compoundAgg

      static Block.OutImpl compoundAgg(CompoundAgg compoundAgg)
      Aggregates input in a batch block to a single value. Aggregation specified using a data structure template. Capture output with out.
      Parameters:
      compoundAgg - Data structure template of aggregation
      See Also:
    • compoundAgg

      static Block.Impl compoundAgg(String pstateVar, CompoundAgg compoundAgg)
      Update PState partition on current task with given aggregation template. Can be used in batch blocks or regular blocks.
      Parameters:
      pstateVar - PState reference
      compoundAgg - Data structure template of aggregation
      See Also:
    • batchBlock

      static Block.Impl batchBlock(Block batchBlock)
      Specifies a batch block. A batch block is partially declarative and supports joins, multiple step aggregation, and more. See the extended documentation for details.
      Parameters:
      batchBlock - Body of batch block
      See Also:
    • freshBatchSource

      static Block.Impl freshBatchSource()
      Declares a new batch source within pre-agg portion of a batch block
      See Also:
    • materialize

      static Block.OutImpl materialize(Object... args)
      Produces a temporary PState of tuples within a batch block in a microbatch topology. Use subsequent out call to name the PState.
      Parameters:
      args - Values to capture into tuples
      See Also:
    • explodeMaterialized

      static Block.OutImpl explodeMaterialized(String pstateVar)
      Emits all tuples across all partitions of a temporary PState created from materialize(java.lang.Object...). Use subsequent out call to assign vars to each element of materialized tuples.
      Parameters:
      pstateVar - Temporary PState reference
      See Also:
    • explodeMicrobatch

      static Block.OutImpl explodeMicrobatch(String microbatchVar)
      Emits all data for this microbatch source across all partitions of depot
      Parameters:
      microbatchVar - Var representing microbatch coming from depot source
      See Also:
    • invokeQuery

      static Block.OutImpl invokeQuery(String queryVarOrTopologyName, Object... args)
      Invokes a colocated or mirror query topology
      Parameters:
      queryVarOrTopologyName - Either the name of a query topology in same module or var for another module's query topology assigned when calling clusterQuery
      args - Arguments to query topology
      See Also:
    • depotPartitionAppend

      static Block.OutImpl depotPartitionAppend(String depotVar, Object arg, AckLevel ackLevel)
      Append data to the partition of the depot represented by current task. Note that this does not use the built-in partitioning scheme of the depot. To append to a mirror depot, must partition to the mirror depot with a partitioner.
      Parameters:
      depotVar - Depot reference
      arg - Value, var, or Expr
      ackLevel - AckLevel
      See Also:
    • depotPartitionAppend

      static Block.OutImpl depotPartitionAppend(String depotVar, Object arg)
      Append data to the partition of the depot represented by current task. Note that this does not use the built-in partitioning scheme of the depot. To append to a mirror depot, must partition to the mirror depot with a partitioner. Defaults to AckLevel.APPEND_ACK.
      Parameters:
      depotVar - Depot reference
      arg - Value, var, or Expr
      See Also:
    • subBatch

      static Block.OutImpl subBatch(SubBatch subBatch)
      Use specified SubBatch as a batch source in a batch block. Capture output of SubBatch into vars using subsequent out call.
      See Also:
    • macro

      static Block.Impl macro(Block block)
      Inserts all code from given Block into the current callsite. This facility allows dataflow code to be broken up into reusable chunks.
      Parameters:
      block - Dataflow code
      See Also:
    • subSource

      static Block.Impl subSource(Object arg, SubSource... subsources)
      Conditionally dispatch code based on type of input object
      Parameters:
      arg - Object to dispatch on
      subsources - Any number of declarations specifying a matching type and dataflow code
      See Also:
    • cond

      static Block.Impl cond(Case... cases)
      Evaluates condition for each Case in order. Stops checking on first matching condition and evaluates that case's dataflow code. If no condition matches, dataflow stops.
      Parameters:
      cases - Any number of Case declarations
    • yieldIfOvertime

      static Block.Impl yieldIfOvertime()
      Yield the task thread if current event is using too much time. Commonly used in loop bodies.
      See Also:
    • ackReturn

      static Block.Impl ackReturn(Object arg)
      Accumulate value according to depot source options to return with depot appends done with AckLevel.ACK
      Parameters:
      arg - Value to accumulate
      See Also: