use of org.apache.ignite.internal.metastorage.common.command.ConditionInfo 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.ConditionInfo in project ignite-3 by apache.
the class MetaStorageServiceImpl method toConditionInfo.
private static ConditionInfo toConditionInfo(@NotNull Condition condition) {
ConditionInfo cnd = null;
if (condition instanceof SimpleCondition) {
Object obj = ((SimpleCondition) condition).inner();
if (obj instanceof SimpleCondition.ExistenceCondition) {
SimpleCondition.ExistenceCondition inner = (SimpleCondition.ExistenceCondition) obj;
cnd = new SimpleConditionInfo(inner.key(), inner.type(), null, 0);
} else if (obj instanceof SimpleCondition.TombstoneCondition) {
SimpleCondition.TombstoneCondition inner = (SimpleCondition.TombstoneCondition) obj;
cnd = new SimpleConditionInfo(inner.key(), inner.type(), null, 0);
} else if (obj instanceof SimpleCondition.RevisionCondition) {
SimpleCondition.RevisionCondition inner = (SimpleCondition.RevisionCondition) obj;
cnd = new SimpleConditionInfo(inner.key(), inner.type(), null, inner.revision());
} else if (obj instanceof SimpleCondition.ValueCondition) {
SimpleCondition.ValueCondition inner = (SimpleCondition.ValueCondition) obj;
cnd = new SimpleConditionInfo(inner.key(), inner.type(), inner.value(), 0);
} else {
assert false : "Unknown condition type: " + obj.getClass().getSimpleName();
}
} else if (condition instanceof CompoundCondition) {
CompoundCondition cond = (CompoundCondition) condition;
cnd = new CompoundConditionInfo(toConditionInfo(cond.leftCondition()), toConditionInfo(cond.rightCondition()), cond.compoundConditionType());
} else {
assert false : "Unknown condition type: " + condition.getClass().getSimpleName();
}
return cnd;
}
Aggregations