mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-30 12:34:01 -06:00
added scaffolding for rainbow table and sstable types
This commit is contained in:
parent
298daee08e
commit
7c64b0d967
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user