public class BlockInfo extends Object
Modifier and Type | Field and Description |
---|---|
long |
mBlockId |
int |
mBlockIndex |
long |
mLength |
long |
mOffset |
Modifier and Type | Method and Description |
---|---|
void |
addLocation(long workerId,
NetAddress workerAddress,
long storageDirId)
Add a location of the block.
|
static long |
computeBlockId(int inodeId,
int blockIndex)
Compute the block's id with the inode's id and the block's index in the inode.
|
static int |
computeBlockIndex(long blockId)
Compute the block's index in the inode with the block's id.
|
static int |
computeInodeId(long blockId)
Compute the inode's id of the block.
|
ClientBlockInfo |
generateClientBlockInfo()
Generate a ClientBlockInfo of the block, which is used for the thrift server.
|
List<Pair<Long,Long>> |
getBlockIdWorkerIdPairs()
Get the list of pairs "blockId, workerId", where the blockId is the id of this block, and the
workerId is the id of the worker who has the block's data in memory.
|
InodeFile |
getInodeFile()
Get the InodeFile of the block
|
List<NetAddress> |
getLocations()
Get the locations of the block, which are the workers' net address who has the data of the
block in memory.
|
boolean |
isInMemory() |
void |
removeLocation(long workerId)
Remove the worker from the block's locations
|
String |
toString() |
public final int mBlockIndex
public final long mBlockId
public final long mOffset
public final long mLength
public static long computeBlockId(int inodeId, int blockIndex)
inodeId
- The inode's id of the blockblockIndex
- The block's index of the block in the inodepublic static int computeBlockIndex(long blockId)
blockId
- The id of the blockpublic static int computeInodeId(long blockId)
blockId
- The id of the blockpublic void addLocation(long workerId, NetAddress workerAddress, long storageDirId)
workerId
- The id of the workerworkerAddress
- The net address of the workerstorageDirId
- The id of the StorageDir which block is located inpublic ClientBlockInfo generateClientBlockInfo()
public List<Pair<Long,Long>> getBlockIdWorkerIdPairs()
public InodeFile getInodeFile()
public List<NetAddress> getLocations()
public boolean isInMemory()
public void removeLocation(long workerId)
workerId
- The id of the removed workerCopyright © 2015. All Rights Reserved.