Interface OpDispenser<T>

Type Parameters:
T - The parameter type of the actual operation which will be used to hold all the details for executing an operation, something that implements Runnable.
All Superinterfaces:
LongFunction<T>, OpResultTracker
All Known Implementing Classes:
BaseOpDispenser, StandardOpDispenser

public interface OpDispenser<T> extends LongFunction<T>, OpResultTracker

Synopsis

An OpDispenser is responsible for mapping a cycle number into an executable operation. This is where Op Synthesis occurs in NoSQLBench.


BaseOpDispenser

Some common behaviors which are intended to be portable across all op dispenser types are implemented in BaseOpDispenser. It is strongly recommended that you use this as your base type when implementing op dispensers.

Concepts

Op Synthesis is the process of building a specific executable operation for some (low level driver) API by combining the static and dynamic elements of the operation together. In most cases, implementations of OpDispenser will be constructed within the logic of an OpMapper which is responsible for determining the type of OpDispenser to use as associated with a specific type <T>. The OpMapper is called for each type of operation that is active during activity initialization. It's primary responsibility is figuring out what types of OpDispensers to create based on the op templates provided by users. Once the activity is initialized, a set of op dispensers is held as live dispensers to use as needed to synthesize new operations from generated data in real time.


Implementation Strategy

OpDispenser implementations are intended to be implemented for each type of distinct operation that is supported by a DriverAdapter. That is not to say that an OpDispenser can't be responsible for producing multiple types of operations. Operations which are similar in what they need and how they are constructed make sense to be implemented in the same op dispenser. Those which need different construction logic or fundamentally different types of field values should be implemented separately. The rule of thumb is to ensure that op construction patterns are easy to understand at the mapping level (OpMapper), and streamlined for fast execution at the synthesis level (OpDispenser).

  • Method Summary

    Modifier and Type
    Method
    Description
    apply(long value)
    The apply method in an op dispenser should do all the work of creating an operation that is executable by some other caller.

    Methods inherited from interface io.nosqlbench.engine.api.activityimpl.OpResultTracker

    onError, onStart, onSuccess
  • Method Details

    • apply

      T apply(long value)
      The apply method in an op dispenser should do all the work of creating an operation that is executable by some other caller. The value produced by the apply method should not require additional processing if a caller wants to execute the operation multiple times, as for retries.
      Specified by:
      apply in interface LongFunction<T>
      Parameters:
      value - The cycle number which serves as the seed for any generated op fields to be bound into an operation.
      Returns:
      an executable operation