You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/05/14 23:25:54 UTC

[GitHub] [hadoop] arp7 commented on a change in pull request #798: HDDS-1499. OzoneManager Cache.

arp7 commented on a change in pull request #798: HDDS-1499. OzoneManager Cache.
URL: https://github.com/apache/hadoop/pull/798#discussion_r284025787
 
 

 ##########
 File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/cache/CacheValue.java
 ##########
 @@ -0,0 +1,63 @@
+/**
+ * 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.hadoop.utils.db.cache;
+
+import java.util.Objects;
+
+/**
+ * CacheValue for the RocksDB Table.
+ * @param <VALUE>
+ */
+public class CacheValue<VALUE> {
+
+  private VALUE value;
+  private OperationType lastOperation;
+  // This value is used for evict entries from cache.
+  // This value is set with ratis transaction context log entry index.
+  private long epoch;
+
+  public CacheValue(VALUE value, OperationType lastOperation, long epoch) {
+    Objects.requireNonNull(value, "Value Should not be null in CacheValue");
+    this.value = value;
+    this.lastOperation = lastOperation;
+    this.epoch = epoch;
+  }
+
+  public VALUE getValue() {
+    return value;
+  }
+
+  public OperationType getLastOperation() {
+    return lastOperation;
+  }
+
+  public long getEpoch() {
+    return epoch;
+  }
+
+  /**
+   * Last happened Operation.
 
 Review comment:
   Bharat, what if we support further operation types in future? I was thinking whether we really need this _lastOperation_ field.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org