mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
jshook/nosqlbench-2057-flattenop (#2067)
* remove ChainingOp * typos and other minor fixes * remove Op, ChainingOp, flatten to CycleOp, derive RunnableOp * refactor qdrant for aligned op types * refactor mongodb for aligned op types * refactor cqld4 for aligned op types * minor API alignment refactor gcpspanner for aligned op types * minor API alignment refactor gcpspanner for aligned op types add license * fix cqld4 batch statement mapper * fix cql base op mapper * remove var inference * remove emitter for runnable op
This commit is contained in:
@@ -20,10 +20,10 @@ package io.nosqlbench.adapter.diag;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.nb.api.labels.NBLabels;
|
||||
import io.nosqlbench.nb.api.components.core.NBComponent;
|
||||
|
||||
public interface DriverAdapterLoader {
|
||||
public <A extends Op,B extends Space> DriverAdapter<A,B> load(NBComponent parent, NBLabels childLabels);
|
||||
public <A extends CycleOp<?>,B extends Space> DriverAdapter<A,B> load(NBComponent parent, NBLabels childLabels);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.codahale.metrics.Timer;
|
||||
import groovy.lang.Binding;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.evalctx.*;
|
||||
import io.nosqlbench.adapters.api.metrics.ThreadLocalNamedTimers;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
@@ -46,7 +46,8 @@ import java.util.concurrent.TimeUnit;
|
||||
* @param <OP>
|
||||
* The type of operation
|
||||
*/
|
||||
public abstract class BaseOpDispenser<OP extends Op,SPACE extends Space> extends NBBaseComponent implements OpDispenser<OP>{
|
||||
public abstract class BaseOpDispenser<OP extends CycleOp<?>,SPACE extends Space>
|
||||
extends NBBaseComponent implements OpDispenser<OP> {
|
||||
protected final static Logger logger = LogManager.getLogger(BaseOpDispenser.class);
|
||||
public static final String VERIFIER = "verifier";
|
||||
public static final String VERIFIER_INIT = "verifier-init";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.evalctx.CycleFunction;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
@@ -67,9 +67,9 @@ import java.util.function.LongFunction;
|
||||
*
|
||||
* @param <OP> The parameter type of the actual operation which will be used
|
||||
* to hold all the details for executing an operation,
|
||||
* something that implements {@link Op}.
|
||||
* something that implements {@link io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp}.
|
||||
*/
|
||||
public interface OpDispenser<OP extends Op> extends LongFunction<OP>, OpResultTracker {
|
||||
public interface OpDispenser<OP extends CycleOp<?>> extends LongFunction<OP>, OpResultTracker {
|
||||
|
||||
/**
|
||||
* The apply method in an op dispenser should do all the work of
|
||||
|
||||
@@ -18,12 +18,10 @@ package io.nosqlbench.adapters.api.activityimpl;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
/**
|
||||
@@ -83,7 +81,7 @@ import java.util.function.LongFunction;
|
||||
* to hold all the details for executing an operation,
|
||||
* generally something that implements {@link Runnable}.
|
||||
*/
|
||||
public interface OpMapper<OPTYPE extends Op, SPACETYPE extends Space>
|
||||
public interface OpMapper<OPTYPE extends CycleOp<?>, SPACETYPE extends Space>
|
||||
extends BiFunction<ParsedOp, LongFunction<SPACETYPE>, OpDispenser<OPTYPE>> {
|
||||
|
||||
/**
|
||||
@@ -96,6 +94,7 @@ public interface OpMapper<OPTYPE extends Op, SPACETYPE extends Space>
|
||||
* @param spaceInitF
|
||||
* @return An OpDispenser which can be used to synthesize real operations.
|
||||
*/
|
||||
OpDispenser<OPTYPE> apply(ParsedOp op, LongFunction<SPACETYPE> spaceInitF);
|
||||
|
||||
@Override
|
||||
OpDispenser<OPTYPE> apply(ParsedOp op, LongFunction<SPACETYPE> spaceInitF);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package io.nosqlbench.adapters.api.activityimpl.docs;
|
||||
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.nb.api.docsapi.BundledMarkdownManifest;
|
||||
import io.nosqlbench.nb.api.docsapi.Docs;
|
||||
import io.nosqlbench.nb.api.docsapi.DocsBinder;
|
||||
@@ -41,7 +41,7 @@ public class BundledDriverAdapterDocs implements BundledMarkdownManifest {
|
||||
List<SimpleServiceLoader.Component<? extends DriverAdapterLoader>> namedProviders = loader.getNamedProviders();
|
||||
for (SimpleServiceLoader.Component<? extends DriverAdapterLoader> namedProvider : namedProviders) {
|
||||
DriverAdapterLoader driverAdapterLoader = namedProvider.provider.get();
|
||||
DriverAdapter<Op, Space> driverAdapter = driverAdapterLoader.load(
|
||||
DriverAdapter<? extends CycleOp<?>, Space> driverAdapter = driverAdapterLoader.load(
|
||||
NBComponent.EMPTY_COMPONENT,
|
||||
NBLabels.forKV()
|
||||
);
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.fieldmappers.FieldDestructuringMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import io.nosqlbench.nb.api.config.standard.*;
|
||||
import io.nosqlbench.nb.api.labels.NBLabels;
|
||||
@@ -33,10 +33,9 @@ import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.LongFunction;
|
||||
import java.util.function.LongToIntFunction;
|
||||
import java.util.function.LongUnaryOperator;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class BaseDriverAdapter<R extends Op, S extends Space> extends NBBaseComponent implements DriverAdapter<R, S>, NBConfigurable, NBReconfigurable {
|
||||
public abstract class BaseDriverAdapter<R extends CycleOp<?>, S extends Space> extends NBBaseComponent implements DriverAdapter<R, S>, NBConfigurable, NBReconfigurable {
|
||||
private final static Logger logger = LogManager.getLogger("ADAPTER");
|
||||
|
||||
private ConcurrentSpaceCache<S> spaceCache;
|
||||
|
||||
@@ -18,10 +18,7 @@ package io.nosqlbench.adapters.api.activityimpl.uniform;
|
||||
*/
|
||||
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.LongFunction;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
|
||||
public class BaseSpace<SelfT extends BaseSpace<SelfT> > implements Space {
|
||||
|
||||
@@ -39,7 +36,7 @@ public class BaseSpace<SelfT extends BaseSpace<SelfT> > implements Space {
|
||||
}
|
||||
|
||||
public static class BasicSpace extends BaseSpace<BasicSpace> implements Space {
|
||||
public BasicSpace(DriverAdapter<Op, BasicSpace> adapter, long idx) {
|
||||
public BasicSpace(DriverAdapter<? extends CycleOp<?>, BasicSpace> adapter, long idx) {
|
||||
super(adapter, idx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package io.nosqlbench.adapters.api.activityimpl.uniform;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.nb.api.docsapi.Docs;
|
||||
import io.nosqlbench.nb.api.docsapi.DocsBinder;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
@@ -33,7 +33,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
/**
|
||||
@@ -56,7 +55,7 @@ import java.util.function.LongFunction;
|
||||
* during construction of R type operations, or even for individual
|
||||
* operations.
|
||||
*/
|
||||
public interface DriverAdapter<OPTYPE extends Op, SPACETYPE extends Space> extends NBComponent {
|
||||
public interface DriverAdapter<OPTYPE extends CycleOp<?>, SPACETYPE extends Space> extends NBComponent {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* <H2>ChainingOp<I,O>: f(I) -> O<I,O></H2>
|
||||
* <P>
|
||||
* Run a function on the current cached result in the current thread and replace it
|
||||
* with the result of the function. ChainingOps are one way of invoking
|
||||
* logic within a cycle. However, they are not intended to stand alone.
|
||||
* A ChainingOp must always have an input to work on,
|
||||
* provided by either a {@link CycleOp} OR <em>another</em> call to a {@link ChainingOp}</P>
|
||||
*
|
||||
* @param <I> Some input type, as determined by a previous {@link CycleOp} or {@link ChainingOp} on the same thread.
|
||||
* @param <O> Some output type.
|
||||
*/
|
||||
public interface ChainingOp<I, O> extends Op, Function<I, O> {
|
||||
|
||||
/**
|
||||
* Transform a value from a previous action and provide the result for a subsequent action.
|
||||
*
|
||||
* @param lastResult object form a previous operation or action
|
||||
* @return a new result
|
||||
*/
|
||||
@Override
|
||||
O apply(I lastResult);
|
||||
}
|
||||
@@ -27,12 +27,6 @@ import java.util.function.LongFunction;
|
||||
* and produces a value of type T. It is implemented as
|
||||
* {@link LongFunction} of T.</p>
|
||||
*
|
||||
* <P>This variant of {@link Op} has the ability to see the cycle
|
||||
* which was previously used to select the op implementation.</p>
|
||||
*
|
||||
* <p>It also has the ability to emit an value which can be seen a subsequent operation, if
|
||||
* and only if it is a {@link ChainingOp}s.</P>
|
||||
*
|
||||
* <h2>Designer Notes</h2>
|
||||
* <p>
|
||||
* If you are using the value in this call to select a specific type of behavior, it is very
|
||||
@@ -43,12 +37,11 @@ import java.util.function.LongFunction;
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface CycleOp<T> extends Op, LongFunction<T> {
|
||||
public interface CycleOp<T> extends LongFunction<T> {
|
||||
/**
|
||||
* <p>Run an action for the given cycle.</p>
|
||||
*
|
||||
* @param value The cycle value for which an operation is run
|
||||
* @return A result object which <em>may</em> be used by a subsequent {@link ChainingOp}
|
||||
*/
|
||||
@Override
|
||||
T apply(long value);
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes;
|
||||
|
||||
/**
|
||||
* <p>This is the root type of any operation which is used in a NoSQLBench
|
||||
* DriverAdapter. It is a tagging interface for incremental type validation
|
||||
* in the NB runtime. You probably don't want to use it directly.</p>
|
||||
*
|
||||
* <p>Instead, use <em>one</em> of these:
|
||||
* <ul>
|
||||
* <li>{@link CycleOp}</li> - An interface that will called if there is nothing to consume
|
||||
* the result type from your operation. In some cases preparing a result body to
|
||||
* hand down the chain is more costly, so implementing this interface allows the runtime
|
||||
* to be more optimized.</li>
|
||||
* <li>{@link ChainingOp}</li>
|
||||
* <li>{@link RunnableOp}</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*/
|
||||
// TODO: optimize the runtime around the specific op type
|
||||
public interface Op {
|
||||
}
|
||||
@@ -31,5 +31,5 @@ package io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes;
|
||||
*
|
||||
*/
|
||||
public interface OpGenerator {
|
||||
Op getNextOp();
|
||||
CycleOp<?> getNextOp();
|
||||
}
|
||||
|
||||
@@ -1,34 +1,28 @@
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Copyright (c) nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes;
|
||||
|
||||
/**
|
||||
* <H2>RunnableOp</H2>
|
||||
* <P>This is the simplest form of an executable operation in NoSQLBench.
|
||||
* It is simply an operation is run for side-effect only.</P>
|
||||
*/
|
||||
public interface RunnableOp extends Op, Runnable {
|
||||
public interface RunnableOp extends CycleOp<Void>,Runnable {
|
||||
|
||||
/**
|
||||
* Invoke the operation. If you need to see the value of the current
|
||||
* cycle, then you can use {@link CycleOp} instead. If you need to
|
||||
* use a cached result of a previous operation, then you may need to
|
||||
* use {@link ChainingOp}.
|
||||
*/
|
||||
@Override
|
||||
void run();
|
||||
default Void apply(long value) {
|
||||
run();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
@@ -17,7 +17,6 @@
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.opwrappers;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.RunnableOp;
|
||||
|
||||
public class DryCycleOp<T> implements CycleOp<T> {
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.RunnableOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
public class DryCycleOpDispenserWrapper<S extends Space, RESULT> extends BaseOpDispenser<CycleOp<RESULT>, S> {
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.opwrappers;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.RunnableOp;
|
||||
|
||||
public class DryRunableOp implements RunnableOp {
|
||||
|
||||
private final RunnableOp op;
|
||||
|
||||
public DryRunableOp(RunnableOp op) {
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.opwrappers;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.RunnableOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class DryRunnableOpDispenserWrapper<S extends Space> extends BaseOpDispenser<RunnableOp, S> {
|
||||
private final OpDispenser<RunnableOp> realDispenser;
|
||||
|
||||
public DryRunnableOpDispenserWrapper(
|
||||
DriverAdapter<RunnableOp, S> adapter,
|
||||
ParsedOp pop,
|
||||
OpDispenser<RunnableOp> realDispenser
|
||||
) {
|
||||
super(adapter, pop);
|
||||
this.realDispenser = realDispenser;
|
||||
logger.warn(
|
||||
"initialized {} for dry run only. " +
|
||||
"This op will be synthesized for each cycle, but will not be executed.",
|
||||
pop.getName()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public DryRunableOp getOp(long cycle) {
|
||||
RunnableOp op = realDispenser.getOp(cycle);
|
||||
return new DryRunableOp(op);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.RunnableOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
public class EmitterCycleOpDispenserWrapper<O,S extends Space,R> extends BaseOpDispenser<CycleOp<R>, S> {
|
||||
|
||||
@@ -21,14 +21,14 @@ import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
public class EmitterOpDispenserWrapper extends BaseOpDispenser<Op, Space> {
|
||||
public class EmitterOpDispenserWrapper extends BaseOpDispenser<CycleOp<?>, Space> {
|
||||
|
||||
private final OpDispenser<? extends CycleOp<?>> realDispenser;
|
||||
|
||||
public EmitterOpDispenserWrapper(DriverAdapter<Op,Space> adapter, ParsedOp pop, OpDispenser<? extends CycleOp<?>> realDispenser) {
|
||||
public EmitterOpDispenserWrapper(DriverAdapter<CycleOp<?>,Space> adapter, ParsedOp pop,
|
||||
OpDispenser<? extends CycleOp<?>> realDispenser) {
|
||||
super(adapter, pop);
|
||||
this.realDispenser = realDispenser;
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.opwrappers;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.RunnableOp;
|
||||
|
||||
public class EmitterRunnableOp implements RunnableOp {
|
||||
|
||||
private final RunnableOp runnableOp;
|
||||
public EmitterRunnableOp(RunnableOp runnableOp) {
|
||||
this.runnableOp = runnableOp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
runnableOp.run();
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.opwrappers;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.RunnableOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
public class EmitterRunnableOpDispenserWrapper<O,S> extends BaseOpDispenser<RunnableOp, Space> {
|
||||
|
||||
private final OpDispenser<RunnableOp> realDispenser;
|
||||
|
||||
public EmitterRunnableOpDispenserWrapper(
|
||||
DriverAdapter<? extends RunnableOp, ? extends Space> adapter,
|
||||
ParsedOp pop,
|
||||
OpDispenser<RunnableOp> realDispenser
|
||||
) {
|
||||
super(adapter, pop);
|
||||
this.realDispenser = realDispenser;
|
||||
logger.warn(
|
||||
"initialized {} for to emit the result type to stdout. ",
|
||||
pop.getName()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmitterRunnableOp getOp(long cycle) {
|
||||
RunnableOp cycleOp = realDispenser.getOp(cycle);
|
||||
return new EmitterRunnableOp(cycleOp);
|
||||
}
|
||||
}
|
||||
@@ -17,14 +17,11 @@
|
||||
package io.nosqlbench.adapters.api.activityimpl.uniform.opwrappers;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.OpGenerator;
|
||||
import io.nosqlbench.adapters.api.evalctx.CycleFunction;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class PollingOp<T> implements CycleOp<T>, OpGenerator {
|
||||
private final static Logger logger = LogManager.getLogger(PollingOp.class);
|
||||
|
||||
@@ -52,7 +49,7 @@ public class PollingOp<T> implements CycleOp<T>, OpGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Op getNextOp() {
|
||||
public synchronized CycleOp<T> getNextOp() {
|
||||
return nextOp;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user