public class MasterInfo extends ImageWriter
Modifier and Type | Class and Description |
---|---|
class |
MasterInfo.MasterInfoHeartbeatExecutor
Master info periodical status check.
|
class |
MasterInfo.RecomputationScheduler |
Constructor and Description |
---|
MasterInfo(InetSocketAddress address,
Journal journal,
ExecutorService mExecutorService) |
Modifier and Type | Method and Description |
---|---|
ClientRawTableInfo |
_getClientRawTableInfo(TachyonURI path,
Inode inode)
Get the raw table info associated with the given id.
|
boolean |
_rename(int fileId,
TachyonURI dstPath,
long opTimeMs)
Rename a file to the given path, inner method.
|
boolean |
addCheckpoint(long workerId,
int fileId,
long length,
TachyonURI checkpointPath)
Add a checkpoint to a file.
|
int |
cacheBlock(long workerId,
long workerUsedBytes,
long storageDirId,
long blockId,
long length)
A worker cache a block in its memory.
|
void |
completeFile(int fileId)
Completes the checkpointing of a file.
|
int |
createDependency(List<TachyonURI> parents,
List<TachyonURI> children,
String commandPrefix,
List<ByteBuffer> data,
String comment,
String framework,
String frameworkVersion,
DependencyType dependencyType) |
int |
createFile(boolean recursive,
TachyonURI path,
boolean directory,
long blockSizeByte)
Create a file.
|
int |
createFile(TachyonURI path,
long blockSizeByte) |
int |
createFile(TachyonURI path,
long blockSizeByte,
boolean recursive) |
long |
createNewBlock(int fileId)
Creates a new block for the given file.
|
int |
createRawTable(TachyonURI path,
int columns,
ByteBuffer metadata)
Creates a raw table.
|
boolean |
delete(int fileId,
boolean recursive)
Delete a file based on the file's ID.
|
boolean |
delete(TachyonURI path,
boolean recursive)
Delete files based on the path.
|
boolean |
freepath(TachyonURI path,
boolean recursive)
Frees files based on the path
|
long |
getBlockIdBasedOnOffset(int fileId,
long offset) |
List<BlockInfo> |
getBlockList(TachyonURI path)
Get the list of blocks of an InodeFile determined by path.
|
long |
getCapacityBytes()
Get the capacity of the whole system.
|
ClientBlockInfo |
getClientBlockInfo(long blockId)
Get the block info associated with the given id.
|
ClientDependencyInfo |
getClientDependencyInfo(int dependencyId)
Get the dependency info associated with the given id.
|
ClientFileInfo |
getClientFileInfo(int fid)
Get the file info associated with the given id.
|
ClientFileInfo |
getClientFileInfo(TachyonURI path)
Get the file info for the file at the given path
|
ClientRawTableInfo |
getClientRawTableInfo(int id)
Get the raw table info associated with the given id.
|
ClientRawTableInfo |
getClientRawTableInfo(TachyonURI path)
Get the raw table info for the table at the given path
|
List<ClientBlockInfo> |
getFileBlocks(int fileId)
Get the block infos of a file with the given id.
|
List<ClientBlockInfo> |
getFileBlocks(TachyonURI path)
Get the block infos of a file with the given path.
|
int |
getFileId(TachyonURI path)
Get the file id of the file.
|
List<ClientFileInfo> |
getFilesInfo(TachyonURI path)
If the
path is a directory, return all the direct entries in it. |
List<TachyonURI> |
getInMemoryFiles()
Get absolute paths of all in memory files.
|
Journal |
getJournal()
Get Journal instance for MasterInfo for Unit test only
|
List<ClientWorkerInfo> |
getLostWorkersInfo()
Get info about the lost workers
|
InetSocketAddress |
getMasterAddress()
Get the master address.
|
long |
getNewUserId()
Get a new user id
|
int |
getNumberOfFiles(TachyonURI path)
Get the number of files at a given path.
|
TachyonURI |
getPath(int fileId)
Get the path of a file with the given id
|
List<Integer> |
getPinIdList()
Get a list of the pin id's.
|
List<Integer> |
getPriorityDependencyList()
Creates a list of high priority dependencies, which don't yet have checkpoints.
|
int |
getRawTableId(TachyonURI path)
Get the id of the table at the given path.
|
long |
getStarttimeMs()
Get the master start time in milliseconds.
|
long |
getUnderFsCapacityBytes()
Get the capacity of the under file system.
|
long |
getUnderFsFreeBytes()
Get the amount of free space in the under file system.
|
long |
getUnderFsUsedBytes()
Get the amount of space used in the under file system.
|
long |
getUsedBytes()
Get the amount of space used by the workers.
|
List<String> |
getWhiteList()
Get the white list.
|
NetAddress |
getWorker(boolean random,
String host)
Get the address of a worker.
|
int |
getWorkerCount()
Get the number of workers.
|
List<ClientWorkerInfo> |
getWorkersInfo()
Get info about all the workers.
|
void |
init() |
List<Integer> |
listFiles(TachyonURI path,
boolean recursive)
Get the id of the file at the given path.
|
void |
loadImage(com.fasterxml.jackson.core.JsonParser parser,
TachyonURI path)
Load the image from
parser , which is created based on the path . |
List<TachyonURI> |
ls(TachyonURI path,
boolean recursive)
Get the names of the sub-directories at the given path.
|
boolean |
mkdirs(TachyonURI path,
boolean recursive)
Create a directory at the given path.
|
long |
registerWorker(NetAddress workerNetAddress,
long totalBytes,
long usedBytes,
Map<Long,List<Long>> currentBlockIds)
Register a worker at the given address, setting it up and associating it with a given list of
blocks.
|
boolean |
rename(int fileId,
TachyonURI dstPath)
Rename a file to the given path.
|
boolean |
rename(TachyonURI srcPath,
TachyonURI dstPath)
Rename a file to the given path.
|
void |
reportLostFile(int fileId)
Logs a lost file and sets it to be recovered.
|
void |
requestFilesInDependency(int depId)
Request that the files for the given dependency be recomputed.
|
void |
setPinned(int fileId,
boolean pinned)
Sets the isPinned flag on the given inode and all of its children.
|
void |
stop()
Stops the heartbeat thread.
|
void |
updateRawTableMetadata(int tableId,
ByteBuffer metadata)
Update the metadata of a table.
|
Command |
workerHeartbeat(long workerId,
long usedBytes,
List<Long> removedBlockIds,
Map<Long,List<Long>> addedBlockIds)
The heartbeat of the worker.
|
void |
writeImage(com.fasterxml.jackson.databind.ObjectWriter objWriter,
DataOutputStream dos)
Create an image of the dependencies and filesystem tree.
|
writeElement
public static final String COL
public MasterInfo(InetSocketAddress address, Journal journal, ExecutorService mExecutorService) throws IOException
IOException
public ClientRawTableInfo _getClientRawTableInfo(TachyonURI path, Inode inode) throws TableDoesNotExistException
path
- The path of the tableinode
- The inode at the pathTableDoesNotExistException
public boolean _rename(int fileId, TachyonURI dstPath, long opTimeMs) throws FileDoesNotExistException, InvalidPathException
fileId
- The id of the file to renamedstPath
- The new path of the fileopTimeMs
- The time of the rename operation, in millisecondsFileDoesNotExistException
- If the id doesn't point to an inodeInvalidPathException
- if the source path is a prefix of the destinationpublic boolean addCheckpoint(long workerId, int fileId, long length, TachyonURI checkpointPath) throws FileNotFoundException, SuspectedFileSizeException, BlockInfoException
workerId
- The worker which submitted the request. -1 if the request is not from a worker.fileId
- The file to add the checkpoint.length
- The length of the checkpoint.checkpointPath
- The path of the checkpoint.FileNotFoundException
SuspectedFileSizeException
BlockInfoException
public int cacheBlock(long workerId, long workerUsedBytes, long storageDirId, long blockId, long length) throws FileDoesNotExistException, SuspectedFileSizeException, BlockInfoException
workerId
- workerUsedBytes
- blockId
- length
- FileDoesNotExistException
SuspectedFileSizeException
BlockInfoException
public void completeFile(int fileId) throws FileDoesNotExistException
fileId
- The id of the fileFileDoesNotExistException
public int createDependency(List<TachyonURI> parents, List<TachyonURI> children, String commandPrefix, List<ByteBuffer> data, String comment, String framework, String frameworkVersion, DependencyType dependencyType) throws InvalidPathException, FileDoesNotExistException
public int createFile(boolean recursive, TachyonURI path, boolean directory, long blockSizeByte) throws FileAlreadyExistException, InvalidPathException, BlockInfoException, TachyonException
public int createFile(TachyonURI path, long blockSizeByte) throws FileAlreadyExistException, InvalidPathException, BlockInfoException, TachyonException
public int createFile(TachyonURI path, long blockSizeByte, boolean recursive) throws FileAlreadyExistException, InvalidPathException, BlockInfoException, TachyonException
public long createNewBlock(int fileId) throws FileDoesNotExistException
fileId
- The id of the fileFileDoesNotExistException
public int createRawTable(TachyonURI path, int columns, ByteBuffer metadata) throws FileAlreadyExistException, InvalidPathException, TableColumnException, TachyonException
path
- The path to place the table atcolumns
- The number of columns in the tablemetadata
- Additional metadata about the tableFileAlreadyExistException
InvalidPathException
TableColumnException
TachyonException
public boolean delete(int fileId, boolean recursive) throws TachyonException
fileId
- the file to be deleted.recursive
- whether delete the file recursively or not.TachyonException
public boolean delete(TachyonURI path, boolean recursive) throws TachyonException
path
- The file to be deleted.recursive
- whether delete the file recursively or not.TachyonException
public long getBlockIdBasedOnOffset(int fileId, long offset) throws FileDoesNotExistException
FileDoesNotExistException
public List<BlockInfo> getBlockList(TachyonURI path) throws InvalidPathException, FileDoesNotExistException
path
- The file.InvalidPathException
FileDoesNotExistException
public long getCapacityBytes()
public ClientBlockInfo getClientBlockInfo(long blockId) throws FileDoesNotExistException, BlockInfoException
blockId
- The id of the block returnFileDoesNotExistException
BlockInfoException
public ClientDependencyInfo getClientDependencyInfo(int dependencyId) throws DependencyDoesNotExistException
dependencyId
- The id of the dependencyDependencyDoesNotExistException
public ClientFileInfo getClientFileInfo(int fid)
fid
- The id of the filepublic ClientFileInfo getClientFileInfo(TachyonURI path) throws InvalidPathException
path
- The path of the fileInvalidPathException
public ClientRawTableInfo getClientRawTableInfo(int id) throws TableDoesNotExistException
id
- The id of the tableTableDoesNotExistException
public ClientRawTableInfo getClientRawTableInfo(TachyonURI path) throws TableDoesNotExistException, InvalidPathException
path
- The path of the tableTableDoesNotExistException
InvalidPathException
public int getFileId(TachyonURI path) throws InvalidPathException
path
- The path of the fileInvalidPathException
public List<ClientBlockInfo> getFileBlocks(int fileId) throws FileDoesNotExistException
fileId
- The id of the file to look upFileDoesNotExistException
public List<ClientBlockInfo> getFileBlocks(TachyonURI path) throws FileDoesNotExistException, InvalidPathException
path
- The path of the file to look upFileDoesNotExistException
InvalidPathException
public List<ClientFileInfo> getFilesInfo(TachyonURI path) throws FileDoesNotExistException, InvalidPathException
path
is a directory, return all the direct entries in it. If the
path
is a file, return its ClientFileInfo.path
- the target directory/file pathFileDoesNotExistException
InvalidPathException
public List<TachyonURI> getInMemoryFiles()
public Journal getJournal()
public InetSocketAddress getMasterAddress()
public long getNewUserId()
public int getNumberOfFiles(TachyonURI path) throws InvalidPathException, FileDoesNotExistException
path
- The path to look atInvalidPathException
FileDoesNotExistException
public TachyonURI getPath(int fileId) throws FileDoesNotExistException
fileId
- The id of the file to look upFileDoesNotExistException
- raise if the file does not exist.public List<Integer> getPinIdList()
public List<Integer> getPriorityDependencyList()
public int getRawTableId(TachyonURI path) throws InvalidPathException, TableDoesNotExistException
path
- The path of the tableInvalidPathException
TableDoesNotExistException
public long getStarttimeMs()
public long getUnderFsCapacityBytes() throws IOException
IOException
public long getUnderFsFreeBytes() throws IOException
IOException
public long getUnderFsUsedBytes() throws IOException
IOException
public long getUsedBytes()
public NetAddress getWorker(boolean random, String host) throws UnknownHostException
random
- If true, select a random workerhost
- If random
is false, select a worker on this hostUnknownHostException
public int getWorkerCount()
public List<ClientWorkerInfo> getWorkersInfo()
public List<ClientWorkerInfo> getLostWorkersInfo()
public void init() throws IOException
IOException
public List<Integer> listFiles(TachyonURI path, boolean recursive) throws InvalidPathException, FileDoesNotExistException
path
- The path to start looking atrecursive
- If true, recursively scan the subdirectories at the given path as wellInvalidPathException
FileDoesNotExistException
public void loadImage(com.fasterxml.jackson.core.JsonParser parser, TachyonURI path) throws IOException
parser
, which is created based on the path
.
Assume this blocks the whole MasterInfo.parser
- the JsonParser to load the imagepath
- the file to load the imageIOException
public List<TachyonURI> ls(TachyonURI path, boolean recursive) throws InvalidPathException, FileDoesNotExistException
path
- The path to look atrecursive
- If true, recursively add the paths of the sub-directoriesInvalidPathException
FileDoesNotExistException
public boolean mkdirs(TachyonURI path, boolean recursive) throws FileAlreadyExistException, InvalidPathException, TachyonException
path
- The path to create a directory atFileAlreadyExistException
InvalidPathException
TachyonException
public long registerWorker(NetAddress workerNetAddress, long totalBytes, long usedBytes, Map<Long,List<Long>> currentBlockIds) throws BlockInfoException
workerNetAddress
- The address of the worker to registertotalBytes
- The capacity of the worker in bytesusedBytes
- The number of bytes already used in the workercurrentBlockIds
- Mapping from id of the StorageDir to id list of the blocksBlockInfoException
public boolean rename(int fileId, TachyonURI dstPath) throws FileDoesNotExistException, InvalidPathException
fileId
- The id of the file to renamedstPath
- The new path of the fileFileDoesNotExistException
InvalidPathException
public boolean rename(TachyonURI srcPath, TachyonURI dstPath) throws FileDoesNotExistException, InvalidPathException
srcPath
- The path of the file to renamedstPath
- The new path of the fileFileDoesNotExistException
InvalidPathException
public void reportLostFile(int fileId)
fileId
- The id of the file to be recoveredpublic void requestFilesInDependency(int depId)
depId
- The dependency whose files are to be recomputedpublic void setPinned(int fileId, boolean pinned) throws FileDoesNotExistException
FileDoesNotExistException
public boolean freepath(TachyonURI path, boolean recursive) throws TachyonException
path
- The file to be freed.recursive
- whether delete the file recursively or not.TachyonException
public void stop()
public void updateRawTableMetadata(int tableId, ByteBuffer metadata) throws TableDoesNotExistException, TachyonException
tableId
- The id of the table to updatemetadata
- The new metadata to update the table withTableDoesNotExistException
TachyonException
public Command workerHeartbeat(long workerId, long usedBytes, List<Long> removedBlockIds, Map<Long,List<Long>> addedBlockIds) throws BlockInfoException
workerId
- The id of the worker to deal withusedBytes
- The number of bytes used in the workerremovedBlockIds
- The list of removed block idsaddedBlockIds
- Mapping from id of the StorageDir and id list of blocks evicted inBlockInfoException
public void writeImage(com.fasterxml.jackson.databind.ObjectWriter objWriter, DataOutputStream dos) throws IOException
objWriter
- The used object writerdos
- The target data output streamIOException
Copyright © 2015. All Rights Reserved.