You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/05/11 12:33:14 UTC

[GitHub] [ignite-3] sanpwc commented on a change in pull request #116: IGNITE-14664

sanpwc commented on a change in pull request #116:
URL: https://github.com/apache/ignite-3/pull/116#discussion_r630123233



##########
File path: modules/metastorage-client/src/main/java/org/apache/ignite/internal/metastorage/client/MetaStorageServiceImpl.java
##########
@@ -0,0 +1,366 @@
+/*
+ * 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.internal.metastorage.client;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.metastorage.common.command.GetAllCommand;
+import org.apache.ignite.internal.metastorage.common.command.GetAndPutAllCommand;
+import org.apache.ignite.internal.metastorage.common.command.GetAndPutCommand;
+import org.apache.ignite.internal.metastorage.common.command.GetAndRemoveAllCommand;
+import org.apache.ignite.internal.metastorage.common.command.GetAndRemoveCommand;
+import org.apache.ignite.internal.metastorage.common.command.GetCommand;
+import org.apache.ignite.internal.metastorage.common.command.PutAllCommand;
+import org.apache.ignite.internal.metastorage.common.command.PutCommand;
+import org.apache.ignite.internal.metastorage.common.command.RangeCommand;
+import org.apache.ignite.internal.metastorage.common.command.RemoveAllCommand;
+import org.apache.ignite.internal.metastorage.common.command.RemoveCommand;
+import org.apache.ignite.internal.metastorage.common.command.WatchExactKeysCommand;
+import org.apache.ignite.internal.metastorage.common.command.WatchRangeKeysCommand;
+import org.apache.ignite.lang.IgniteLogger;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.metastorage.client.MetaStorageService;
+import org.apache.ignite.metastorage.common.Condition;
+import org.apache.ignite.metastorage.common.Cursor;
+import org.apache.ignite.metastorage.common.Entry;
+import org.apache.ignite.metastorage.common.Key;
+import org.apache.ignite.metastorage.common.Operation;
+import org.apache.ignite.metastorage.common.WatchEvent;
+import org.apache.ignite.metastorage.common.WatchListener;
+import org.apache.ignite.raft.client.service.RaftGroupService;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * {@link MetaStorageService} implementation.
+ */
+public class MetaStorageServiceImpl implements MetaStorageService {
+    /** The logger. */
+    private static final IgniteLogger LOG = IgniteLogger.forClass(MetaStorageServiceImpl.class);
+
+    /** Meta storage raft group service. */
+    private final RaftGroupService metaStorageRaftGrpSvc;
+
+    // TODO: IGNITE-14691 Temporally solution that should be removed after implementing reactive watches.
+    /** Watch processor, that uses pulling logic in order to retrieve watch notifications from server. */
+    private final WatchProcessor watchProcessor;
+
+    /**
+     * @param metaStorageRaftGrpSvc Meta storage raft group service.
+     */
+    public MetaStorageServiceImpl(RaftGroupService metaStorageRaftGrpSvc) {
+        this.metaStorageRaftGrpSvc = metaStorageRaftGrpSvc;
+        this.watchProcessor = new WatchProcessor();
+    }
+
+    /** {@inheritDoc} */
+    @Override public @NotNull CompletableFuture<Entry> get(@NotNull Key key) {
+        return metaStorageRaftGrpSvc.run(new GetCommand(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public @NotNull CompletableFuture<Entry> get(@NotNull Key key, long revUpperBound) {
+        return metaStorageRaftGrpSvc.run(new GetCommand(key, revUpperBound));
+    }
+
+    /** {@inheritDoc} */
+    @Override public @NotNull CompletableFuture<Map<Key, Entry>> getAll(Collection<Key> keys) {
+        List<Key> keysWithPreservedOrder = new ArrayList<>(keys);

Review comment:
       Agreed. Fixed.




-- 
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:
users@infra.apache.org