mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-14 08:33:30 -06:00
generalize op source
This commit is contained in:
parent
089a29d846
commit
8313613943
@ -23,19 +23,10 @@ import java.util.function.Function;
|
||||
/**
|
||||
* An OpSequence provides fast access to a set of operations in a specific
|
||||
* order.
|
||||
*
|
||||
* @param <T> The type of element which is to be sequenced
|
||||
*/
|
||||
public interface OpSequence<T> {
|
||||
|
||||
/**
|
||||
* Get the next operation for the given long value. This is simply
|
||||
* the offset indicated by the offset sequence array at a modulo
|
||||
* position.
|
||||
*
|
||||
* @param selector the long value that determines the next op
|
||||
* @return An op of type T
|
||||
*/
|
||||
T get(long selector);
|
||||
public interface OpSequence<T> extends OpSource<T> {
|
||||
|
||||
/**
|
||||
* Get the list of individual operations which could be returned by {@link #get(long)}.
|
||||
|
@ -0,0 +1,27 @@
|
||||
package io.nosqlbench.engine.api.activityapi.planning;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
/**
|
||||
* An OpSource provides an Op when given an ordinal.
|
||||
* OpSources are expected to be deterministic with respect to inputs.
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public interface OpSource<T> extends LongFunction<T> {
|
||||
|
||||
/**
|
||||
* Get the next operation for the given long value. This is simply
|
||||
* the offset indicated by the offset sequence array at a modulo
|
||||
* position.
|
||||
*
|
||||
* @param selector the long value that determines the next op
|
||||
* @return An op of type T
|
||||
*/
|
||||
T get(long selector);
|
||||
|
||||
@Override
|
||||
default T apply(long value) {
|
||||
return get(value);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user