You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by cm...@apache.org on 2013/09/27 17:47:38 UTC
svn commit: r1526962 -
/hadoop/common/branches/branch-2.1-beta/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/CachingStrategy.java
Author: cmccabe
Date: Fri Sep 27 15:47:38 2013
New Revision: 1526962
URL: http://svn.apache.org/r1526962
Log:
add file for HDFS-4817
Added:
hadoop/common/branches/branch-2.1-beta/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/CachingStrategy.java
Added: hadoop/common/branches/branch-2.1-beta/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/CachingStrategy.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/CachingStrategy.java?rev=1526962&view=auto
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/CachingStrategy.java (added)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/CachingStrategy.java Fri Sep 27 15:47:38 2013
@@ -0,0 +1,64 @@
+/**
+ * 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.hdfs.server.datanode;
+
+/**
+ * The caching strategy we should use for an HDFS read or write operation.
+ */
+public class CachingStrategy {
+ private Boolean dropBehind; // null = use server defaults
+ private Long readahead; // null = use server defaults
+
+ public static CachingStrategy newDefaultStrategy() {
+ return new CachingStrategy(null, null);
+ }
+
+ public static CachingStrategy newDropBehind() {
+ return new CachingStrategy(true, null);
+ }
+
+ public CachingStrategy duplicate() {
+ return new CachingStrategy(this.dropBehind, this.readahead);
+ }
+
+ public CachingStrategy(Boolean dropBehind, Long readahead) {
+ this.dropBehind = dropBehind;
+ this.readahead = readahead;
+ }
+
+ public Boolean getDropBehind() {
+ return dropBehind;
+ }
+
+ public void setDropBehind(Boolean dropBehind) {
+ this.dropBehind = dropBehind;
+ }
+
+ public Long getReadahead() {
+ return readahead;
+ }
+
+ public void setReadahead(Long readahead) {
+ this.readahead = readahead;
+ }
+
+ public String toString() {
+ return "CachingStrategy(dropBehind=" + dropBehind +
+ ", readahead=" + readahead + ")";
+ }
+}