Navigation Menu

Skip to content

Commit

Permalink
Update BlockInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
apc999 authored and calvinjia committed Jun 27, 2015
1 parent c7fc16f commit 03619c8
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions servers/src/main/java/tachyon/worker/block/meta/BlockInfo.java
Expand Up @@ -15,44 +15,39 @@


package tachyon.worker.block.meta; package tachyon.worker.block.meta;


import java.util.UUID;

import tachyon.util.CommonUtils;

/** /**
* Block information on worker side. * Represents the metadata of a block in Tachyon managed storage.
*/ */
public final class BlockInfo { public class BlockInfo {
private final StorageDir mDir;
private final long mBlockId; private final long mBlockId;
private final long mBlockSize; private final long mBlockSize;
private final String mPath;
private final String mTmpPath;


public BlockInfo(StorageDir storageDir, long blockId, long blockSize) { public BlockInfo(long blockId, long blockSize, String localPath) {
mDir = storageDir;
mBlockId = blockId; mBlockId = blockId;
mBlockSize = blockSize; mBlockSize = blockSize;
mPath = CommonUtils.concatPath(localPath, blockId);
mTmpPath = CommonUtils.concatPath(localPath, UUID.randomUUID());
} }


/**
* Get Id of the block
*
* @return Id of the block
*/
public long getBlockId() { public long getBlockId() {
return mBlockId; return mBlockId;
} }


/** public long getBlockSize() {
* Get size of the block
*
* @return size of the block in bytes
*/
public long getSize() {
return mBlockSize; return mBlockSize;
} }


/** public String getPath() {
* Get the StorageDir which contains the block return mPath;
* }
* @return StorageDir which contains the block
*/ public String getTmpPath() {
public StorageDir getStorageDir() { return mTmpPath;
return mDir;
} }
} }

0 comments on commit 03619c8

Please sign in to comment.