You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2021/03/29 23:26:54 UTC

[ignite-3] 02/04: Code review fixes

This is an automated email from the ASF dual-hosted git repository.

agura pushed a commit to branch ignite-14198
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit c329ccb45f1605c8893c4d6953eb8e23540d3e31
Author: Andrey Gura <ag...@apache.org>
AuthorDate: Wed Mar 24 01:55:16 2021 +0300

    Code review fixes
---
 .../org/apache/ignite/metastorage/client/MetaStorageService.java   | 7 ++++---
 .../main/java/org/apache/ignite/metastorage/common/Condition.java  | 5 ++---
 .../main/java/org/apache/ignite/metastorage/common/Operations.java | 5 ++++-
 .../java/org/apache/ignite/metastorage/common/WatchListener.java   | 2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/modules/metastorage-client/src/main/java/org/apache/ignite/metastorage/client/MetaStorageService.java b/modules/metastorage-client/src/main/java/org/apache/ignite/metastorage/client/MetaStorageService.java
index 255ce4b..2fb7b47 100644
--- a/modules/metastorage-client/src/main/java/org/apache/ignite/metastorage/client/MetaStorageService.java
+++ b/modules/metastorage-client/src/main/java/org/apache/ignite/metastorage/client/MetaStorageService.java
@@ -264,7 +264,7 @@ public interface MetaStorageService {
      *
      * @param keyFrom Start key of range (inclusive). Could be {@code null}.
      * @param keyTo End key of range (exclusive). Could be {@code null}.
-     * @param revision Start revision inclusive. {@code 0} - all revision,
+     * @param revision Start revision inclusive. {@code 0} - all revisions,
      * {@code -1} - latest revision (accordingly to current meta storage state).
      * @param lsnr Listener which will be notified for each update.
      * @return Subscription identifier. Could be used in {@link #stopWatch} method in order to cancel subscription.
@@ -281,8 +281,8 @@ public interface MetaStorageService {
     /**
      * Subscribes on meta storage updates for the given key.
      *
-     * @param key The target key. Could be {@code null}.
-     * @param revision Start revision inclusive. {@code 0} - all revision,
+     * @param key The target key. Couldn't be {@code null}.
+     * @param revision Start revision inclusive. {@code 0} - all revisions,
      * {@code -1} - latest revision (accordingly to current meta storage state).
      * @param lsnr Listener which will be notified for each update.
      * @return Subscription identifier. Could be used in {@link #stopWatch} method in order to cancel subscription.
@@ -329,6 +329,7 @@ public interface MetaStorageService {
      * @return Completed future. Couldn't be {@code null}.
      * @throws OperationTimeoutException If the operation is timed out. Will be thrown on getting future result.
      */
+    @NotNull
     CompletableFuture<Void> compact();
 }
 
diff --git a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Condition.java b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Condition.java
index ee3cab6..359829b 100644
--- a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Condition.java
+++ b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Condition.java
@@ -71,7 +71,6 @@ public final class Condition {
             // No-op.
         }
 
-        // TODO: eq, ne, lt, le, gt, ge
         /**
          * Produces the condition of type {@link Type#EQUAL}. This condition tests the given revision on equality with
          * target entry revision.
@@ -280,8 +279,8 @@ public final class Condition {
         }
 
         /**
-         * Produces the condition of type {@link Type#NOT_EQUAL}. This condition tests the given мфдгу on inequality
-         * with target entry мфдгу.
+         * Produces the condition of type {@link Type#NOT_EQUAL}. This condition tests the given value on inequality
+         * with target entry value.
          *
          * @param val The value.
          * @return The condition of type {@link Type#NOT_EQUAL}.
diff --git a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Operations.java b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Operations.java
index d7296a7..994f4bd 100644
--- a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Operations.java
+++ b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Operations.java
@@ -24,6 +24,9 @@ package org.apache.ignite.metastorage.common;
  * @see Operation
  */
 public final class Operations {
+    /** No-op operation singleton. */
+    private static final Operation.NoOp NO_OP = new Operation.NoOp();
+
     /**
      * Creates operation of type <i>remove</i>. This type of operation removes entry.
      *
@@ -49,7 +52,7 @@ public final class Operations {
      * @return Operation of type <i>noop</i>.
      */
     public static Operation noop() {
-        return new Operation(new Operation.NoOp());
+        return new Operation(NO_OP);
     }
 
     /**
diff --git a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/WatchListener.java b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/WatchListener.java
index 32785e0..1ed196e 100644
--- a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/WatchListener.java
+++ b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/WatchListener.java
@@ -26,7 +26,7 @@ public interface WatchListener {
     /**
      * The method will be called on each meta storage update.
      *
-     * @param events A single event or batch.
+     * @param events A single event or a batch. The batch always contains updates for specific revision.
      * @return {@code True} if listener must continue event handling. If returns {@code false} then the listener and
      * corresponding watch will be unregistered.
      */