org.apache.tinkerpop.gremlin.process.traversal.step

## Interface Barrier<B>

- All Superinterfaces:
    MemoryComputing<B>
  All Known Subinterfaces:
    LocalBarrier<S>
  All Known Implementing Classes:
    AggregateStep, CollectingBarrierStep, CountGlobalStep, DedupGlobalStep, FoldStep, GroupCountStep, GroupStep, LambdaCollectingBarrierStep, MaxGlobalStep, MeanGlobalStep, MinGlobalStep, NoOpBarrierStep, OrderGlobalStep, ProfilingAware.ProfiledBarrier, RangeGlobalStep, ReducingBarrierStep, SampleGlobalStep, SideEffectCapStep, SumGlobalStep, SupplyingBarrierStep, TailGlobalStep, TreeStep

      public interface Barrier<B>
      extends MemoryComputing<B>

  A Barrier is any step that requires all left traversers to be processed prior to emitting result traversers to the right. Note that some barrier steps may be "lazy" in that if their algorithm permits, they can emit right traversers prior to all traversers being aggregated. A barrier is the means by which a distributed step in `TraversalVertexProgram` is synchronized and made to behave a single step. All Barrier steps implement `MemoryComputing` as that is how barriers communicate with one another in `GraphComputer`.
  Author:
    Marko A. Rodriguez (http://markorodriguez.com)

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBarrier(B barrier)` Add a barrier to the step.
    `default void` | `done()` A way to hard set that the barrier is complete.
    `boolean` | `hasNextBarrier()` Whether or not the step has an accessible barrier.
    `B` | `nextBarrier()` Get the next barrier within this step.
    `void` | `processAllStarts()` Process all left traversers by do not yield the resultant output.

    - ### Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.step.MemoryComputing

      `getMemoryComputeKey`

- - ### Method Detail

    - #### processAllStarts

          void processAllStarts()

      Process all left traversers by do not yield the resultant output. This method is useful for steps like `ReducingBarrierStep`, where traversers can be processed "on the fly" and thus, reduce memory consumption.

    - #### hasNextBarrier

          boolean hasNextBarrier()

      Whether or not the step has an accessible barrier.
      Returns:
        whether a barrier exists or not

    - #### nextBarrier

          B nextBarrier()
                 throws NoSuchElementException

      Get the next barrier within this step. Barriers from parallel steps can be the be merged to create a single step with merge barriers.
      Returns:
        the next barrier of the step
      Throws:
        `NoSuchElementException`

    - #### addBarrier

          void addBarrier(B barrier)

      Add a barrier to the step. This typically happens when multiple parallel barriers need to become one barrier at a single step.
      Parameters:
        `barrier` - the barrier to merge in

    - #### done

          default void done()

      A way to hard set that the barrier is complete. This is necessary when parallel barriers don't all have barriers and need hard resetting. The default implementation does nothing.

Copyright © 2013–2019 Apache Software Foundation. All rights reserved.