many-sessions improvements, type fixes, more javadocs (#2094)

* some javadoc and type alignment improvements

* some javadoc and type alignment improvements

* example adapter

* alignment to previous changes

* improvements to many session testing

* add missing annotation
This commit is contained in:
Jonathan Shook 2024-11-20 17:25:30 -06:00 committed by GitHub
parent 2229f919a2
commit 130977fa34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
123 changed files with 949 additions and 393 deletions

View File

@ -19,12 +19,10 @@ package io.nosqlbench.adapter.amqp;
import io.nosqlbench.adapter.amqp.dispensers.AmqpMsgRecvOpDispenser;
import io.nosqlbench.adapter.amqp.dispensers.AmqpMsgSendOpDispenser;
import io.nosqlbench.adapter.amqp.ops.AmqpTimeTrackOp;
import io.nosqlbench.adapters.api.activityimpl.uniform.ConcurrentSpaceCache;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import org.apache.logging.log4j.LogManager;
@ -45,7 +43,7 @@ public class AmqpOpMapper implements OpMapper<AmqpTimeTrackOp,AmqpSpace> {
}
@Override
public OpDispenser<AmqpTimeTrackOp> apply(ParsedOp op, LongFunction spaceInitF) {
public OpDispenser<AmqpTimeTrackOp> apply(NBComponent adapterC, ParsedOp op, LongFunction spaceInitF) {
//public OpDispenser<AmqpTimeTrackOp> apply(ParsedOp op, LongFunction<AmqpTimeTrackOp> spaceInitF) {
int spaceName = op.getStaticConfigOr("space", 0);

View File

@ -23,7 +23,6 @@ import io.nosqlbench.adapter.amqp.exception.AmqpAdapterUnexpectedException;
import io.nosqlbench.adapter.amqp.ops.AmqpTimeTrackOp;
import io.nosqlbench.adapter.amqp.util.AmqpAdapterMetrics;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.logging.log4j.LogManager;
@ -49,7 +48,7 @@ public abstract class AmqpBaseOpDispenser extends BaseOpDispenser<AmqpTimeTrack
protected AmqpBaseOpDispenser(final AmqpDriverAdapter adapter,
final ParsedOp op) {
super(adapter, op);
super(adapter, op, adapter.getSpaceFunc(op));
parsedOp = op;
amqpAdapterMetrics = new AmqpAdapterMetrics(this, this);

View File

@ -16,7 +16,7 @@
package io.nosqlbench.adapter.azureaisearch;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -54,6 +54,7 @@ public class AzureAISearchOpMapper implements OpMapper<AzureAISearchBaseOp<?,?>,
* Given an instance of a {@link ParsedOp} returns the appropriate
* {@link AzureAISearchBaseOpDispenser} subclass.
*
* @param adapterC
* @param op
* The {@link ParsedOp} to be evaluated
* @param spaceInitF
@ -61,7 +62,7 @@ public class AzureAISearchOpMapper implements OpMapper<AzureAISearchBaseOp<?,?>,
* the op type
*/
@Override
public OpDispenser<AzureAISearchBaseOp<?,?>> apply(ParsedOp op, LongFunction<AzureAISearchSpace> spaceInitF) {
public OpDispenser<AzureAISearchBaseOp<?,?>> apply(NBComponent adapterC, ParsedOp op, LongFunction<AzureAISearchSpace> spaceInitF) {
TypeAndTarget<AzureAISearchOpType, String> typeAndTarget = op.getTypeAndTarget(AzureAISearchOpType.class,
String.class, "type", "target");

View File

@ -39,7 +39,7 @@ public abstract class AzureAISearchBaseOpDispenser<REQUEST,RESULT>
@SuppressWarnings("rawtypes")
protected AzureAISearchBaseOpDispenser(AzureAISearchDriverAdapter adapter, ParsedOp op,
LongFunction<String> targetF) {
super((DriverAdapter) adapter, op);
super((DriverAdapter) adapter, op, adapter.getSpaceFunc(op));
this.azureAISearchSpaceFunction = adapter.getSpaceFunc(op);
this.clientFunction = (long l) -> {
try {
@ -53,10 +53,6 @@ public abstract class AzureAISearchBaseOpDispenser<REQUEST,RESULT>
this.opF = createOpFunc(paramF, this.clientFunction, op, targetF);
}
protected AzureAISearchDriverAdapter getDriverAdapter() {
return (AzureAISearchDriverAdapter) adapter;
}
public abstract LongFunction<REQUEST> getParamFunc(LongFunction<SearchIndexClient> clientF, ParsedOp op,
LongFunction<String> targetF);
@ -64,8 +60,8 @@ public abstract class AzureAISearchBaseOpDispenser<REQUEST,RESULT>
LongFunction<SearchIndexClient> clientF, ParsedOp op, LongFunction<String> targetF);
@Override
public AzureAISearchBaseOp<REQUEST,RESULT> getOp(long value) {
return opF.apply(value);
public AzureAISearchBaseOp<REQUEST,RESULT> getOp(long cycle) {
return opF.apply(cycle);
}
}

View File

@ -84,6 +84,7 @@ public class Cqld4Space extends BaseSpace<Cqld4Space> {
// stop insights for testing
OptionsMap defaults = new OptionsMap();
defaults.put(TypedDriverOption.MONITOR_REPORTING_ENABLED, false); // We don't need to do this every time we run a test or sanity check
defaults.put(TypedDriverOption.SESSION_LEAK_THRESHOLD, 100000000);
DriverConfigLoader dcl = DriverConfigLoader.fromMap(defaults);
// add streamlined cql parameters

View File

@ -16,17 +16,13 @@
package io.nosqlbench.adapter.cqld4.opdispensers;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.*;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.optionhelpers.BatchTypeEnum;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlBatchStatement;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseSpace;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.jetbrains.annotations.NotNull;
@ -50,7 +46,7 @@ public class CqlD4BatchStmtDispenser extends Cqld4CqlBaseOpDispenser<Cqld4CqlBat
this.subop = subop;
this.opfunc = createStmtFunc(op, subopDispenser);
this.submapper = adapter.getOpMapper();
subopDispenser = submapper.apply(subop, adapter.getSpaceFunc(op));
subopDispenser = submapper.apply(this, subop, adapter.getSpaceFunc(op));
}
@ -87,10 +83,10 @@ public class CqlD4BatchStmtDispenser extends Cqld4CqlBaseOpDispenser<Cqld4CqlBat
}
@Override
public Cqld4CqlBatchStatement getOp(long value) {
Statement bstmt = opfunc.apply(value);
public Cqld4CqlBatchStatement getOp(long cycle) {
Statement bstmt = opfunc.apply(cycle);
return new Cqld4CqlBatchStatement(
sessionF.apply(value),
sessionF.apply(cycle),
(BatchStatement) bstmt,
getMaxPages(),
getMaxLwtRetries(),

View File

@ -28,7 +28,6 @@ import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.instruments.CqlOpMetrics;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4BaseOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
@ -40,7 +39,6 @@ import org.apache.logging.log4j.Logger;
import java.nio.ByteBuffer;
import java.time.Duration;
import java.util.Map;
import java.util.function.IntFunction;
import java.util.function.LongFunction;
public abstract class Cqld4BaseOpDispenser<T extends Cqld4BaseOp<?>> extends BaseOpDispenser<T, Cqld4Space> implements CqlOpMetrics {
@ -57,7 +55,7 @@ public abstract class Cqld4BaseOpDispenser<T extends Cqld4BaseOp<?>> extends Bas
public Cqld4BaseOpDispenser(Cqld4DriverAdapter adapter,
ParsedOp op) {
super((DriverAdapter<? extends T, ? extends Cqld4Space>) adapter, op);
super((DriverAdapter<? extends T, ? extends Cqld4Space>) adapter, op, adapter.getSpaceFunc(op));
this.sessionF = l -> adapter.getSpaceFunc(op).apply(l).getSession();
this.maxpages = op.getStaticConfigOr("maxpages", 1);
this.isRetryReplace = op.getStaticConfigOr("retryreplace", false);

View File

@ -30,5 +30,5 @@ public abstract class Cqld4CqlBaseOpDispenser<T extends Cqld4CqlOp> extends Cqld
}
@Override
public abstract T getOp(long value);
public abstract T getOp(long cycle);
}

View File

@ -55,14 +55,14 @@ public class Cqld4FluentGraphOpDispenser extends Cqld4BaseOpDispenser<Cqld4Fluen
}
@Override
public Cqld4FluentGraphOp getOp(long value) {
String graphname = graphnameFunc.apply(value);
public Cqld4FluentGraphOp getOp(long cycle) {
String graphname = graphnameFunc.apply(cycle);
Script script = tlScript.get();
Map<String, Object> allMap = virtdataBindings.getAllMap(value);
Map<String, Object> allMap = virtdataBindings.getAllMap(cycle);
allMap.forEach((k,v) -> script.getBinding().setVariable(k,v));
GraphTraversal<Vertex,Vertex> v = (GraphTraversal<Vertex, Vertex>) script.run();
FluentGraphStatement fgs = new FluentGraphStatementBuilder(v).setGraphName(graphname).build();
return new Cqld4FluentGraphOp(sessionF.apply(value),fgs);
return new Cqld4FluentGraphOp(sessionF.apply(cycle),fgs);
}

View File

@ -22,10 +22,8 @@ import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4BaseOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4ScriptGraphOp;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import java.util.Optional;
@ -39,7 +37,7 @@ public class Cqld4GremlinOpDispenser extends BaseOpDispenser<Cqld4BaseOp<?>, Cql
public Cqld4GremlinOpDispenser(Cqld4DriverAdapter adapter,
LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction, ParsedOp cmd) {
super(adapter,cmd);
super(adapter,cmd, adapter.getSpaceFunc(cmd));
this.sessionFunc = sessionFunc;
this.diagFunc = cmd.getAsFunctionOr("diag", 0L);
@ -59,12 +57,12 @@ public class Cqld4GremlinOpDispenser extends BaseOpDispenser<Cqld4BaseOp<?>, Cql
}
@Override
public Cqld4ScriptGraphOp getOp(long value) {
ScriptGraphStatement stmt = stmtFunc.apply(value);
if (diagFunc.apply(value)>0L) {
public Cqld4ScriptGraphOp getOp(long cycle) {
ScriptGraphStatement stmt = stmtFunc.apply(cycle);
if (diagFunc.apply(cycle)>0L) {
System.out.println("## GREMLIN DIAG: ScriptGraphStatement on graphname(" + stmt.getGraphName() + "):\n" + stmt.getScript());
}
return new Cqld4ScriptGraphOp(sessionFunc.apply(value), stmt);
return new Cqld4ScriptGraphOp(sessionFunc.apply(cycle), stmt);
}
}

View File

@ -24,9 +24,7 @@ import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.RSProcessors;
import io.nosqlbench.adapter.cqld4.diagnostics.CQLD4PreparedStmtDiagnostics;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlPreparedStatement;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.errors.OpConfigError;
import io.nosqlbench.virtdata.core.templates.ParsedTemplateString;
@ -42,6 +40,7 @@ public class Cqld4PreparedStmtDispenser extends Cqld4BaseOpDispenser<Cqld4CqlPre
private final LongFunction<Statement> stmtFunc;
private final ParsedTemplateString stmtTpl;
private final LongFunction<Object[]> fieldsF;
private final LongFunction<Cqld4Space> spaceInitF;
private PreparedStatement preparedStmt;
// This is a stable enum for the op template from the workload, bounded by cardinality of all op templates
private int refkey;
@ -50,12 +49,14 @@ public class Cqld4PreparedStmtDispenser extends Cqld4BaseOpDispenser<Cqld4CqlPre
Cqld4DriverAdapter adapter,
ParsedOp op,
ParsedTemplateString stmtTpl,
RSProcessors processors
RSProcessors processors,
LongFunction<Cqld4Space> spaceInitF
) {
super(adapter, op);
this.processors = processors;
this.stmtTpl = stmtTpl;
this.fieldsF = getFieldsFunction(op);
this.spaceInitF = spaceInitF;
stmtFunc = createStmtFunc(fieldsF, op);
}
@ -76,7 +77,7 @@ public class Cqld4PreparedStmtDispenser extends Cqld4BaseOpDispenser<Cqld4CqlPre
(long l) -> (sessionF.apply(l)).prepare(preparedQueryString);
LongFunction<? extends Cqld4Space> lookupSpaceF =
(long l) -> adapter.getSpaceFunc(op).apply(l);
(long l) -> spaceInitF.apply(l);
int refKey = op.getRefKey();
LongFunction<PreparedStatement> cachedStatementF =

View File

@ -47,10 +47,10 @@ public class Cqld4RawStmtDispenser extends Cqld4CqlBaseOpDispenser<Cqld4CqlSimpl
}
@Override
public Cqld4CqlSimpleStatement getOp(long value) {
public Cqld4CqlSimpleStatement getOp(long cycle) {
return new Cqld4CqlSimpleStatement(
sessionF.apply(value),
(SimpleStatement) stmtFunc.apply(value),
sessionF.apply(cycle),
(SimpleStatement) stmtFunc.apply(cycle),
getMaxPages(),
isRetryReplace(),
getMaxLwtRetries(),

View File

@ -44,10 +44,10 @@ public class Cqld4SimpleCqlStmtDispenser extends Cqld4CqlBaseOpDispenser<Cqld4Cq
}
@Override
public Cqld4CqlSimpleStatement getOp(long value) {
public Cqld4CqlSimpleStatement getOp(long cycle) {
return new Cqld4CqlSimpleStatement(
this.sessionF.apply(value),
(SimpleStatement) stmtFunc.apply(value),
this.sessionF.apply(cycle),
(SimpleStatement) stmtFunc.apply(cycle),
getMaxPages(),
isRetryReplace(),
getMaxLwtRetries(),

View File

@ -25,6 +25,7 @@ import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.List;
import java.util.function.LongFunction;
@ -40,10 +41,10 @@ public class CqlD4BatchStmtMapper<RESULT extends List<? extends Row>> extends Cq
}
@Override
public OpDispenser<Cqld4CqlBatchStatement> apply(ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
public OpDispenser<Cqld4CqlBatchStatement> apply(NBComponent adapterC, ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
ParsedOp subop = op.getAsSubOp("op_template", ParsedOp.SubOpNaming.ParentAndSubKey);
int repeat = op.getStaticValue("repeat");
OpDispenser<Cqld4CqlOp> od = new Cqld4CqlOpMapper(adapter).apply(op, spaceInitF);
OpDispenser<Cqld4CqlOp> od = new Cqld4CqlOpMapper(adapter).apply(adapterC, op, spaceInitF);
return new CqlD4BatchStmtDispenser(adapter, op, repeat, subop, od);
}

View File

@ -19,10 +19,10 @@ package io.nosqlbench.adapter.cqld4.opmappers;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.opdispensers.Cqld4SimpleCqlStmtDispenser;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlSimpleStatement;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.LongFunction;
@ -36,7 +36,7 @@ public class CqlD4CqlSimpleStmtMapper extends Cqld4CqlBaseOpMapper<Cqld4CqlSimpl
}
@Override
public OpDispenser<Cqld4CqlSimpleStatement> apply(ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
public OpDispenser<Cqld4CqlSimpleStatement> apply(NBComponent adapterC, ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
return new Cqld4SimpleCqlStmtDispenser(adapter, targetFunction, op);
}

View File

@ -16,19 +16,14 @@
package io.nosqlbench.adapter.cqld4.opmappers;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.*;
import io.nosqlbench.adapter.cqld4.opdispensers.Cqld4PreparedStmtDispenser;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4BaseOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlPreparedStatement;
import io.nosqlbench.adapter.cqld4.processors.CqlFieldCaptureProcessor;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.params.ParamsParser;
import io.nosqlbench.nb.api.errors.BasicError;
import io.nosqlbench.virtdata.core.templates.ParsedTemplateString;
@ -49,7 +44,11 @@ public class CqlD4PreparedStmtMapper extends Cqld4CqlBaseOpMapper<Cqld4CqlPrepar
}
@Override
public OpDispenser<Cqld4CqlPreparedStatement> apply(ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
public OpDispenser<Cqld4CqlPreparedStatement> apply(
NBComponent adapterC,
ParsedOp op,
LongFunction<Cqld4Space> spaceInitF
) {
ParsedTemplateString stmtTpl = op.getAsTemplate(target.field).orElseThrow(() -> new BasicError(
"No statement was found in the op template:" + op
));
@ -69,7 +68,7 @@ public class CqlD4PreparedStmtMapper extends Cqld4CqlBaseOpMapper<Cqld4CqlPrepar
});
});
return new Cqld4PreparedStmtDispenser(adapter, op, stmtTpl, processors);
return new Cqld4PreparedStmtDispenser(adapter, op, stmtTpl, processors, spaceInitF);
}
}

View File

@ -18,14 +18,11 @@ package io.nosqlbench.adapter.cqld4.opmappers;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4RainbowTableOp;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.LongFunction;
@ -44,7 +41,7 @@ public class CqlD4RainbowTableMapper<CO extends Cqld4RainbowTableOp> extends Cql
}
@Override
public OpDispenser<Cqld4RainbowTableOp> apply(ParsedOp op, LongFunction spaceInitF) {
public OpDispenser<Cqld4RainbowTableOp> apply(NBComponent adapterC, ParsedOp op, LongFunction spaceInitF) {
return null;
// return new CqlD4RainbowTableDispenser(adapter, sessionFunc,targetFunction, op);
}

View File

@ -19,10 +19,10 @@ package io.nosqlbench.adapter.cqld4.opmappers;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.opdispensers.Cqld4RawStmtDispenser;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4BaseOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlSimpleStatement;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.LongFunction;
@ -35,7 +35,7 @@ public class CqlD4RawStmtMapper extends Cqld4CqlBaseOpMapper<Cqld4CqlSimpleState
}
@Override
public OpDispenser<Cqld4CqlSimpleStatement> apply(ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
public OpDispenser<Cqld4CqlSimpleStatement> apply(NBComponent adapterC, ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
return new Cqld4RawStmtDispenser(adapter, targetFunction,op);
}

View File

@ -16,14 +16,13 @@
package io.nosqlbench.adapter.cqld4.opmappers;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4BaseOp;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -39,5 +38,5 @@ public abstract class Cqld4BaseOpMapper<T extends Cqld4BaseOp<?>> implements OpM
}
@Override
public abstract OpDispenser<T> apply(ParsedOp op, LongFunction<Cqld4Space> spaceInitF);
public abstract OpDispenser<T> apply(NBComponent adapterC, ParsedOp op, LongFunction<Cqld4Space> spaceInitF);
}

View File

@ -19,7 +19,7 @@ package io.nosqlbench.adapter.cqld4.opmappers;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4BaseOp;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
@ -43,6 +43,7 @@ public class Cqld4CoreOpMapper extends Cqld4BaseOpMapper<Cqld4BaseOp<?>> {
* for it. Since the operations under the CQL driver 4.* do not follow a common type structure, we use the
* base types in the NoSQLBench APIs and treat them somewhat more generically than with other drivers.
*
* @param adapterC
* @param op
* The {@link ParsedOp} which is the parsed version of the user-provided op template.
* This contains all the fields provided by the user, as well as explicit knowledge of
@ -51,17 +52,17 @@ public class Cqld4CoreOpMapper extends Cqld4BaseOpMapper<Cqld4BaseOp<?>> {
*/
@Override
public OpDispenser<Cqld4BaseOp<?>> apply(ParsedOp op, LongFunction<Cqld4Space> spaceF) {
public OpDispenser<Cqld4BaseOp<?>> apply(NBComponent adapterC, ParsedOp op, LongFunction<Cqld4Space> spaceF) {
CqlD4OpType opType = CqlD4OpType.prepared;
TypeAndTarget<CqlD4OpType, String> target = op.getTypeAndTarget(CqlD4OpType.class, String.class, "type", "stmt");
logger.info(() -> "Using " + target.enumId + " statement form for '" + op.getName() + "'");
return (OpDispenser<Cqld4BaseOp<?>>) switch (target.enumId) {
case raw, simple, prepared, batch -> new Cqld4CqlOpMapper(adapter).apply(op, spaceF);
case gremlin -> new Cqld4GremlinOpMapper(adapter, target.targetFunction).apply(op, spaceF);
case fluent -> new Cqld4FluentGraphOpMapper(adapter, target).apply(op, spaceF);
case raw, simple, prepared, batch -> new Cqld4CqlOpMapper(adapter).apply(adapterC, op, spaceF);
case gremlin -> new Cqld4GremlinOpMapper(adapter, target.targetFunction).apply(adapterC, op, spaceF);
case fluent -> new Cqld4FluentGraphOpMapper(adapter, target).apply(adapterC, op, spaceF);
case rainbow ->
new CqlD4RainbowTableMapper(adapter, spaceF, target.targetFunction).apply(op, spaceF);
new CqlD4RainbowTableMapper(adapter, spaceF, target.targetFunction).apply(adapterC, op, spaceF);
default -> throw new OpConfigError("Unsupported op type " + opType);
// case sst -> new Cqld4SsTableMapper(adapter, sessionFunc, target.targetFunction).apply(op);
};

View File

@ -22,8 +22,8 @@ import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.LongFunction;
@ -34,6 +34,6 @@ public abstract class Cqld4CqlBaseOpMapper<T extends Cqld4CqlOp> extends Cqld4Ba
}
@Override
public abstract OpDispenser<T> apply(ParsedOp op, LongFunction<Cqld4Space> spaceInitF);
public abstract OpDispenser<T> apply(NBComponent adapterC, ParsedOp op, LongFunction<Cqld4Space> spaceInitF);
}

View File

@ -23,6 +23,7 @@ import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlSimpleStatement;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.errors.OpConfigError;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -38,7 +39,7 @@ public class Cqld4CqlOpMapper extends Cqld4CqlBaseOpMapper<Cqld4CqlOp> {
}
@Override
public OpDispenser<Cqld4CqlOp> apply(ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
public OpDispenser<Cqld4CqlOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<Cqld4Space> spaceInitF) {
CqlD4OpType opType = CqlD4OpType.prepared;
TypeAndTarget<CqlD4OpType, String> target = op.getTypeAndTarget(CqlD4OpType.class, String.class, "type", "stmt");
logger.info(() -> "Using " + target.enumId + " statement form for '" + op.getName() + "'");
@ -46,13 +47,13 @@ public class Cqld4CqlOpMapper extends Cqld4CqlBaseOpMapper<Cqld4CqlOp> {
return (OpDispenser<Cqld4CqlOp>) switch (target.enumId) {
case raw -> {
CqlD4RawStmtMapper cqlD4RawStmtMapper = new CqlD4RawStmtMapper(adapter, target.targetFunction);
OpDispenser<Cqld4CqlSimpleStatement> apply = cqlD4RawStmtMapper.apply(op, spaceInitF);
OpDispenser<Cqld4CqlSimpleStatement> apply = cqlD4RawStmtMapper.apply(adapterC, op, spaceInitF);
yield apply;
}
case simple -> new CqlD4CqlSimpleStmtMapper(adapter, target.targetFunction).apply(op, spaceInitF);
case prepared -> new CqlD4PreparedStmtMapper(adapter, target).apply(op, spaceInitF);
case simple -> new CqlD4CqlSimpleStmtMapper(adapter, target.targetFunction).apply(adapterC, op, spaceInitF);
case prepared -> new CqlD4PreparedStmtMapper(adapter, target).apply(adapterC, op, spaceInitF);
case batch -> new CqlD4BatchStmtMapper(adapter, target).apply(op, spaceInitF);
case batch -> new CqlD4BatchStmtMapper(adapter, target).apply(adapterC, op, spaceInitF);
default ->
throw new OpConfigError("Unsupported op type for CQL category of statement forms:" + target.enumId);
};

View File

@ -27,6 +27,7 @@ import io.nosqlbench.adapter.cqld4.optypes.Cqld4FluentGraphOp;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.errors.OpConfigError;
import io.nosqlbench.virtdata.core.bindings.Bindings;
import io.nosqlbench.virtdata.core.bindings.BindingsTemplate;
@ -58,7 +59,7 @@ public class Cqld4FluentGraphOpMapper extends Cqld4BaseOpMapper<Cqld4FluentGraph
}
@Override
public OpDispenser<Cqld4FluentGraphOp> apply(ParsedOp op, LongFunction<Cqld4Space> cqld4SpaceLongFunction) {
public OpDispenser<Cqld4FluentGraphOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<Cqld4Space> cqld4SpaceLongFunction) {
GraphTraversalSource g = DseGraph.g;
ParsedTemplateString fluent = op.getAsTemplate(target.field).orElseThrow();

View File

@ -16,17 +16,11 @@
package io.nosqlbench.adapter.cqld4.opmappers;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.Cqld4DriverAdapter;
import io.nosqlbench.adapter.cqld4.Cqld4Space;
import io.nosqlbench.adapter.cqld4.opdispensers.Cqld4GremlinOpDispenser;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4ScriptGraphOp;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.LongFunction;
@ -39,7 +33,7 @@ public class Cqld4GremlinOpMapper<CO extends Cqld4ScriptGraphOp> extends Cqld4Ba
}
@Override
public Cqld4GremlinOpDispenser apply(ParsedOp op, LongFunction spaceInitF) {
public Cqld4GremlinOpDispenser apply(NBComponent adapterC, ParsedOp op, LongFunction spaceInitF) {
return new Cqld4GremlinOpDispenser(
adapter,
l -> adapter.getSpaceFunc(op).apply(l).getSession(), targetFunction, op);

View File

@ -21,9 +21,9 @@ import io.nosqlbench.adapter.dataapi.ops.DataApiBaseOp;
import io.nosqlbench.adapter.dataapi.ops.DataApiOpType;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.function.LongFunction;
@ -38,7 +38,7 @@ public class DataApiOpMapper implements OpMapper<DataApiBaseOp,DataApiSpace> {
@Override
public OpDispenser<DataApiBaseOp> apply(ParsedOp op, LongFunction<DataApiSpace> spaceInitF) {
public OpDispenser<DataApiBaseOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<DataApiSpace> spaceInitF) {
//public OpDispenser<DataApiBaseOp> apply(ParsedOp op, LongFunction<DataApiSpace> spaceInitF) {
TypeAndTarget<DataApiOpType, String> typeAndTarget = op.getTypeAndTarget(
DataApiOpType.class,

View File

@ -52,7 +52,7 @@ public class DataApiCountDocumentsOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -51,8 +51,8 @@ public class DataApiCreateCollectionOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}

View File

@ -53,8 +53,8 @@ public class DataApiCreateCollectionWithClassOpDispenser extends DataApiOpDispen
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}

View File

@ -61,7 +61,7 @@ public class DataApiCreateDatabaseOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -43,7 +43,7 @@ public class DataApiCreateNamespaceOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -47,7 +47,7 @@ public class DataApiDeleteAllOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -50,7 +50,7 @@ public class DataApiDeleteManyOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -73,7 +73,7 @@ public class DataApiDeleteOneOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -41,7 +41,7 @@ public class DataApiDropCollectionOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -43,7 +43,7 @@ public class DataApiDropDatabaseOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -44,7 +44,7 @@ public class DataApiDropNamespaceOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -41,7 +41,7 @@ public class DataApiEstimatedDocumentCountOpDispenser extends DataApiOpDispenser
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -56,7 +56,7 @@ public class DataApiFindByIdOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -61,7 +61,7 @@ public class DataApiFindDistinctOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -68,7 +68,7 @@ public class DataApiFindOneAndDeleteOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -86,7 +86,7 @@ public class DataApiFindOneAndReplaceOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -52,7 +52,7 @@ public class DataApiFindOneAndUpdateOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -70,7 +70,7 @@ public class DataApiFindOneOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -88,7 +88,7 @@ public class DataApiFindOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -56,7 +56,7 @@ public class DataApiFindVectorFilterOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -56,7 +56,7 @@ public class DataApiFindVectorOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -44,7 +44,7 @@ public class DataApiGetDatabaseInfoOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -75,7 +75,7 @@ public class DataApiInsertManyOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -49,7 +49,7 @@ public class DataApiInsertOneOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -52,7 +52,7 @@ public class DataApiInsertOneVectorOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -37,7 +37,7 @@ public class DataApiListCollectionNamesOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -40,7 +40,7 @@ public class DataApiListCollectionsOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -41,7 +41,7 @@ public class DataApiListDatabasesOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -42,7 +42,7 @@ public class DataApiListNamespacesOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -32,7 +32,7 @@ public abstract class DataApiOpDispenser extends BaseOpDispenser<DataApiBaseOp,
protected DataApiOpDispenser(DriverAdapter<? extends DataApiBaseOp, DataApiSpace> adapter, ParsedOp op,
LongFunction<String> targetFunction) {
super(adapter, op);
super(adapter, op, adapter.getSpaceFunc(op));
this.targetFunction = targetFunction;
this.spaceFunction = adapter.getSpaceFunc(op);
}

View File

@ -68,7 +68,7 @@ public class DataApiReplaceOneOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -66,7 +66,7 @@ public class DataApiUpdateManyOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -75,7 +75,7 @@ public class DataApiUpdateOneOpDispenser extends DataApiOpDispenser {
}
@Override
public DataApiBaseOp getOp(long value) {
return opFunction.apply(value);
public DataApiBaseOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -40,7 +40,7 @@ public class DiagOpDispenser extends BaseOpDispenser<DiagOp,DiagSpace> implement
private OpFunc opFuncs;
public DiagOpDispenser(DiagDriverAdapter adapter, LongFunction<DiagSpace> spaceF, ParsedOp op) {
super(adapter,op);
super(adapter,op, adapter.getSpaceFunc(op));
this.opFunc = resolveOpFunc(spaceF, op);
}
@ -129,7 +129,7 @@ public class DiagOpDispenser extends BaseOpDispenser<DiagOp,DiagSpace> implement
}
@Override
public DiagOp getOp(long value) {
return opFunc.apply(value);
public DiagOp getOp(long cycle) {
return opFunc.apply(cycle);
}
}

View File

@ -18,8 +18,8 @@ package io.nosqlbench.adapter.diag;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.nb.api.config.standard.NBReconfigurable;
@ -38,7 +38,7 @@ public class DiagOpMapper implements OpMapper<DiagOp,DiagSpace>, NBReconfigurabl
}
@Override
public OpDispenser<DiagOp> apply(ParsedOp op, LongFunction<DiagSpace> spaceInitF) {
public OpDispenser<DiagOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<DiagSpace> spaceInitF) {
LongFunction<DiagSpace> spaceF = adapter.getSpaceFunc(op);
DiagOpDispenser dispenser = new DiagOpDispenser(adapter,spaceF,op);
dispensers.put(op.getName(),dispenser);

View File

@ -21,11 +21,10 @@ import io.nosqlbench.adapter.dynamodb.opdispensers.*;
import io.nosqlbench.adapter.dynamodb.optypes.DynamoDBOp;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.ConcurrentSpaceCache;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import java.util.function.LongFunction;
@ -41,7 +40,7 @@ public class DynamoDBOpMapper implements OpMapper<DynamoDBOp,DynamoDBSpace> {
}
@Override
public OpDispenser<DynamoDBOp> apply(ParsedOp op, LongFunction<DynamoDBSpace> spaceInitF) {
public OpDispenser<DynamoDBOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<DynamoDBSpace> spaceInitF) {
int space = op.getStaticConfigOr("space", 0);
LongFunction<DynamoDBSpace> spaceFunc = adapter.getSpaceFunc(op);
DynamoDB ddb = spaceFunc.apply(space).getDynamoDB();

View File

@ -117,7 +117,7 @@ public class DDBCreateTableOpDispenser extends BaseOpDispenser<DynamoDBOp, Dynam
private final LongFunction<String> billingModeFunc;
public DDBCreateTableOpDispenser(DriverAdapter adapter, DynamoDB ddb, ParsedOp cmd, LongFunction<?> targetFunc) {
super(adapter,cmd);
super(adapter,cmd, adapter.getSpaceFunc(cmd));
this.ddb = ddb;
this.tableNameFunc = l -> targetFunc.apply(l).toString();
this.keySchemaFunc = resolveKeySchemaFunction(cmd);

View File

@ -41,7 +41,7 @@ public class DDBDeleteTableOpDispenser extends BaseOpDispenser<DynamoDBOp, Dynam
private final LongFunction<String> tableNameFunc;
public DDBDeleteTableOpDispenser(DriverAdapter adapter, DynamoDB ddb, ParsedOp cmd, LongFunction<?> targetFunc) {
super(adapter, cmd);
super(adapter, cmd, adapter.getSpaceFunc(cmd));
this.ddb = ddb;
this.tableNameFunc = l -> targetFunc.apply(l).toString();
}

View File

@ -37,7 +37,7 @@ public class DDBGetItemOpDispenser extends BaseOpDispenser<DynamoDBOp, DynamoDBS
private final LongFunction<GetItemSpec> getItemSpecFunc;
public DDBGetItemOpDispenser(DriverAdapter adapter, DynamoDB ddb, ParsedOp cmd, LongFunction<?> targetFunction) {
super(adapter,cmd);
super(adapter,cmd, adapter.getSpaceFunc(cmd));
this.ddb = ddb;
this.targetTableFunction = l -> ddb.getTable(targetFunction.apply(l).toString());
this.getItemSpecFunc = resolveGetItemSpecFunction(cmd);
@ -83,9 +83,9 @@ public class DDBGetItemOpDispenser extends BaseOpDispenser<DynamoDBOp, DynamoDBS
}
@Override
public DDBGetItemOp getOp(long value) {
Table table = targetTableFunction.apply(value);
GetItemSpec getitemSpec = getItemSpecFunc.apply(value);
public DDBGetItemOp getOp(long cycle) {
Table table = targetTableFunction.apply(cycle);
GetItemSpec getitemSpec = getItemSpecFunc.apply(cycle);
return new DDBGetItemOp(ddb, table, getitemSpec);
}
}

View File

@ -36,7 +36,7 @@ public class DDBPutItemOpDispenser extends BaseOpDispenser<DynamoDBOp, DynamoDBS
private final LongFunction<? extends Item> itemfunc;
public DDBPutItemOpDispenser(DriverAdapter adapter, DynamoDB ddb, ParsedOp cmd, LongFunction<?> targetFunc) {
super(adapter, cmd);
super(adapter, cmd, adapter.getSpaceFunc(cmd));
this.ddb = ddb;
this.tableNameFunc = l -> targetFunc.apply(l).toString();
if (cmd.isDefined("item")) {
@ -51,9 +51,9 @@ public class DDBPutItemOpDispenser extends BaseOpDispenser<DynamoDBOp, DynamoDBS
}
@Override
public DynamoDBOp getOp(long value) {
String tablename = tableNameFunc.apply(value);
Item item = itemfunc.apply(value);
public DynamoDBOp getOp(long cycle) {
String tablename = tableNameFunc.apply(cycle);
Item item = itemfunc.apply(cycle);
return new DDBPutItemOp(ddb,tablename,item);
}
}

View File

@ -141,7 +141,7 @@ public class DDBQueryOpDispenser extends BaseOpDispenser<DynamoDBOp, DynamoDBSpa
private final LongFunction<QuerySpec> querySpecFunc;
public DDBQueryOpDispenser(DriverAdapter adapter, DynamoDB ddb, ParsedOp cmd, LongFunction<?> targetFunc) {
super(adapter,cmd);
super(adapter,cmd, adapter.getSpaceFunc(cmd));
this.ddb = ddb;
LongFunction<String> tableNameFunc = l -> targetFunc.apply(l).toString();
this.tableFunc = l -> ddb.getTable(tableNameFunc.apply(l));

View File

@ -32,7 +32,7 @@ public class RawDynamoDBOpDispenser extends BaseOpDispenser<DynamoDBOp, DynamoDB
private final DynamoDB ddb;
public RawDynamoDBOpDispenser(DriverAdapter adapter, DynamoDB ddb, ParsedOp pop) {
super(adapter,pop);
super(adapter,pop, adapter.getSpaceFunc(pop));
this.ddb = ddb;
String bodytype = pop.getValueType("body").getSimpleName();
@ -44,8 +44,8 @@ public class RawDynamoDBOpDispenser extends BaseOpDispenser<DynamoDBOp, DynamoDB
}
@Override
public DynamoDBOp getOp(long value) {
String body = jsonFunction.apply(value);
public DynamoDBOp getOp(long cycle) {
String body = jsonFunction.apply(cycle);
return new RawDynamodOp(ddb,body);
}
}

View File

@ -0,0 +1,46 @@
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>${revision}</version>
<relativePath>../../mvn-defaults</relativePath>
</parent>
<artifactId>adapter-example</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>
A HTTP nosqlbench DriverAdapter driver module;
This module provides a basic starting point for a fully featured adapter.
</description>
<dependencies>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>adapters-api</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,40 @@
package io.nosqlbench.adapter.prototype;
/*
* 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.
*/
import io.nosqlbench.adapter.prototype.ops.ExampleOpType1;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.labels.NBLabels;
@Service(value = DriverAdapter.class, selector = "example")
public class ExampleDriverAdapter extends BaseDriverAdapter<ExampleOpType1, ExampleSpace> {
public ExampleDriverAdapter(NBComponent parentComponent, NBLabels labels) {
super(parentComponent, labels);
}
@Override
public OpMapper<ExampleOpType1, ExampleSpace> getOpMapper() {
return new ExampleOpMapper();
}
}

View File

@ -0,0 +1,36 @@
package io.nosqlbench.adapter.prototype;
/*
* 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.
*/
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.labels.NBLabels;
@Service(value = DriverAdapterLoader.class, selector = "example")
public class ExampleDriverAdapterLoader implements DriverAdapterLoader {
/**
* {@inheritDoc}
*/
@Override
public ExampleDriverAdapter load(NBComponent parent, NBLabels childLabels) {
return new ExampleDriverAdapter(parent, childLabels);
}
}

View File

@ -0,0 +1,48 @@
package io.nosqlbench.adapter.prototype;
/*
* 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.
*/
import io.nosqlbench.adapter.prototype.dispensers.ExampleOpDispenserType1;
import io.nosqlbench.adapter.prototype.ops.ExampleOpType1;
import io.nosqlbench.adapter.prototype.ops.ExampleOpTypes;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.LongFunction;
public class ExampleOpMapper implements OpMapper<ExampleOpType1, ExampleSpace> {
@Override
public OpDispenser<ExampleOpType1> apply(
NBComponent adapterC,
ParsedOp pop,
LongFunction<ExampleSpace> spaceInitF
) {
TypeAndTarget<ExampleOpTypes, String> typeAndTarget = pop.getTypeAndTarget(ExampleOpTypes.class, String.class);
return switch (typeAndTarget.enumId) {
case type1 -> new ExampleOpDispenserType1(adapterC, pop, spaceInitF);
case type2 -> new ExampleOpDispenserType1(adapterC, pop, spaceInitF);
};
}
}

View File

@ -0,0 +1,30 @@
package io.nosqlbench.adapter.prototype;
/*
* 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.
*/
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseSpace;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
public class ExampleSpace extends BaseSpace<ExampleSpace> {
public ExampleSpace(DriverAdapter<?, ExampleSpace> adapter, long idx) {
super(adapter, idx);
}
}

View File

@ -0,0 +1,43 @@
package io.nosqlbench.adapter.prototype.dispensers;
/*
* 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.
*/
import io.nosqlbench.adapter.prototype.ExampleSpace;
import io.nosqlbench.adapter.prototype.ops.ExampleOpType1;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.LongFunction;
public class ExampleOpDispenserType1 extends BaseOpDispenser<ExampleOpType1, ExampleSpace> {
public ExampleOpDispenserType1(
NBComponent adapter,
ParsedOp pop,
LongFunction<ExampleSpace> spaceInitF
) {
super(adapter, pop, spaceInitF);
}
@Override
public ExampleOpType1 getOp(long cycle) {
return new ExampleOpType1(cycle);
}
}

View File

@ -0,0 +1,43 @@
package io.nosqlbench.adapter.prototype.dispensers;
/*
* 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.
*/
import io.nosqlbench.adapter.prototype.ExampleSpace;
import io.nosqlbench.adapter.prototype.ops.ExampleOpType2;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.LongFunction;
public class ExampleOpDispenserType2 extends BaseOpDispenser<ExampleOpType2, ExampleSpace> {
public ExampleOpDispenserType2(
NBComponent adapter,
ParsedOp pop,
LongFunction<ExampleSpace> spaceInitF
) {
super(adapter, pop, spaceInitF);
}
@Override
public ExampleOpType2 getOp(long cycle) {
return new ExampleOpType2();
}
}

View File

@ -0,0 +1,39 @@
package io.nosqlbench.adapter.prototype.ops;
/*
* 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.
*/
import io.nosqlbench.adapter.prototype.results.ExampleStringResult;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ExampleOpType1 implements CycleOp<ExampleStringResult> {
private final static Logger logger = LogManager.getLogger(ExampleOpType1.class);
private final long cycle;
public ExampleOpType1(long cycle) {
this.cycle = cycle;
}
@Override
public ExampleStringResult apply(long value) {
return new ExampleStringResult("ProtoOpType1 cycle(" + value + ")");
}
}

View File

@ -0,0 +1,34 @@
package io.nosqlbench.adapter.prototype.ops;
/*
* 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.
*/
import io.nosqlbench.adapter.prototype.results.ExampleStringResult;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ExampleOpType2 implements CycleOp<ExampleStringResult> {
private final static Logger logger = LogManager.getLogger(ExampleOpType2.class);
@Override
public ExampleStringResult apply(long value) {
return new ExampleStringResult("ProtoOpType1 cycle(" + value + ")");
}
}

View File

@ -0,0 +1,24 @@
package io.nosqlbench.adapter.prototype.ops;
/*
* 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.
*/
public enum ExampleOpTypes {
type1,
type2
}

View File

@ -0,0 +1,26 @@
/**
* This package contains an example implementation of a
* {@link io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter}.
* It is meant to demonstrate common implementation patterns as a starting point for new driver adapters.
* For a given adapter implementation, only some of these patterns will be needed, but examples aim to cover
* also some of the non-trivial patterns needed to implement advanced logic.
*/
package io.nosqlbench.adapter.prototype;
/*
* 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.
*/

View File

@ -0,0 +1,26 @@
package io.nosqlbench.adapter.prototype.results;
/*
* 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.
*/
/**
* Each {@link io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter} implementation
* is generic over a type of
*/
public interface ExampleResult {
}

View File

@ -0,0 +1,30 @@
package io.nosqlbench.adapter.prototype.results;
/*
* 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.
*/
public class ExampleStringResult implements ExampleResult {
private final String message;
public ExampleStringResult(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}

View File

@ -21,13 +21,12 @@ import io.nosqlbench.adapter.gcpspanner.ops.GCPSpannerBaseOp;
import io.nosqlbench.adapter.gcpspanner.types.GCPSpannerOpType;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.function.IntFunction;
import java.util.function.LongFunction;
public class GCPSpannerOpMapper implements OpMapper<GCPSpannerBaseOp<?,?>, GCPSpannerSpace> {
@ -49,6 +48,7 @@ public class GCPSpannerOpMapper implements OpMapper<GCPSpannerBaseOp<?,?>, GCPSp
* Given an instance of a {@link ParsedOp} returns the appropriate
* {@link GCPSpannerBaseOpDispenser} subclass.
*
* @param adapterC
* @param op
* The {@link ParsedOp} to be evaluated
* @param spaceInitF
@ -56,7 +56,7 @@ public class GCPSpannerOpMapper implements OpMapper<GCPSpannerBaseOp<?,?>, GCPSp
* the op type
*/
@Override
public OpDispenser<GCPSpannerBaseOp<?,?>> apply(ParsedOp op, LongFunction<GCPSpannerSpace> spaceInitF) {
public OpDispenser<GCPSpannerBaseOp<?,?>> apply(NBComponent adapterC, ParsedOp op, LongFunction<GCPSpannerSpace> spaceInitF) {
TypeAndTarget<GCPSpannerOpType, String> typeAndTarget = op.getTypeAndTarget(GCPSpannerOpType.class,
String.class, "type", "target");
logger.info(() -> "Using '" + typeAndTarget.enumId + "' op type for op template '" + op.getName() + "'");

View File

@ -21,7 +21,6 @@ import io.nosqlbench.adapter.gcpspanner.GCPSpannerDriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapter.gcpspanner.ops.GCPSpannerBaseOp;
import io.nosqlbench.adapter.gcpspanner.GCPSpannerSpace;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import java.util.function.LongFunction;
@ -52,7 +51,7 @@ public abstract class GCPSpannerBaseOpDispenser<OP extends GCPSpannerBaseOp,RESU
*/
protected GCPSpannerBaseOpDispenser(GCPSpannerDriverAdapter adapter, ParsedOp op,
LongFunction<String> targetFunction) {
super(adapter, op);
super(adapter, op, adapter.getSpaceFunc(op));
this.targetFunction = targetFunction;
this.spaceFunction = adapter.getSpaceFunc(op);
}

View File

@ -78,12 +78,12 @@ public class GCPSpannerCreateDatabaseDdlOpDispenser
/**
* Retrieves an operation instance based on the provided value.
*
* @param value
* @param cycle
* the long value used to generate the operation
* @return a {@link GCPSpannerBaseOp} instance
*/
@Override
public GCPSpannerCreateDatabaseDdlOp getOp(long value) {
return opFunction.apply(value);
public GCPSpannerCreateDatabaseDdlOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -83,11 +83,11 @@ public class GCPSpannerDropDatabaseDdlOpDispenser extends GCPSpannerBaseOpDispen
/**
* Retrieves an operation instance based on the provided value.
*
* @param value the long value used to generate the operation
* @param cycle the long value used to generate the operation
* @return a {@link GCPSpannerBaseOp} instance
*/
@Override
public GCPSpannerDropDatabaseDdlOp getOp(long value) {
return opFunction.apply(value);
public GCPSpannerDropDatabaseDdlOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -77,11 +77,11 @@ public class GCPSpannerExecuteDmlOpDispenser extends GCPSpannerBaseOpDispenser<G
/**
* Retrieves the GCP Spanner operation for the given value.
*
* @param value the input value
* @param cycle the input value
* @return the GCP Spanner operation
*/
@Override
public GCPSpannerExecuteDmlOp getOp(long value) {
return opFunction.apply(value);
public GCPSpannerExecuteDmlOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -66,21 +66,21 @@ public class GCPSpannerInsertOpDispenser extends GCPSpannerBaseOpDispenser<GCPSp
/**
* Returns a GCPSpannerInsertVectorOp instance configured with the provided value.
*
* @param value the value used to configure the operation
* @param cycle the value used to configure the operation
* @return a configured GCPSpannerInsertVectorOp instance
*/
@Override
public GCPSpannerInsertOp getOp(long value) {
Mutation.WriteBuilder builder = Mutation.newInsertBuilder(targetFunction.apply(value));
Map<String, Object> params = queryParamsFunction.apply(value);
public GCPSpannerInsertOp getOp(long cycle) {
Mutation.WriteBuilder builder = Mutation.newInsertBuilder(targetFunction.apply(cycle));
Map<String, Object> params = queryParamsFunction.apply(cycle);
for (Map.Entry<String, Object> entry : params.entrySet()) {
builder.set(entry.getKey()).to(convertToValue(entry));
}
return new GCPSpannerInsertOp(
spaceFunction.apply(value).getSpanner(),
value,
spaceFunction.apply(cycle).getSpanner(),
cycle,
builder.build(),
spaceFunction.apply(value).getDbClient()
spaceFunction.apply(cycle).getDbClient()
);
}

View File

@ -66,11 +66,11 @@ public class GCPSpannerUpdateDatabaseDdlOpDispenser
/**
* Retrieves an operation instance based on the provided value.
*
* @param value the long value used to generate the operation
* @param cycle the long value used to generate the operation
* @return a GCPSpannerBaseOp instance
*/
@Override
public GCPSpannerUpdateDatabaseDdlOp getOp(long value) {
return opFunction.apply(value);
public GCPSpannerUpdateDatabaseDdlOp getOp(long cycle) {
return opFunction.apply(cycle);
}
}

View File

@ -37,7 +37,7 @@ public class HttpOpDispenser extends BaseOpDispenser<HttpOp, HttpSpace> {
public HttpOpDispenser(DriverAdapter adapter, LongFunction<HttpSpace> ctxF, ParsedOp op) {
super(adapter, op);
super(adapter, op, adapter.getSpaceFunc(op));
opFunc = getOpFunc(ctxF, op);
}
@ -128,8 +128,8 @@ public class HttpOpDispenser extends BaseOpDispenser<HttpOp, HttpSpace> {
}
@Override
public HttpOp getOp(long value) {
HttpOp op = this.opFunc.apply(value);
public HttpOp getOp(long cycle) {
HttpOp op = this.opFunc.apply(cycle);
return op;
}

View File

@ -19,10 +19,9 @@ package io.nosqlbench.adapter.http.core;
import io.nosqlbench.adapter.http.HttpDriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.ConcurrentSpaceCache;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import java.util.function.LongFunction;
@ -38,7 +37,7 @@ public class HttpOpMapper implements OpMapper<HttpOp,HttpSpace> {
}
@Override
public OpDispenser<HttpOp> apply(ParsedOp op, LongFunction<HttpSpace> spaceInitF) {
public OpDispenser<HttpOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<HttpSpace> spaceInitF) {
LongFunction<String> spaceNameF = op.getAsFunctionOr("space", "default");
return new HttpOpDispenser(adapter, spaceInitF, op);
}

View File

@ -19,8 +19,7 @@ package io.nosqlbench.adapter.kafka;
import io.nosqlbench.adapter.kafka.dispensers.MessageConsumerOpDispenser;
import io.nosqlbench.adapter.kafka.dispensers.MessageProducerOpDispenser;
import io.nosqlbench.adapter.kafka.ops.KafkaOp;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.activityimpl.uniform.ConcurrentSpaceCache;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
@ -29,7 +28,7 @@ import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.function.IntFunction;
import java.util.function.LongFunction;
public class KafkaOpMapper implements OpMapper<KafkaOp,KafkaSpace> {
@ -43,7 +42,7 @@ public class KafkaOpMapper implements OpMapper<KafkaOp,KafkaSpace> {
}
@Override
public OpDispenser<KafkaOp> apply(ParsedOp op, LongFunction<KafkaSpace> spaceInitF) {
public OpDispenser<KafkaOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<KafkaSpace> spaceInitF) {
KafkaSpace kafkaSpace = adapter.getSpaceFunc(op).apply(op.getStaticConfigOr("space",0));
/*

View File

@ -62,7 +62,7 @@ public abstract class KafkaBaseOpDispenser extends BaseOpDispenser<KafkaOp, Kaf
final LongFunction<String> topicNameStrFunc,
final KafkaSpace kafkaSpace) {
super(adapter, op);
super(adapter, op, adapter.getSpaceFunc(op));
parsedOp = op;
this.kafkaSpace = kafkaSpace;

View File

@ -18,7 +18,7 @@ package io.nosqlbench.adapter.mongodb.core;
import io.nosqlbench.adapter.mongodb.dispensers.MongoCommandOpDispenser;
import io.nosqlbench.adapter.mongodb.ops.MongoDirectCommandOp;
import io.nosqlbench.adapters.api.activityimpl.uniform.ConcurrentSpaceCache;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.nb.api.errors.BasicError;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
@ -43,7 +43,7 @@ public class MongoOpMapper<MC extends MongoDirectCommandOp> implements OpMapper<
}
@Override
public OpDispenser<MongoDirectCommandOp> apply(ParsedOp op, LongFunction<MongoSpace> spaceInitF) {
public OpDispenser<MongoDirectCommandOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<MongoSpace> spaceInitF) {
LongFunction<String> ctxNamer = op.getAsFunctionOr("space", "default");

View File

@ -35,7 +35,7 @@ public class MongoCommandOpDispenser extends BaseOpDispenser<MongoDirectCommandO
DriverAdapter adapter, LongFunction<MongoSpace> ctxFunc,
ParsedOp op
) {
super(adapter, op);
super(adapter, op, adapter.getSpaceFunc(op));
this.mongoOpF = createOpFunc(ctxFunc, op);
}

View File

@ -20,14 +20,11 @@ import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoDatabase;
import io.nosqlbench.adapter.mongodb.core.MongoSpace;
import io.nosqlbench.adapter.mongodb.core.MongodbDriverAdapter;
import io.nosqlbench.adapter.mongodb.ops.MongoDbUpdateOp;
import io.nosqlbench.adapter.mongodb.ops.MongoDirectCommandOp;
import io.nosqlbench.adapter.mongodb.ops.MongoOp;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.bson.BsonDocument;
import org.bson.conversions.Bson;
import java.util.function.LongFunction;
@ -41,7 +38,7 @@ public class MongoDbUpdateOpDispenser extends BaseOpDispenser<MongoOp<?>, MongoS
private final LongFunction<String> collectionF;
public MongoDbUpdateOpDispenser(MongodbDriverAdapter adapter, ParsedOp pop, LongFunction<String> collectionF) {
super(adapter, pop);
super(adapter, pop, adapter.getSpaceFunc(pop));
this.collectionF = collectionF;
this.spaceF = adapter.getSpaceFunc(pop);
this.opF = createOpF(pop);
@ -55,8 +52,8 @@ public class MongoDbUpdateOpDispenser extends BaseOpDispenser<MongoOp<?>, MongoS
}
@Override
public MongoOp<?> getOp(long value) {
MongoOp<?> op = opF.apply(value);
public MongoOp<?> getOp(long cycle) {
MongoOp<?> op = opF.apply(cycle);
return op;
}

View File

@ -21,12 +21,10 @@ import io.nosqlbench.adapter.neo4j.ops.Neo4JBaseOp;
import io.nosqlbench.adapter.neo4j.types.Neo4JOpType;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.activityimpl.uniform.ConcurrentSpaceCache;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import java.util.function.IntFunction;
import java.util.function.LongFunction;
@ -38,7 +36,7 @@ public class Neo4JOpMapper implements OpMapper<Neo4JBaseOp,Neo4JSpace> {
}
@Override
public OpDispenser<Neo4JBaseOp> apply(ParsedOp op, LongFunction<Neo4JSpace> spaceInitF) {
public OpDispenser<Neo4JBaseOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<Neo4JSpace> spaceInitF) {
TypeAndTarget<Neo4JOpType, String> typeAndTarget = op.getTypeAndTarget(Neo4JOpType.class, String.class);
LongFunction<Neo4JSpace> spaceFunc = adapter.getSpaceFunc(op);
return switch (typeAndTarget.enumId) {

View File

@ -42,7 +42,7 @@ public abstract class Neo4JBaseOpDispenser extends BaseOpDispenser<Neo4JBaseOp,
protected final LongFunction<AsyncSession> asyncSessionFunc;
public Neo4JBaseOpDispenser(Neo4JDriverAdapter adapter, ParsedOp op, LongFunction<Neo4JSpace> spaceFunc, String requiredTemplateKey) {
super(adapter, op);
super(adapter, op, adapter.getSpaceFunc(op));
this.spaceFunc = spaceFunc;
this.cypherFunc = op.getAsRequiredFunction(requiredTemplateKey);
this.paramFunc = createParamFunc(op);

View File

@ -18,18 +18,15 @@ package io.nosqlbench.adapter.pulsar;
import io.nosqlbench.adapter.pulsar.dispensers.*;
import io.nosqlbench.adapter.pulsar.ops.PulsarOp;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.activityimpl.uniform.ConcurrentSpaceCache;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.function.IntFunction;
import java.util.function.LongFunction;
public class PulsarOpMapper implements OpMapper<PulsarOp,PulsarSpace> {
@ -45,7 +42,7 @@ public class PulsarOpMapper implements OpMapper<PulsarOp,PulsarSpace> {
}
@Override
public OpDispenser<PulsarOp> apply(ParsedOp op, LongFunction<PulsarSpace> spaceInitF) {
public OpDispenser<PulsarOp> apply(NBComponent adapterC, ParsedOp op, LongFunction<PulsarSpace> spaceInitF) {
int spaceName = op.getStaticConfigOr("space", 0);
// PulsarSpace pulsarSpace = spaceCache.get(spaceName);
PulsarSpace pulsarSpace = adapter.getSpaceFunc(op).apply(spaceName);

View File

@ -68,7 +68,7 @@ public abstract class PulsarBaseOpDispenser extends BaseOpDispenser<PulsarOp, Pu
final LongFunction<String> tgtNameFunc,
final PulsarSpace pulsarSpace) {
super(adapter, op);
super(adapter, op, adapter.getSpaceFunc(op));
parsedOp = op;
this.tgtNameFunc = tgtNameFunc;

View File

@ -21,13 +21,12 @@ import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp;
import io.nosqlbench.adapter.qdrant.types.QdrantOpType;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.Space;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.nosqlbench.engine.api.templating.TypeAndTarget;
import io.nosqlbench.nb.api.components.core.NBComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.function.IntFunction;
import java.util.function.LongFunction;
public class QdrantOpMapper implements OpMapper<QdrantBaseOp<?,?>,QdrantSpace> {
@ -46,13 +45,14 @@ public class QdrantOpMapper implements OpMapper<QdrantBaseOp<?,?>,QdrantSpace> {
/**
* Given an instance of a {@link ParsedOp} returns the appropriate {@link QdrantBaseOpDispenser} subclass
*
* @param adapterC
* @param op
* The {@link ParsedOp} to be evaluated
* The {@link ParsedOp} to be evaluated
* @param spaceInitF
* @return The correct {@link QdrantBaseOpDispenser} subclass based on the op type
*/
@Override
public OpDispenser<QdrantBaseOp<?,?>> apply(ParsedOp op, LongFunction<QdrantSpace> spaceInitF) {
public OpDispenser<QdrantBaseOp<?,?>> apply(NBComponent adapterC, ParsedOp op, LongFunction<QdrantSpace> spaceInitF) {
TypeAndTarget<QdrantOpType, String> typeAndTarget = op.getTypeAndTarget(
QdrantOpType.class,
String.class,

View File

@ -50,15 +50,12 @@ public abstract class QdrantBaseOpDispenser<REQUEST,RESULT>
private final LongFunction<REQUEST> paramF;
protected QdrantBaseOpDispenser(QdrantDriverAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super((DriverAdapter)adapter, op);
super((DriverAdapter)adapter, op, adapter.getSpaceFunc(op));
this.qdrantSpaceFunction = adapter.getSpaceFunc(op);
this.clientFunction = (long l) -> this.qdrantSpaceFunction.apply(l).getClient();
this.paramF = getParamFunc(this.clientFunction,op,targetF);
this.opF = createOpFunc(paramF, this.clientFunction, op, targetF);
}
protected QdrantDriverAdapter getDriverAdapter() {
return (QdrantDriverAdapter) adapter;
}
public abstract LongFunction<REQUEST> getParamFunc(
LongFunction<QdrantClient> clientF,
@ -74,8 +71,8 @@ public abstract class QdrantBaseOpDispenser<REQUEST,RESULT>
);
@Override
public QdrantBaseOp<REQUEST, RESULT> getOp(long value) {
return opF.apply(value);
public QdrantBaseOp<REQUEST, RESULT> getOp(long cycle) {
return opF.apply(cycle);
}
/**

Some files were not shown because too many files have changed in this diff Show More