@NotThreadSafe public final class MasterWorkerInfo extends Object
Constructor and Description |
---|
MasterWorkerInfo(long id,
WorkerNetAddress address)
Creates a new instance of
MasterWorkerInfo . |
Modifier and Type | Method and Description |
---|---|
void |
addBlock(long blockId)
Adds a block to the worker.
|
void |
addLostStorage(Map<String,StorageList> lostStorage)
Adds new worker lost storage paths.
|
void |
addLostStorage(String tierAlias,
String dirPath)
Adds a new worker lost storage path.
|
WorkerInfo |
generateWorkerInfo(Set<GetWorkerReportOptions.WorkerInfoField> fieldRange,
boolean isLiveWorker)
Gets the selected field information for this worker.
|
long |
getAvailableBytes() |
Set<Long> |
getBlocks() |
long |
getCapacityBytes() |
Map<String,Long> |
getFreeBytesOnTiers() |
long |
getId() |
long |
getLastUpdatedTimeMs() |
Map<String,List<String>> |
getLostStorage() |
long |
getStartTime() |
StorageTierAssoc |
getStorageTierAssoc() |
List<Long> |
getToRemoveBlocks() |
Map<String,Long> |
getTotalBytesOnTiers() |
long |
getUsedBytes() |
Map<String,Long> |
getUsedBytesOnTiers() |
WorkerNetAddress |
getWorkerAddress() |
boolean |
hasLostStorage() |
boolean |
isRegistered() |
Set<Long> |
register(StorageTierAssoc globalStorageTierAssoc,
List<String> storageTierAliases,
Map<String,Long> totalBytesOnTiers,
Map<String,Long> usedBytesOnTiers,
Set<Long> blocks)
Marks the worker as registered, while updating all of its metadata.
|
void |
removeBlock(long blockId)
Removes a block from the worker.
|
String |
toString() |
void |
updateCapacityBytes(Map<String,Long> capacityBytesOnTiers)
Sets the capacity of the worker in bytes.
|
void |
updateLastUpdatedTimeMs()
Updates the last updated time of the worker in ms.
|
void |
updateToRemovedBlock(boolean add,
long blockId)
Adds or removes a block from the to-be-removed blocks set of the worker.
|
void |
updateUsedBytes(Map<String,Long> usedBytesOnTiers)
Sets the used space of the worker in bytes.
|
void |
updateUsedBytes(String tierAlias,
long usedBytesOnTier)
Sets the used space of the worker in bytes.
|
public MasterWorkerInfo(long id, WorkerNetAddress address)
MasterWorkerInfo
.id
- the worker id to useaddress
- the worker address to usepublic Set<Long> register(StorageTierAssoc globalStorageTierAssoc, List<String> storageTierAliases, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Set<Long> blocks)
globalStorageTierAssoc
- global mapping between storage aliases and ordinal positionstorageTierAliases
- list of storage tier aliases in order of their position in the
hierarchytotalBytesOnTiers
- mapping from storage tier alias to total bytesusedBytesOnTiers
- mapping from storage tier alias to used byesblocks
- set of block ids on this workerpublic void addBlock(long blockId)
blockId
- the id of the block to be addedpublic void removeBlock(long blockId)
blockId
- the id of the block to be removedpublic void addLostStorage(String tierAlias, String dirPath)
tierAlias
- the tier aliasdirPath
- the lost storage pathpublic void addLostStorage(Map<String,StorageList> lostStorage)
lostStorage
- the lost storage to addpublic WorkerInfo generateWorkerInfo(Set<GetWorkerReportOptions.WorkerInfoField> fieldRange, boolean isLiveWorker)
fieldRange
- the client selected fieldsisLiveWorker
- the worker is live or notpublic WorkerNetAddress getWorkerAddress()
public long getAvailableBytes()
public long getCapacityBytes()
public long getId()
public long getLastUpdatedTimeMs()
public List<Long> getToRemoveBlocks()
public long getUsedBytes()
public StorageTierAssoc getStorageTierAssoc()
public Map<String,Long> getTotalBytesOnTiers()
public Map<String,Long> getUsedBytesOnTiers()
public long getStartTime()
public boolean isRegistered()
public Map<String,Long> getFreeBytesOnTiers()
public Map<String,List<String>> getLostStorage()
public boolean hasLostStorage()
public void updateLastUpdatedTimeMs()
public void updateToRemovedBlock(boolean add, long blockId)
add
- true if to add, to remove otherwiseblockId
- the id of the block to be added or removedpublic void updateCapacityBytes(Map<String,Long> capacityBytesOnTiers)
capacityBytesOnTiers
- used bytes on each storage tierpublic void updateUsedBytes(Map<String,Long> usedBytesOnTiers)
usedBytesOnTiers
- used bytes on each storage tierpublic void updateUsedBytes(String tierAlias, long usedBytesOnTier)
tierAlias
- alias of storage tierusedBytesOnTier
- used bytes on certain storage tierCopyright © 2023. All Rights Reserved.