use of org.janusgraph.diskstorage.cql.CQLKeyColumnValueStore in project janusgraph by JanusGraph.
the class CQLSimpleMutateManyUnloggedFunction method mutate.
@Override
protected Optional<Throwable> mutate(DistributedStoreManager.MaskedTimestamp commitTime, Map<String, Map<StaticBuffer, KCVMutation>> mutations, StoreTransaction txh) {
List<CompletableFuture<AsyncResultSet>> resultList = new LinkedList<>();
mutations.forEach((tableName, tableMutations) -> {
final CQLKeyColumnValueStore columnValueStore = getColumnValueStore(tableName);
tableMutations.forEach((key, keyMutations) -> toGroupedBatchableStatementsSequenceIterator(commitTime, keyMutations, columnValueStore, key).forEach(group -> {
CompletableFuture<AsyncResultSet> completableFuture = execAsyncUnlogged(group, txh);
resultList.add(completableFuture);
}));
});
for (CompletableFuture<AsyncResultSet> resultPart : resultList) {
try {
resultPart.get();
} catch (InterruptedException | ExecutionException e) {
return Optional.of(e);
}
}
return Optional.empty();
}
use of org.janusgraph.diskstorage.cql.CQLKeyColumnValueStore 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