added scaffolding for rainbow table and sstable types

This commit is contained in:
derrickCos 2022-08-18 23:47:40 -07:00
parent 298daee08e
commit 7c64b0d967
7 changed files with 276 additions and 0 deletions

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2022 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.adapter.cqld4.opdispensers;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.Statement;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4RainbowTableOp;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.engine.api.templating.ParsedOp;
import java.util.function.LongFunction;
public class CqlD4RainbowTableDispenser extends Cqld4BaseOpDispenser {
private final LongFunction<Statement> stmtFunc;
private final LongFunction<String> targetFunction;
public CqlD4RainbowTableDispenser(DriverAdapter adapter, LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction, ParsedOp cmd) {
super(adapter, sessionFunc,cmd);
this.targetFunction=targetFunction;
this.tableFunc =createTableFunc(cmd);
}
protected LongFunction<Statement> createTableFunc(ParsedOp op) {
}
@Override
public Cqld4RainbowTable apply(long value) {
return new Cqld4RainbowTable(
getSessionFunc().apply(value),
(RainbowTable) stmtFunc.apply(value),
getMaxPages(),
isRetryReplace()
);
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2022 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.adapter.cqld4.opdispensers;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.Statement;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4SsTableOp;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.engine.api.templating.ParsedOp;
import java.util.function.LongFunction;
public class CqlD4SsTableDispenser extends Cqld4BaseOpDispenser {
private final LongFunction<Statement> stmtFunc;
private final LongFunction<String> targetFunction;
public CqlD4SsTableDispenser(DriverAdapter adapter, LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction, ParsedOp cmd) {
super(adapter, sessionFunc,cmd);
this.targetFunction=targetFunction;
this.tableFunc =createTableFunc(cmd);
}
protected LongFunction<Statement> createTableFunc(ParsedOp op) {
}
@Override
public Cqld4SSTable apply(long value) {
return new CqlD4SsTable(
getSessionFunc().apply(value),
(SsTable) stmtFunc.apply(value),
getMaxPages(),
isRetryReplace()
);
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2022 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.adapter.cqld4.opmappers;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.opdispensers.CqlD4RainbowTableDispenser;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.engine.api.activityimpl.OpDispenser;
import io.nosqlbench.engine.api.activityimpl.OpMapper;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.engine.api.templating.ParsedOp;
import java.util.function.LongFunction;
public class CqlD4RainbowTableMapper implements OpMapper<Cqld4CqlOp> {
private final LongFunction<CqlSession> sessionFunc;
private final LongFunction<String> targetFunction;
private final DriverAdapter adapter;
public CqlD4RainbowTableMapper(DriverAdapter adapter, LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction) {
this.sessionFunc = sessionFunc;
this.targetFunction = targetFunction;
this.adapter = adapter;
}
@Override
public OpDispenser<? extends Cqld4CqlOp> apply(ParsedOp op) {
return new CqlD4RainbowTableDispenser(adapter, sessionFunc,targetFunction, op);
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2022 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.adapter.cqld4.opmappers;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.opdispensers.Cqld4SsTableDispenser;
import io.nosqlbench.adapter.cqld4.optypes.Cqld4CqlOp;
import io.nosqlbench.engine.api.activityimpl.OpDispenser;
import io.nosqlbench.engine.api.activityimpl.OpMapper;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.engine.api.templating.ParsedOp;
import java.util.function.LongFunction;
public class Cqld4SsTableMapper implements OpMapper<Cqld4CqlOp> {
private final LongFunction<CqlSession> sessionFunc;
private final LongFunction<String> targetFunction;
private final DriverAdapter adapter;
public CqlD4SsTableMapper(DriverAdapter adapter, LongFunction<CqlSession> sessionFunc, LongFunction<String> targetFunction) {
this.sessionFunc = sessionFunc;
this.targetFunction = targetFunction;
this.adapter = adapter;
}
@Override
public OpDispenser<? extends Cqld4CqlOp> apply(ParsedOp op) {
return new CqlD4SsTableDispenser(adapter, sessionFunc,targetFunction, op);
}
}

View File

@ -74,6 +74,8 @@ public class Cqld4CoreOpMapper implements OpMapper<Op> {
case prepared -> new CqlD4PreparedStmtMapper(adapter, sessionFunc, target).apply(op);
case gremlin -> new Cqld4GremlinOpMapper(adapter, sessionFunc, target.targetFunction).apply(op);
case fluent -> new Cqld4FluentGraphOpMapper(adapter, sessionFunc, target).apply(op);
case rainbow -> new CqlD4RainbowTableMapper(adapter, sessionFunc, target.targetFunction).apply(op);
case sst -> new CqlD4SsTableMapper(adapter, sessionFunc, target.targetFunction).apply(op);
};
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2022 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.adapter.cqld4.optypes;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.RSProcessors;
// Need to create RainbowTableStatement
public class Cqld4RainbowTableOp extends Cqld4CqlOp {
private final CqlSession session;
private final RainbowTableStatement stmt;
public Cqld4RainbowTableOp(CqlSession session, RainbowTableStatement stmt, int maxpages, boolean retryreplace) {
super(session, maxpages,retryreplace, new RSProcessors());
this.stmt = stmt;
}
@Override
public RainbowTableStatement getStmt() {
return stmt;
}
@Override
public String getQueryString() {
return stmt.getQuery();
}
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2022 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.adapter.cqld4.optypes;
import com.datastax.oss.driver.api.core.CqlSession;
import io.nosqlbench.adapter.cqld4.RSProcessors;
// Need to create SsTableStatement
public class Cqld4SsTableOp extends Cqld4CqlOp {
private final CqlSession session;
private final SsTableStatement stmt;
public Cqld4SsTableOp(CqlSession session, SsTableStatement stmt, int maxpages, boolean retryreplace) {
super(session, maxpages,retryreplace, new RSProcessors());
this.stmt = stmt;
}
@Override
public SsTableStatement getStmt() {
return stmt;
}
@Override
public String getQueryString() {
return stmt.getQuery();
}
}