mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
alignment to previous changes
This commit is contained in:
@@ -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() + "'");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user