/*
 * 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.worker.block.evictor;

import java.io.IOException;

import tachyon.worker.block.BlockStoreLocation;

/**
 * Interface for the eviction policy in Tachyon
 */
public interface Evictor {
  /**
   * Frees space in the given block store location to ensure a specific amount of free space
   * available after eviction. The location can be a specific location with StorageTier and
   * StorageDir, or {@link BlockStoreLocation#anyTier()} or
   * {@link BlockStoreLocation#anyDirInTier(int)}. This operation returns null if Evictor fails to
   * propose a feasible plan to meet its requirement, or an eviction plan to ensure the free space.
   * The returned eviction plan can have toMove and toEvict fields empty lists, which indicates
   * no necessary actions to meet the requirement.
   *
   * @param availableBytes the amount of free space in bytes to be ensured after eviction
   * @param location the location in block store
   * @return an eviction plan (possibly empty) to get the free space, or null if no plan is feasible
   * @throws IOException if given block location is invalid
   */
  EvictionPlan freeSpace(long availableBytes, BlockStoreLocation location) throws IOException;
}

@@ -1046,20 +1046,69 @@
 tion
- to ensure a
+, so that a least one StorageDir in the location%0A   * has the
  spe
@@ -1137,23 +1137,8 @@
 pace
-%0A   * available
  aft
@@ -1184,38 +1184,8 @@
 ific
- location with StorageTier and
 %0A   
@@ -1238,19 +1238,12 @@
 Tier
-()
 %7D or
-%0A   *
  %7B@l
@@ -1281,30 +1281,41 @@
 Tier
-(int)%7D. This operation
+%7D.%0A   *%0A   * %3CP%3E%0A   * This method
  ret
@@ -1343,21 +1343,16 @@
 fails to
-%0A   *
  propose
@@ -1380,11 +1380,11 @@
 eet 
-its
+the
  req
@@ -1392,16 +1392,21 @@
 irement,
+%0A   *
  or an e
@@ -1422,178 +1422,212 @@
 lan 
-to ensure the free space.%0A   * The returned eviction plan can have toMove and toEvict fields empty lists, which indicates%0A   * no necessary actions to meet the requiremen
+with toMove and toEvict fields to indicate how to free space. If both%0A   * toMove and toEvict of the plan are empty, it indicates that Evictor has no actions to take and%0A   * the requirement is already me
 t.%0A 
@@ -1809,21 +1809,33 @@
 ossibly 
-empty
+with empty fields
 ) to get
@@ -1869,16 +1869,29 @@
  no plan
+%0A   *        
  is feas

Update description of Evictor