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:56 UTC

[ignite-3] 04/04: IGNITE-14198 Meta storage client interface

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 74265b5452f3b1360b354daeb7a2d081f409af16
Author: Andrey Gura <ag...@apache.org>
AuthorDate: Tue Mar 30 02:25:13 2021 +0300

    IGNITE-14198 Meta storage client interface
---
 .../ignite/util/LexicographicComparator.java       | 51 ----------------------
 .../metastorage/client/MetaStorageService.java     |  4 --
 .../org/apache/ignite/metastorage/common/Key.java  |  3 +-
 .../ignite/metastorage/common/Operation.java       |  2 +-
 4 files changed, 2 insertions(+), 58 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/util/LexicographicComparator.java b/modules/core/src/main/java/org/apache/ignite/util/LexicographicComparator.java
deleted file mode 100644
index 103fdc2..0000000
--- a/modules/core/src/main/java/org/apache/ignite/util/LexicographicComparator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.util;
-
-import java.util.Comparator;
-
-/**
- * Byte array lexicographic comparator.
- */
-public class LexicographicComparator implements Comparator<byte[]> {
-    /** Comparator instance. */
-    private static final Comparator<byte[]> INSTANCE = new LexicographicComparator();
-
-    /**
-     * Returns instance of comparator.
-     *
-     * @return Comparator instance.
-     */
-    public static Comparator<byte[]> getInstance() {
-        return INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int compare(byte[] o1, byte[] o2) {
-        int minLength = Math.min(o1.length, o2.length);
-
-        for (int i = 0; i < minLength; ++i) {
-            int res = Byte.compareUnsigned(o1[i], o2[i]);
-
-            if (res != 0)
-                return res;
-        }
-
-        return o1.length - o2.length;
-    }
-}
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 50e19dd..dfb4868 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
@@ -286,7 +286,6 @@ public interface MetaStorageService {
      * @see Entry
      */
     @NotNull
-    //TODO: UUID Should be replaced by IgniteUUID when it will be introduced.
     CompletableFuture<IgniteUuid> watch(@Nullable Key keyFrom, @Nullable Key keyTo,
                                   long revision, @NotNull WatchListener lsnr);
 
@@ -305,7 +304,6 @@ public interface MetaStorageService {
      * @see Entry
      */
     @NotNull
-    //TODO: UUID Should be replaced by IgniteUUID when it will be introduced.
     CompletableFuture<IgniteUuid> watch(@NotNull Key key, long revision, @NotNull WatchListener lsnr);
 
     /**
@@ -323,7 +321,6 @@ public interface MetaStorageService {
      * @see Entry
      */
     @NotNull
-    //TODO: UUID Should be replaced by IgniteUUID when it will be introduced.
     CompletableFuture<IgniteUuid> watch(@NotNull Collection<Key> keys, long revision, @NotNull WatchListener lsnr);
 
     /**
@@ -334,7 +331,6 @@ public interface MetaStorageService {
      * @throws OperationTimeoutException If the operation is timed out. Will be thrown on getting future result.
      */
     @NotNull
-    //TODO: UUID Should be replaced by IgniteUUID when it will be introduced.
     CompletableFuture<Void> stopWatch(@NotNull IgniteUuid id);
 
     /**
diff --git a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Key.java b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Key.java
index a160307..d497021 100644
--- a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Key.java
+++ b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Key.java
@@ -19,7 +19,6 @@ package org.apache.ignite.metastorage.common;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
-import org.apache.ignite.util.LexicographicComparator;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -76,6 +75,6 @@ public final class Key implements Comparable<Key> {
 
     /** {@inheritDoc} */
     @Override public int compareTo(@NotNull Key other) {
-        return LexicographicComparator.getInstance().compare(this.arr, other.arr);
+        return Arrays.compare(this.arr, other.arr);
     }
 }
diff --git a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Operation.java b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Operation.java
index 98196a9..e085a28 100644
--- a/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Operation.java
+++ b/modules/metastorage-common/src/main/java/org/apache/ignite/metastorage/common/Operation.java
@@ -81,4 +81,4 @@ public final class Operation {
     private interface InnerOp {
         // Marker interface.
     }
-}
\ No newline at end of file
+}