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
- IOException
public void accessBlock(long blockId) throws IOException
blockId
- The id of the blockIOException
public void addCheckpoint(int fileId) throws IOException
fileId
- The id of the checkpointed fileIOException
public boolean asyncCheckpoint(int fid) throws IOException
fid
- The id of the fileIOException
public void cacheBlock(long blockId) throws IOException
blockId
- The id of the blockIOException
public void cancelBlock(long blockId) throws IOException
blockId
- The Id of the block to be cancelledIOException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public InetSocketAddress getAddress()
public String getUserUfsTempFolder() throws IOException
IOException
public boolean isConnected()
public boolean isLocal()
public String lockBlock(long blockId) throws IOException
blockId
- The id of the blockIOException
public void mustConnect() throws IOException
IOException
public boolean promoteBlock(long blockId) throws IOException
blockId
- The id of the block that will be promotedIOException
public String requestBlockLocation(long blockId, long initialBytes) throws IOException
blockId
- The id of the blockinitialBytes
- The initial size bytes allocated for the blockIOException
public boolean requestSpace(long blockId, long requestBytes) throws IOException
blockId
- The id of the blockrequestBytes
- The requested space size, in bytesIOException
public boolean unlockBlock(long blockId) throws IOException
blockId
- The id of the blockIOException
public void userHeartbeat(long userId) throws IOException
userId
- The id of the userIOException
Copyright © 2015. All Rights Reserved.