ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] Vladsz83 commented on a change in pull request #9313: IGNITE-14999v3
Date Fri, 03 Sep 2021 09:19:41 GMT

Vladsz83 commented on a change in pull request #9313:
URL: https://github.com/apache/ignite/pull/9313#discussion_r701738762



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotMetadata.java
##########
@@ -170,6 +178,54 @@ public boolean sameSnapshot(SnapshotMetadata compare) {
             Objects.equals(baselineNodes(), compare.baselineNodes());
     }
 
+    /**
+     * @param grpId Cache id or cache group id.
+     * @return {@code True} if cache group is encrypted. {@code False} otherwise.
+     */
+    public boolean isCacheGroupEncrypted(int grpId) {
+        Set<Integer> encrGrpIds = this.encrGrpIds;
+
+        return encrGrpIds != null && encrGrpIds.contains(grpId);
+    }
+
+    /**
+     * @param masterKeyDigest Master key digest for encrypted caches.
+     * @return this meta.
+     */
+    public SnapshotMetadata masterKeyDigest(@Nullable byte[] masterKeyDigest) {
+        this.masterKeyDigest = masterKeyDigest == null ? null : masterKeyDigest.clone();
+
+        return this;
+    }
+
+    /**
+     * @return Master key digest for encrypted caches.
+     */
+    public byte[] masterKeyDigest() {
+        byte[] masterKeyDigest = this.masterKeyDigest;
+
+        return masterKeyDigest == null ? null : masterKeyDigest.clone();
+    }
+
+    /**
+     * Stores ids of encrypted cache groups.
+     *
+     * @return this meta.
+     */
+    public SnapshotMetadata encrGrpIds(Collection<Integer> encrGrpIds) {
+        // Might be null even if final due to deserialization of previous version the object;
+        if (this.encrGrpIds == null) {
+            synchronized (this) {
+                if (this.encrGrpIds == null)
+                    this.encrGrpIds = new HashSet<>();
+            }
+        }
+
+        this.encrGrpIds.addAll(encrGrpIds);

Review comment:
       Nope. Once `encrGrpIds` gets assigned, it never takes null. User cannot null it.




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

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message