Example #1
0
 /**
  * Get evictable bytes for this dir, i.e., the total bytes of total evictable blocks
  *
  * @return evictable bytes for this dir
  */
 public long getEvitableBytes() {
   long bytes = 0;
   for (BlockMeta blockMeta : mDir.getBlocks()) {
     long blockId = blockMeta.getBlockId();
     if (mManagerView.isBlockEvictable(blockId)) {
       bytes += blockMeta.getBlockSize();
     }
   }
   return bytes;
 }
Example #2
0
  /**
   * Get a filtered list of block metadata, for blocks that are neither pinned or being blocked.
   *
   * @return a list of metadata for all evictable blocks
   */
  public List<BlockMeta> getEvictableBlocks() {
    List<BlockMeta> filteredList = new ArrayList<BlockMeta>();

    for (BlockMeta blockMeta : mDir.getBlocks()) {
      long blockId = blockMeta.getBlockId();
      if (mManagerView.isBlockEvictable(blockId)) {
        filteredList.add(blockMeta);
      }
    }
    return filteredList;
  }