@ThreadSafe public class BlockMasterClient extends AbstractMasterClient
AbstractClient.RpcCallable<V>
mAddress, mChannel, mClosed, mConnected, mContext, mServiceVersion, mVersionService
Constructor and Description |
---|
BlockMasterClient(MasterClientContext conf)
Creates a new instance of
BlockMasterClient for the worker. |
Modifier and Type | Method and Description |
---|---|
protected void |
afterConnect()
This method is called after the connection is made to the remote.
|
void |
commitBlock(long workerId,
long usedBytesOnTier,
String tierAlias,
String mediumType,
long blockId,
long length)
Commits a block on a worker.
|
void |
commitBlockInUfs(long blockId,
long length)
Commits a block in Ufs.
|
List<LocationBlockIdListEntry> |
convertBlockListMapToProto(Map<BlockStoreLocation,List<Long>> blockListOnLocation)
Converts the block list map to a proto list.
|
long |
getId(WorkerNetAddress address)
Returns a worker id for a workers net address.
|
protected ServiceType |
getRemoteServiceType() |
protected String |
getServiceName() |
protected long |
getServiceVersion() |
Command |
heartbeat(long workerId,
Map<String,Long> capacityBytesOnTiers,
Map<String,Long> usedBytesOnTiers,
List<Long> removedBlocks,
Map<BlockStoreLocation,List<Long>> addedBlocks,
Map<String,List<String>> lostStorage,
List<Metric> metrics)
The method the worker should periodically execute to heartbeat back to the master.
|
void |
register(long workerId,
List<String> storageTierAliases,
Map<String,Long> totalBytesOnTiers,
Map<String,Long> usedBytesOnTiers,
Map<BlockStoreLocation,List<Long>> currentBlocksOnLocation,
Map<String,List<String>> lostStorage,
List<ConfigProperty> configList)
The method the worker should execute to register with the block master.
|
getAddress, getConfAddress
afterDisconnect, beforeConnect, beforeDisconnect, checkVersion, close, connect, disconnect, getRemoteServiceVersion, isClosed, isConnected, retryRPC, retryRPC
public BlockMasterClient(MasterClientContext conf)
BlockMasterClient
for the worker.conf
- master client configurationprotected ServiceType getRemoteServiceType()
getRemoteServiceType
in class AbstractClient
protected String getServiceName()
getServiceName
in class AbstractClient
protected long getServiceVersion()
getServiceVersion
in class AbstractClient
protected void afterConnect() throws IOException
AbstractClient
afterConnect
in class AbstractClient
IOException
public void commitBlock(long workerId, long usedBytesOnTier, String tierAlias, String mediumType, 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 totierAlias
- the alias of the tier the block is being committed tomediumType
- the medium type the block is being committed toblockId
- the block id being committedlength
- the length of the block being committedIOException
public void commitBlockInUfs(long blockId, long length) throws IOException
blockId
- the block id being committedlength
- the length of the block being committedIOException
public long getId(WorkerNetAddress address) throws IOException
address
- the net address to get a worker id forIOException
public List<LocationBlockIdListEntry> convertBlockListMapToProto(Map<BlockStoreLocation,List<Long>> blockListOnLocation)
LocationBlockIdListEntry
instances shall have the same BlockStoreLocationProto
.
The uniqueness of BlockStoreLocationProto
is determined by tier alias and medium type.
That means directories with the same tier alias and medium type will be merged into the same
LocationBlockIdListEntry
.blockListOnLocation
- a map from block location to the block listpublic Command heartbeat(long workerId, Map<String,Long> capacityBytesOnTiers, Map<String,Long> usedBytesOnTiers, List<Long> removedBlocks, Map<BlockStoreLocation,List<Long>> addedBlocks, Map<String,List<String>> lostStorage, List<Metric> metrics) throws IOException
workerId
- the worker idcapacityBytesOnTiers
- a mapping from storage tier alias to capacity bytesusedBytesOnTiers
- a mapping from storage tier alias to used bytesremovedBlocks
- a list of block removed from this workeraddedBlocks
- a mapping from storage tier alias to added blockslostStorage
- a mapping from storage tier alias to a list of lost storage pathsmetrics
- a list of worker metricsIOException
public void register(long workerId, List<String> storageTierAliases, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Map<BlockStoreLocation,List<Long>> currentBlocksOnLocation, Map<String,List<String>> lostStorage, List<ConfigProperty> configList) throws IOException
workerId
- the worker id of the worker registeringstorageTierAliases
- a list of storage tier aliases in ordinal ordertotalBytesOnTiers
- mapping from storage tier alias to total bytesusedBytesOnTiers
- mapping from storage tier alias to used bytescurrentBlocksOnLocation
- mapping from storage tier alias to the list of list of blockslostStorage
- mapping from storage tier alias to the list of lost storage pathsconfigList
- a list of configurationsIOException
Copyright © 2023. All Rights Reserved.