public class WorkerStorage extends Object
Modifier and Type | Class and Description |
---|---|
class |
WorkerStorage.CheckpointThread
The CheckpointThread, used to checkpoint the files belong to the worker.
|
Constructor and Description |
---|
WorkerStorage(InetSocketAddress masterAddress,
InetSocketAddress workerAddress,
String dataFolder,
long memoryCapacityBytes) |
Modifier and Type | Method and Description |
---|---|
void |
accessBlock(long blockId)
Update the latest block access time on the worker.
|
void |
addCheckpoint(long userId,
int fileId)
Add the checkpoint information of a file.
|
boolean |
asyncCheckpoint(int fileId)
Notify the worker to checkpoint the file asynchronously.
|
void |
cacheBlock(long userId,
long blockId)
Notify the worker the block is cached.
|
void |
checkStatus()
Check worker's status.
|
void |
freeBlocks(List<Long> blocks)
Remove blocks from the memory.
|
String |
getDataFolder() |
String |
getUnderfsOrphansFolder() |
String |
getUserTempFolder(long userId)
Get the local user temporary folder of the specified user.
|
String |
getUserUnderfsTempFolder(long userId)
Get the user temporary folder in the under file system of the specified user.
|
Command |
heartbeat()
Heartbeat with the TachyonMaster.
|
void |
lockBlock(long blockId,
long userId)
Lock the block
|
void |
register()
Register this TachyonWorker to the TachyonMaster
|
boolean |
requestSpace(long userId,
long requestBytes)
Request space from the worker
|
void |
resetMasterClient()
Set a new MasterClient and connect to it.
|
void |
returnSpace(long userId,
long returnedBytes)
Return the space which has been requested
|
void |
stop()
Disconnect to the Master.
|
void |
unlockBlock(long blockId,
long userId)
Unlock the block
|
void |
userHeartbeat(long userId)
Handle the user's heartbeat.
|
public WorkerStorage(InetSocketAddress masterAddress, InetSocketAddress workerAddress, String dataFolder, long memoryCapacityBytes)
masterAddress
- The TachyonMaster's addressworkerAddress
- This TachyonWorker's addressdataFolder
- This TachyonWorker's local folder's pathmemoryCapacityBytes
- The maximum memory space this TachyonWorker can use, in bytespublic void accessBlock(long blockId)
blockId
- The id of the blockpublic void addCheckpoint(long userId, int fileId) throws FileDoesNotExistException, SuspectedFileSizeException, FailedToCheckpointException, BlockInfoException, org.apache.thrift.TException
userId
.userId
- The user id of the client who send the notificationfileId
- The id of the checkpointed fileFileDoesNotExistException
SuspectedFileSizeException
FailedToCheckpointException
BlockInfoException
org.apache.thrift.TException
public boolean asyncCheckpoint(int fileId) throws IOException, org.apache.thrift.TException
fileId
- The id of the fileIOException
org.apache.thrift.TException
public void cacheBlock(long userId, long blockId) throws FileDoesNotExistException, SuspectedFileSizeException, BlockInfoException, org.apache.thrift.TException
userId
- The user id of the client who send the notificationblockId
- The id of the blockFileDoesNotExistException
SuspectedFileSizeException
BlockInfoException
org.apache.thrift.TException
public void checkStatus()
It finds the timeout users and cleans them up.
public void freeBlocks(List<Long> blocks)
blocks
- The list of blocks to be removed.public String getDataFolder() throws org.apache.thrift.TException
org.apache.thrift.TException
public String getUnderfsOrphansFolder()
public String getUserTempFolder(long userId) throws org.apache.thrift.TException
userId
- The id of the userorg.apache.thrift.TException
public String getUserUnderfsTempFolder(long userId) throws org.apache.thrift.TException
userId
- The id of the userorg.apache.thrift.TException
public Command heartbeat() throws BlockInfoException, org.apache.thrift.TException
BlockInfoException
org.apache.thrift.TException
public void lockBlock(long blockId, long userId) throws org.apache.thrift.TException
blockId
- The id of the blockuserId
- The id of the user who locks the blockorg.apache.thrift.TException
public void register()
public boolean requestSpace(long userId, long requestBytes) throws org.apache.thrift.TException
userId
- The id of the user who send the requestrequestBytes
- The requested space size, in bytesorg.apache.thrift.TException
public void resetMasterClient() throws org.apache.thrift.TException
org.apache.thrift.TException
public void returnSpace(long userId, long returnedBytes) throws org.apache.thrift.TException
userId
- The id of the user who wants to return the spacereturnedBytes
- The returned space size, in bytesorg.apache.thrift.TException
public void stop()
public void unlockBlock(long blockId, long userId) throws org.apache.thrift.TException
blockId
- The id of the blockuserId
- The id of the user who unlocks the blockorg.apache.thrift.TException
public void userHeartbeat(long userId) throws org.apache.thrift.TException
userId
- The id of the userorg.apache.thrift.TException
Copyright © 2014. All rights reserved.