mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-23 09:16:37 -06:00
move NBConfigModel to BaseDriverAdapter
This commit is contained in:
parent
1e5901d684
commit
97975c8c48
@ -85,17 +85,6 @@ public abstract class BaseDriverAdapter<R extends Op,S> implements DriverAdapter
|
||||
return spaceCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* In order to be provided with config information, it is required
|
||||
* that the driver adapter specify the valid configuration options,
|
||||
* their types, and so on.
|
||||
*/
|
||||
@Override
|
||||
public NBConfigModel getConfigModel() {
|
||||
return ConfigModel.of(this.getClass())
|
||||
.add(Param.defaultTo("errors","stop","Configure the error handler"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBConfiguration getConfiguration() {
|
||||
return cfg;
|
||||
@ -106,4 +95,27 @@ public abstract class BaseDriverAdapter<R extends Op,S> implements DriverAdapter
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* In order to be provided with config information, it is required
|
||||
* that the driver adapter specify the valid configuration options,
|
||||
* their types, and so on.
|
||||
*/
|
||||
@Override
|
||||
public NBConfigModel getConfigModel() {
|
||||
return ConfigModel.of(BaseDriverAdapter.class)
|
||||
.add(Param.optional("alias"))
|
||||
.add(Param.optional(List.of("op", "stmt", "statement"), String.class, "op template in statement form"))
|
||||
.add(Param.optional(List.of("workload", "yaml"), String.class, "location of workload yaml file"))
|
||||
.add(Param.optional("tags", String.class, "tags to be used to filter operations"))
|
||||
.add(Param.defaultTo("errors", "stop", "error handler configuration"))
|
||||
.add(Param.optional("threads").setRegex("\\d+|\\d+x|auto").setDescription("number of concurrent operations, controlled by threadpool"))
|
||||
.add(Param.optional("stride").setRegex("\\d+"))
|
||||
.add(Param.optional("striderate", String.class, "rate limit for strides per second"))
|
||||
.add(Param.optional("cycles").setRegex("\\d+[KMBGTPE]?|\\d+[KMBGTPE]?\\.\\.\\d+[KMBGTPE]?").setDescription("cycle interval to use"))
|
||||
.add(Param.optional(List.of("cyclerate", "targetrate", "rate"), String.class, "rate limit for cycles per second"))
|
||||
.add(Param.optional("phaserate", String.class, "rate limit for phases per second"))
|
||||
.add(Param.optional("seq", String.class, "sequencing algorithm"))
|
||||
.asReadOnly();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
package io.nosqlbench.engine.core.lifecycle;
|
||||
|
||||
import io.nosqlbench.engine.api.activityapi.core.Activity;
|
||||
import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.engine.api.activityimpl.uniform.StandardActivityType;
|
||||
import io.nosqlbench.nb.annotations.Maturity;
|
||||
import io.nosqlbench.nb.api.NBEnvironment;
|
||||
import io.nosqlbench.nb.api.config.standard.*;
|
||||
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.nb.api.config.standard.NBConfigurable;
|
||||
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
|
||||
import io.nosqlbench.nb.api.content.Content;
|
||||
import io.nosqlbench.nb.api.content.NBIO;
|
||||
import io.nosqlbench.nb.api.errors.BasicError;
|
||||
@ -139,7 +140,6 @@ public class ActivityTypeLoader {
|
||||
activityDef.getParams().remove("driver");
|
||||
if (driverAdapter instanceof NBConfigurable) {
|
||||
NBConfigModel cfgModel = ((NBConfigurable) driverAdapter).getConfigModel();
|
||||
cfgModel = cfgModel.add(ACTIVITY_CFG_MODEL);
|
||||
NBConfiguration cfg = cfgModel.apply(activityDef.getParams());
|
||||
((NBConfigurable) driverAdapter).applyConfig(cfg);
|
||||
}
|
||||
@ -150,15 +150,6 @@ public class ActivityTypeLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private static final NBConfigModel ACTIVITY_CFG_MODEL = ConfigModel.of(Activity.class)
|
||||
.add(Param.optional("threads").setRegex("\\d+|\\d+x|auto"))
|
||||
.add(Param.optional(List.of("workload", "yaml")))
|
||||
.add(Param.optional("cycles"))
|
||||
.add(Param.optional("alias"))
|
||||
.add(Param.optional(List.of("cyclerate", "rate")))
|
||||
.add(Param.optional("tags"))
|
||||
.asReadOnly();
|
||||
|
||||
public Set<String> getAllSelectors() {
|
||||
Map<String, Maturity> allSelectors = ACTIVITYTYPE_SPI_FINDER.getAllSelectors();
|
||||
Map<String, Maturity> addAdapters = DRIVERADAPTER_SPI_FINDER.getAllSelectors();
|
||||
|
Loading…
Reference in New Issue
Block a user