AMashenkov commented on a change in pull request #64:
URL: https://github.com/apache/ignite-3/pull/64#discussion_r592412162



##########
File path: 
modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Condition.java
##########
@@ -0,0 +1,357 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.ignite.metastorage.common;
+
+import java.util.Arrays;
+
+/**
+ * Represents a condition for conditional update.
+ */
+public final class Condition {
+    /** Actual condition implementation. */
+    private final InnerCondition cond;
+
+    /**
+     * Constructs a condition which wraps the actual condition implementation.
+     *
+     * @param cond The actual condition implementation.
+     */
+    Condition(InnerCondition cond) {
+        this.cond = cond;
+    }
+
+    /**
+     * Tests the given entry on satisfaction of the condition.
+     *
+     * @param e Entry.
+     * @return The result of condition test. {@code true} - if the entry 
satisfies to the condition,
+     * otherwise - {@code false}.
+     */
+    public boolean test(Entry e) {
+        return cond.test(e);
+    }
+
+    /**
+     * Represents condition on entry revision. Only one type of condition 
could be applied to
+     * the one instance of condition. Subsequent invocations of any method 
which produces condition will throw
+     * {@link IllegalStateException}.
+     */
+    public static final class RevisionCondition implements InnerCondition {
+        /**
+         * The type of condition.
+         *
+         * @see Type
+         */
+        private Type type;
+
+        /**
+         * The revision as the condition argument.
+         */
+        private long rev;
+
+        /**
+         * Default no-op constructor.
+         */
+        RevisionCondition() {
+            // No-op.
+        }
+
+        // TODO: eq, ne, lt, le, gt, ge

Review comment:
       ```suggestion
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to