alex-plekhanov commented on a change in pull request #6554: IGNITE-11073: 
Backup page store manager, initial
URL: https://github.com/apache/ignite/pull/6554#discussion_r391044039
 
 

 ##########
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRequestMessage.java
 ##########
 @@ -0,0 +1,135 @@
+/*
+ * 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.processors.cache.persistence.snapshot;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.Map;
+import org.apache.ignite.internal.GridDirectMap;
+import org.apache.ignite.internal.util.GridIntList;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import 
org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+
+/**
+ *
+ */
+public class SnapshotRequestMessage extends AbstractSnapshotMessage {
+    /** Snapshot request message type (value is {@code 177}). */
+    public static final short TYPE_CODE = 177;
+
+    /** Serialization version. */
+    private static final long serialVersionUID = 0L;
+
+    /** Map of cache group ids and corresponding set of its partition ids. */
+    @GridDirectMap(keyType = Integer.class, valueType = GridIntList.class)
+    private Map<Integer, GridIntList> parts;
+
+    /**
+     * Empty constructor required for {@link Externalizable}.
+     */
+    public SnapshotRequestMessage() {
+        // No-op.
+    }
+
+    /**
+     * @param snpName Unique snapshot name.
+     * @param parts Map of cache group ids and corresponding set of its 
partition ids to be snapshotted.
+     */
+    public SnapshotRequestMessage(String snpName, Map<Integer, GridIntList> 
parts) {
+        super(snpName);
+
+        assert parts != null && !parts.isEmpty();
+
+        this.parts = U.newHashMap(parts.size());
 
 Review comment:
   It's unnecessary to copy hash map here, you already create a copy when you 
create this message. Or, you can move creating parts from `Map<Integer, 
Set<Integer>>` to here.
   Also, lets replace `GridIntList` with `int[]` it will simplify the code and 
remove unnecessary `GridIntList.valueOf()` method.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to