public final class WorkerBlockMasterClient extends MasterClientBase
mUseZookeeper
mAddress, mClosed, mConnected, mMode, mProtocol, mTachyonConf, RPC_MAX_NUM_RETRY
Constructor and Description |
---|
WorkerBlockMasterClient(InetSocketAddress masterAddress,
TachyonConf tachyonConf)
Creates a new block master client for the worker.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterConnect() |
void |
commitBlock(long workerId,
long usedBytesOnTier,
int tier,
long blockId,
long length)
Commits a block on a worker.
|
long |
getId(NetAddress address)
Returns a worker id for a workers net address.
|
protected String |
getServiceName() |
Command |
heartbeat(long workerId,
List<Long> usedBytesOnTiers,
List<Long> removedBlocks,
Map<Long,List<Long>> addedBlocks)
The method the worker should periodically execute to heartbeat back to the master.
|
void |
register(long workerId,
List<Long> totalBytesOnTiers,
List<Long> usedBytesOnTiers,
Map<Long,List<Long>> currentBlocksOnTiers)
The method the worker should execute to register with the block master.
|
getAddress
afterDisconnect, close, connect, disconnect, isConnected, resetConnection
public WorkerBlockMasterClient(InetSocketAddress masterAddress, TachyonConf tachyonConf)
masterAddress
- the master addresstachyonConf
- the Tachyon configurationprotected String getServiceName()
getServiceName
in class ClientBase
protected void afterConnect()
afterConnect
in class ClientBase
public void commitBlock(long workerId, long usedBytesOnTier, int tier, long blockId, long length) throws IOException
workerId
- the worker id committing the blockusedBytesOnTier
- the amount of used bytes on the tier the block is committing totier
- the tier the block is being committed toblockId
- the block id being committedlength
- the length of the block being committedIOException
- if an I/O error occurspublic long getId(NetAddress address) throws IOException
address
- the net address to get a worker id forIOException
- if an I/O error occurspublic Command heartbeat(long workerId, List<Long> usedBytesOnTiers, List<Long> removedBlocks, Map<Long,List<Long>> addedBlocks) throws IOException
workerId
- the worker idusedBytesOnTiers
- a list of used bytes on each tierremovedBlocks
- a list of block removed from this workeraddedBlocks
- the added blocks for each storage dir. It maps storage dir id, to a list of
added block for that storage dir.IOException
- if an I/O error occurspublic void register(long workerId, List<Long> totalBytesOnTiers, List<Long> usedBytesOnTiers, Map<Long,List<Long>> currentBlocksOnTiers) throws IOException
workerId
- the worker id of the worker registeringtotalBytesOnTiers
- list of total bytes on each tierusedBytesOnTiers
- list of the used byes on each tiercurrentBlocksOnTiers
- a mapping of each storage dir, to all the blocks on that storage
dirIOException
- if an I/O error occurs or the workerId doesn't existCopyright © 2015. All Rights Reserved.