use of com.datastax.oss.driver.api.core.cql.BatchStatementBuilder in project janusgraph by JanusGraph.
the class AbstractCQLMutateManyLoggedFunction method mutateMany.
// Use a single logged batch
@Override
public void mutateMany(Map<String, Map<StaticBuffer, KCVMutation>> mutations, StoreTransaction txh) throws BackendException {
final DistributedStoreManager.MaskedTimestamp commitTime = createMaskedTimestampFunction.apply(txh);
BatchStatementBuilder builder = BatchStatement.builder(DefaultBatchType.LOGGED);
builder.setConsistencyLevel(getTransaction(txh).getWriteConsistencyLevel());
mutations.forEach((tableName, tableMutations) -> {
final CQLKeyColumnValueStore columnValueStore = getColumnValueStore(tableName);
tableMutations.forEach((key, keyMutations) -> {
deletionsFunction.getBatchableStatementsForColumnOperation(commitTime, keyMutations, columnValueStore, key).forEach(builder::addStatement);
additionsFunction.getBatchableStatementsForColumnOperation(commitTime, keyMutations, columnValueStore, key).forEach(builder::addStatement);
});
});
execute(builder.build());
sleepAfterWriteFunction.accept(commitTime);
}
Aggregations