/*
 * Licensed to the University of California, Berkeley 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 tachyon.client;

/**
 * Different read types for a TachyonFile.
 *
 * As of 0.8, replaced by {@link TachyonStorageType} and {@link UnderStorageType}
 */
@Deprecated
public enum ReadType {
  /**
   * Read the file and but do not cache it explicitly.
   */
  NO_CACHE(1),
  /**
   * Read the file and cache it.
   */
  CACHE(2);

  /**
   * If the block is on local Tachyon space but not on top storage layer, promote the block to top
   * storage layer after reading.
   *
   * TODO(calvin): Enable this again when lock upgrading is implemented in the worker.
   */
  //CACHE_PROMOTE(3);

  private final int mValue;

  ReadType(int value) {
    mValue = value;
  }

  /**
   * Return the value of the read type
   *
   * @return the read type value
   */
  public int getValue() {
    return mValue;
  }

  /**
   * @return true if the read type is CACHE, false otherwise
   *
   * TODO(calvin): Add CACHE_PROMOTE back when it is enabled again.
   */
  public boolean isCache() {
    return mValue == CACHE.mValue;
    // return mValue == CACHE.mValue || mValue == CACHE_PROMOTE.mValue;
  }

  /**
   * @return true if the read type is CACHE_PROMOTE, false otherwise
   *
   * TODO(calvin): Add this function back when CACHE_PROMOTE is enabled again.
   */
//  public boolean isPromote() {
//    return mValue == CACHE_PROMOTE.mValue;
//  }
}

@@ -864,189 +864,154 @@
 .%0A *
-%0A * As of 0.8, replaced by %7B@link TachyonStorageType%7D and %7B@link UnderStorageType%7D%0A */%0A@Deprecated%0Apublic enum ReadType %7B%0A  /**%0A   * Read the file and but do not cache it explicitly
+/%0Apublic enum ReadType %7B%0A  /**%0A   * Read the file and skip Tachyon storage. This mode will not alter any data distribution%0A   * in Tachyon storage
 .%0A  
@@ -1070,116 +1070,101 @@
 e it
-.%0A   */%0A  CACHE(2);%0A%0A  /**%0A   * If the block is o
+ in a local worker. Additionally, if the file was i
 n 
-local 
 Tachyon
- space but not on top storage layer,
+%0A   * storage, it will be
  promote
  the
@@ -1163,162 +1163,136 @@
 mote
+d
  t
-he block to top%0A   * storage layer after reading.%0A   *%0A   * TODO(calvin): Enable this again when lock upgrading is implemented in
+o the top storage layer.%0A   */%0A  CACHE(2),%0A%0A  /**%0A   * The behavior of this mode is
  the 
-worker.%0A   */%0A  //
+same as CACHE.%0A   */%0A  @Deprecated%0A  
 CACH
@@ -1722,46 +1722,8 @@
 e ==
- CACHE.mValue;%0A    // return mValue ==
  CAC
@@ -1855,96 +1855,10 @@
    *
-%0A   * TODO(calvin): Add this function back when CACHE_PROMOTE is enabled again.%0A   */%0A/
 /
+%0A
   pu
@@ -1884,18 +1884,16 @@
 ote() %7B%0A
-//
     retu
@@ -1896,32 +1896,58 @@
 return mValue ==
+ CACHE.mValue %7C%7C mValue ==
  CACHE_PROMOTE.m
@@ -1953,16 +1953,14 @@
 mValue;%0A
-//
   %7D%0A%7D%0A

Update readtype and deprecate only the modes which will no longer be supported.