Examples of StorageDir


Examples of tachyon.worker.hierarchy.StorageDir

    // size, return the Pair of StorageDir and blockInfoList
    while (true) {
      // Get oldest block in StorageDir candidates
      Pair<StorageDir, Long> candidate =
          getLRUBlockCandidate(storageDirs, dir2LRUBlocks, dir2BlocksToEvict, pinList);
      StorageDir dirCandidate = candidate.getFirst();
      long blockId = candidate.getSecond();
      long blockSize = 0;
      if (dirCandidate == null) {
        return null;
      } else {
        blockSize = dirCandidate.getBlockSize(blockId);
      }
      // Add info of the block to the list
      blockInfoList.add(new BlockInfo(dirCandidate, blockId, blockSize));
      dir2BlocksToEvict.put(dirCandidate, blockId);
      dir2LRUBlocks.remove(dirCandidate);
      long evictionSize;
      // Update eviction size for this StorageDir
      if (sizeToEvict.containsKey(dirCandidate)) {
        evictionSize = sizeToEvict.get(dirCandidate) + blockSize;
      } else {
        evictionSize = blockSize;
      }
      sizeToEvict.put(dirCandidate, evictionSize);
      if (evictionSize + dirCandidate.getAvailableBytes() >= requestSize) {
        return new Pair<StorageDir, List<BlockInfo>>(dirCandidate, blockInfoList);
      }
    }
  }
View Full Code Here

Examples of tachyon.worker.hierarchy.StorageDir

   * @return pair of StorageDir that contains the block to be evicted and Id of the block
   */
  private Pair<StorageDir, Long> getLRUBlockCandidate(StorageDir[] storageDirs,
      Map<StorageDir, Pair<Long, Long>> dir2LRUBlocks,
      HashMultimap<StorageDir, Long> dir2BlocksToEvict, Set<Integer> pinList) {
    StorageDir dirCandidate = null;
    long blockId = -1;
    long oldestTime = Long.MAX_VALUE;
    for (StorageDir dir : storageDirs) {
      Pair<Long, Long> lruBlock;
      if (!dir2LRUBlocks.containsKey(dir)) {
View Full Code Here

Examples of tachyon.worker.hierarchy.StorageDir

  @Override
  public synchronized Pair<StorageDir, List<BlockInfo>> getDirCandidate(StorageDir[] storageDirs,
      Set<Integer> pinList, long requestSize) {
    List<BlockInfo> blockInfoList = new ArrayList<BlockInfo>();
    Set<StorageDir> ignoredDirs = new HashSet<StorageDir>();
    StorageDir dirSelected = getDirWithMaxFreeSpace(requestSize, storageDirs, ignoredDirs);
    while (dirSelected != null) {
      Set<Long> blockIdSet = new HashSet<Long>();
      long sizeToEvict = 0;
      while (sizeToEvict + dirSelected.getAvailableBytes() < requestSize) {
        Pair<Long, Long> oldestAccess = getLRUBlock(dirSelected, blockIdSet, pinList);
        if (oldestAccess.getFirst() != -1) {
          long blockSize = dirSelected.getBlockSize(oldestAccess.getFirst());
          sizeToEvict += blockSize;
          blockInfoList.add(new BlockInfo(dirSelected, oldestAccess.getFirst(), blockSize));
          blockIdSet.add(oldestAccess.getFirst());
        } else {
          break;
        }
      }
      if (sizeToEvict + dirSelected.getAvailableBytes() < requestSize) {
        ignoredDirs.add(dirSelected);
        blockInfoList.clear();
        blockIdSet.clear();
        dirSelected = getDirWithMaxFreeSpace(requestSize, storageDirs, ignoredDirs);
      } else {
View Full Code Here

Examples of tachyon.worker.hierarchy.StorageDir

   * @param ignoredList StorageDirs that have been ignored
   * @return the StorageDir selected
   */
  private StorageDir getDirWithMaxFreeSpace(long requestSize, StorageDir[] storageDirs,
      Set<StorageDir> ignoredList) {
    StorageDir dirSelected = null;
    long maxAvailableSize = -1;
    for (StorageDir dir : storageDirs) {
      if (ignoredList.contains(dir)) {
        continue;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.