public final class WorkerClient extends Object implements Closeable
| Constructor and Description |
|---|
WorkerClient(NetAddress workerNetAddress,
ExecutorService executorService,
TachyonConf conf,
long sessionId,
boolean isLocal,
ClientMetrics clientMetrics)
Creates a WorkerClient.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accessBlock(long blockId)
Updates the latest block access time on the worker.
|
boolean |
asyncCheckpoint(long fileId)
Notifies the worker to checkpoint the file asynchronously.
|
void |
cacheBlock(long blockId)
Notifies the worker the block is cached.
|
void |
cancelBlock(long blockId)
Notifies worker that the block has been cancelled
|
void |
close()
Closes the connection to worker.
|
void |
createNewSession(long newSessionId)
Updates the session id of the client, starting a new session.
|
InetSocketAddress |
getAddress() |
InetSocketAddress |
getDataServerAddress() |
long |
getSessionId() |
boolean |
isConnected() |
boolean |
isLocal() |
String |
lockBlock(long blockId)
Locks the block, therefore, the worker will not evict the block from the memory until it is
unlocked.
|
void |
mustConnect()
Connects to the worker.
|
void |
periodicHeartbeat()
Called only by
WorkerClientHeartbeatExecutor, encapsulates
sessionHeartbeat() in order to cancel and cleanup the
heartbeating thread in case of failures |
void |
persistFile(long fileId,
long nonce,
String path)
Notifies the worker that a file has been persisted in a temporary UFS location.
|
boolean |
promoteBlock(long blockId)
Promotes block back to the top StorageTier
|
String |
requestBlockLocation(long blockId,
long initialBytes)
Gets temporary path for the block from the worker
|
boolean |
requestSpace(long blockId,
long requestBytes)
Requests space for some block from worker
|
void |
sessionHeartbeat()
Sends a session heartbeat to the worker.
|
boolean |
unlockBlock(long blockId)
Unlocks the block
|
public WorkerClient(NetAddress workerNetAddress, ExecutorService executorService, TachyonConf conf, long sessionId, boolean isLocal, ClientMetrics clientMetrics)
workerNetAddress - to worker's locationexecutorService - the executor serviceconf - Tachyon configurationclientMetrics - metrics of the lcient.public void accessBlock(long blockId)
throws IOException
blockId - The id of the blockIOExceptionpublic void persistFile(long fileId,
long nonce,
String path)
throws IOException
fileId - the file idnonce - nonce a nonce used for temporary file creationpath - the UFS path where the file should be eventually storedIOExceptionpublic boolean asyncCheckpoint(long fileId)
throws IOException
fileId - 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 void createNewSession(long newSessionId)
newSessionId - the new id that represents the new sessionpublic InetSocketAddress getAddress()
public InetSocketAddress getDataServerAddress()
public long getSessionId()
public 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 sessionHeartbeat()
throws IOException
IOException - if an error occurs during the heartbeatpublic void periodicHeartbeat()
WorkerClientHeartbeatExecutor, encapsulates
sessionHeartbeat() in order to cancel and cleanup the
heartbeating thread in case of failuresCopyright © 2015. All Rights Reserved.