public class WorkerClient extends Object implements Closeable
| Constructor and Description |
|---|
WorkerClient(MasterClient masterClient,
ExecutorService executorService)
Create a WorkerClient, with a given MasterClient.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accessBlock(long blockId)
Update the latest block access time on the worker.
|
void |
addCheckpoint(int fileId)
Notify the worker that the checkpoint file of the file has been added.
|
boolean |
asyncCheckpoint(int fid)
Notify the worker to checkpoint the file asynchronously.
|
void |
cacheBlock(long blockId)
Notify the worker the block is cached.
|
void |
cancelBlock(long blockId)
Notify worker that the block has been cancelled
|
void |
close()
Close the connection to worker.
|
InetSocketAddress |
getAddress() |
String |
getUserUfsTempFolder()
Get the user temporary folder in the under file system of the specified user.
|
boolean |
isConnected() |
boolean |
isLocal() |
String |
lockBlock(long blockId)
Lock the block, therefore, the worker will not evict the block from the memory until it is
unlocked.
|
void |
mustConnect()
Connect to the worker.
|
boolean |
promoteBlock(long blockId)
Promote block back to the top StorageTier
|
String |
requestBlockLocation(long blockId,
long initialBytes)
Get temporary path for the block from the worker
|
boolean |
requestSpace(long blockId,
long requestBytes)
Request space for some block from worker
|
boolean |
unlockBlock(long blockId)
Unlock the block
|
void |
userHeartbeat(long userId)
Users' heartbeat to the Worker.
|
public WorkerClient(MasterClient masterClient, ExecutorService executorService) throws IOException
masterClient - executorService - IOExceptionpublic void accessBlock(long blockId)
throws IOException
blockId - The id of the blockIOExceptionpublic void addCheckpoint(int fileId)
throws IOException
fileId - The id of the checkpointed fileIOExceptionpublic boolean asyncCheckpoint(int fid)
throws IOException
fid - The id of the fileIOExceptionpublic void cacheBlock(long blockId)
throws IOException
blockId - The id of the blockIOExceptionpublic void cancelBlock(long blockId)
throws IOException
blockId - The Id of the block to be cancelledIOExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic InetSocketAddress getAddress()
public String getUserUfsTempFolder() throws IOException
IOExceptionpublic boolean isConnected()
public boolean isLocal()
public String lockBlock(long blockId) throws IOException
blockId - The id of the blockIOExceptionpublic void mustConnect()
throws IOException
IOExceptionpublic boolean promoteBlock(long blockId)
throws IOException
blockId - The id of the block that will be promotedIOExceptionpublic String requestBlockLocation(long blockId, long initialBytes) throws IOException
blockId - The id of the blockinitialBytes - The initial size bytes allocated for the blockIOExceptionpublic boolean requestSpace(long blockId,
long requestBytes)
throws IOException
blockId - The id of the blockrequestBytes - The requested space size, in bytesIOExceptionpublic boolean unlockBlock(long blockId)
throws IOException
blockId - The id of the blockIOExceptionpublic void userHeartbeat(long userId)
throws IOException
userId - The id of the userIOExceptionCopyright © 2015. All Rights Reserved.