allow space initializer to see activity config

This commit is contained in:
Jonathan Shook 2021-09-13 09:42:11 -05:00
parent 2bc7593f73
commit f9e64ae0a5
4 changed files with 6 additions and 42 deletions

View File

@ -21,8 +21,8 @@ public class Cqld4DriverAdapter extends BaseDriverAdapter<Cqld4Op, Cqld4Space> {
}
@Override
public Function<String, ? extends Cqld4Space> getSpaceInitializer() {
return s -> new Cqld4Space(this);
public Function<String, ? extends Cqld4Space> getSpaceInitializer(NBConfiguration cfg) {
return s -> new Cqld4Space(cfg);
}
@Override

View File

@ -27,8 +27,8 @@ public class Cqld4Space {
CqlSession session;
public Cqld4Space(Cqld4DriverAdapter adapter) {
session = createSession(adapter.getConfiguration());
public Cqld4Space(NBConfiguration cfg) {
session = createSession(cfg);
}
private CqlSession createSession(NBConfiguration cfg) {
@ -91,42 +91,6 @@ public class Cqld4Space {
builder.withAuthCredentials(username, password);
}
// cfg.getOptional("cbopts").ifPresent(
// e -> {
// throw new BasicError("this driver does not support option 'cbopts'");
// }
// );
// List.of(
// "cbopts",
// "whitelist",
// "lbp",
// "loadbalancingpolicy",
// "speculative",
// "protocol_version",
// "socketoptions",
// "reconnectpolicy",
// "pooling",
// "tickduration",
// "compression",
// "retrypolicy",
// "jmxreporting",
// "single-endpoint",
// "haproxy_source_ip"
// ).forEach(o -> {
// if (cfg.getOptional(o).isPresent()) {
// String errmsg = "The activity parameter '" + o + "' is not supported in this version" +
// " of the cqld4 driver as it was before in the cql (1.9) and cqld3 drivers. Note, you" +
// " can often set these unsupported parameters in the driver configuration file directly." +
// " If it should be supported as an activity parameter.please file an issue at http://nosqlbench.io/issues.";
// if (cfg.getOptional(boolean.class,"ignore_warnings").orElse(false)) {
// throw new BasicError(errmsg + " You can ignore this as a warning-only by setting ignore_warnings=true");
// } else {
// logger.warn(errmsg + ", (ignored by setting ignore_warnings=true");
// }
// }
// });
NBConfiguration sslCfg = SSLKsFactory.get().getConfigModel().extract(cfg);
SSLContext ctx = SSLKsFactory.get().getContext(sslCfg);

View File

@ -21,7 +21,7 @@ public abstract class BaseDriverAdapter<R extends Op,S>
private NBConfiguration cfg;
protected BaseDriverAdapter() {
this.spaceCache = new DriverSpaceCache<>(getSpaceInitializer());
this.spaceCache = new DriverSpaceCache<>(getSpaceInitializer(getConfiguration()));
}
/**

View File

@ -122,7 +122,7 @@ public interface DriverAdapter<R extends Op, S> {
/**
* @return A function which can initialize a new S
*/
default Function<String, ? extends S> getSpaceInitializer() {
default Function<String, ? extends S> getSpaceInitializer(NBConfiguration cfg) {
return n -> null;
}