use of org.apache.ignite.internal.metastorage.common.command.OperationInfo in project ignite-3 by apache.
the class MetaStorageServiceImpl method invoke.
/**
* {@inheritDoc}
*/
@Override
@NotNull
public CompletableFuture<Boolean> invoke(@NotNull Condition condition, @NotNull Collection<Operation> success, @NotNull Collection<Operation> failure) {
ConditionInfo cond = toConditionInfo(condition);
List<OperationInfo> successOps = toOperationInfos(success);
List<OperationInfo> failureOps = toOperationInfos(failure);
return metaStorageRaftGrpSvc.run(new InvokeCommand(cond, successOps, failureOps));
}
use of org.apache.ignite.internal.metastorage.common.command.OperationInfo in project ignite-3 by apache.
the class MetaStorageServiceImpl method toOperationInfos.
private static List<OperationInfo> toOperationInfos(Collection<Operation> ops) {
List<OperationInfo> res = new ArrayList<>(ops.size());
for (Operation op : ops) {
OperationInfo info = null;
if (op.type() == OperationType.NO_OP) {
info = new OperationInfo(null, null, OperationType.NO_OP);
} else if (op.type() == OperationType.REMOVE) {
info = new OperationInfo(((Operation.RemoveOp) op.inner()).key(), null, OperationType.REMOVE);
} else if (op.type() == OperationType.PUT) {
Operation.PutOp inner = (Operation.PutOp) op.inner();
info = new OperationInfo(inner.key(), inner.value(), OperationType.PUT);
} else {
assert false : "Unknown operation type " + op.type();
}
res.add(info);
}
return res;
}
Aggregations