public class TachyonFS extends Object
Modifier and Type | Method and Description |
---|---|
void |
cacheBlock(long blockId)
Notify the worker the block is cached.
|
void |
close()
Close the client.
|
int |
createDependency(List<String> parents,
List<String> children,
String commandPrefix,
List<ByteBuffer> data,
String comment,
String framework,
String frameworkVersion,
int dependencyType,
long childrenBlockSizeByte)
Create a Dependency
|
int |
createFile(String path)
Create a file with the default block size (1GB) in the system.
|
int |
createFile(String path,
long blockSizeByte)
Create a file in the system.
|
int |
createFile(String path,
String underfsPath)
Create a file in the system with a pre-defined underfsPath.
|
int |
createRawTable(String path,
int columns)
Create a RawTable and return its id
|
int |
createRawTable(String path,
int columns,
ByteBuffer metadata)
Create a RawTable and return its id
|
boolean |
delete(int fid,
boolean recursive)
Delete the file denoted by the file id.
|
boolean |
delete(String path,
boolean recursive)
Delete the file denoted by the path.
|
boolean |
exist(String path)
Return whether the file exists or not
|
static TachyonFS |
get(String tachyonPath)
Create a TachyonFS handler.
|
long |
getBlockId(int fId,
int blockIndex)
Get the block id by the file id and block index.
|
int |
getBlockLockId() |
long |
getBlockSizeByte(int fId) |
ClientBlockInfo |
getClientBlockInfo(int fId,
int blockIndex)
Get a ClientBlockInfo by the file id and block index
|
ClientDependencyInfo |
getClientDependencyInfo(int did)
Get a ClientDependencyInfo by the dependency id
|
long |
getCreationTimeMs(int fId)
Get the creation time of the file
|
TachyonFile |
getFile(int fid)
Get
TachyonFile based on the file id. |
TachyonFile |
getFile(int fid,
boolean useCachedMetadata)
Get
TachyonFile based on the file id. |
TachyonFile |
getFile(String path)
Get
TachyonFile based on the path. |
TachyonFile |
getFile(String path,
boolean useCachedMetadata)
Get
TachyonFile based on the path. |
List<Long> |
getFileBlockIdList(int fId)
Get all the blocks' ids of the file
|
List<ClientBlockInfo> |
getFileBlocks(int fid)
Get all the blocks' info of the file
|
List<String> |
getFileHosts(int fileId)
Get the net address of all the file's hosts
|
int |
getFileId(String path)
Get file id by the path.
|
List<NetAddress> |
getFileNetAddresses(int fileId) |
List<List<String>> |
getFilesHosts(List<Integer> fileIds) |
List<List<NetAddress>> |
getFilesNetAddresses(List<Integer> fileIds) |
int |
getNumberOfFiles(String path)
Get the number of the files under the folder.
|
RawTable |
getRawTable(int id)
Get the RawTable by id
|
RawTable |
getRawTable(String path)
Get the RawTable by path
|
String |
getUnderfsAddress() |
List<ClientWorkerInfo> |
getWorkersInfo() |
boolean |
hasLocalWorker() |
boolean |
isConnected() |
boolean |
isPinned(int fid,
boolean useCachedMetadata)
Returns true if the given file or folder has its "pinned" flag set.
|
List<Integer> |
listFiles(String path,
boolean recursive)
List the files under the given path.
|
List<ClientFileInfo> |
listStatus(String path)
If the
path is a directory, return all the direct entries in it. |
List<String> |
ls(String path,
boolean recursive)
Return a list of files/directories under the given path.
|
boolean |
mkdir(String path)
Create a directory if it does not exist.
|
void |
outOfMemoryForPinFile(int fid)
Tell master that out of memory when pin file
|
void |
pinFile(int fid)
Alias for setPinned(fid, true).
|
void |
releaseSpace(long releaseSpaceBytes) |
boolean |
rename(int fId,
String path)
Rename the file
|
boolean |
rename(String srcPath,
String dstPath)
Rename the srcPath to the dstPath
|
void |
reportLostFile(int fileId)
Report the lost file to master
|
void |
requestFilesInDependency(int depId)
Request the dependency's needed files
|
boolean |
requestSpace(long requestSpaceBytes)
Try to request space from worker.
|
void |
setPinned(int fid,
boolean pinned)
Sets the "pinned" flag for the given file.
|
String |
toString()
Print out the string representation of this Tachyon server address.
|
void |
unpinFile(int fid)
Alias for setPinned(fid, false).
|
void |
updateRawTableMetadata(int id,
ByteBuffer metadata)
Update the RawTable's meta data
|
public static TachyonFS get(String tachyonPath) throws IOException
tachyonPath
- a Tachyon path contains master address. e.g., tachyon://localhost:19998,
tachyon://localhost:19998/ab/c.txtIOException
public void cacheBlock(long blockId) throws IOException
blockId
- the block idIOException
public void close() throws org.apache.thrift.TException
org.apache.thrift.TException
public int createDependency(List<String> parents, List<String> children, String commandPrefix, List<ByteBuffer> data, String comment, String framework, String frameworkVersion, int dependencyType, long childrenBlockSizeByte) throws IOException
parents
- the dependency's input fileschildren
- the dependency's output filescommandPrefix
- data
- comment
- framework
- frameworkVersion
- dependencyType
- the dependency's type, Wide or NarrowchildrenBlockSizeByte
- the block size of the dependency's output filesIOException
public int createFile(String path) throws IOException
path
- the path of the fileIOException
- If file already exists, or path is invalid.public int createFile(String path, long blockSizeByte) throws IOException
path
- the path of the fileblockSizeByte
- the block size of the fileIOException
- If file already exists, or path is invalid.public int createFile(String path, String underfsPath) throws IOException
path
- the path of the file in TachyonunderfsPath
- the path of the file in the underfsIOException
- If file already exists, or path is invalid.public int createRawTable(String path, int columns) throws IOException
path
- the RawTable's pathcolumns
- number of columns it hasIOException
public int createRawTable(String path, int columns, ByteBuffer metadata) throws IOException
path
- the RawTable's pathcolumns
- number of columns it hasmetadata
- the meta data of the RawTableIOException
public boolean delete(int fid, boolean recursive) throws IOException
fid
- file idrecursive
- if delete the path recursively.IOException
public boolean delete(String path, boolean recursive) throws IOException
path
- the file pathrecursive
- if delete the path recursively.IOException
public boolean exist(String path) throws IOException
path
- the file's path in Tachyon file systemIOException
public long getBlockId(int fId, int blockIndex) throws IOException
fId
- the file idblockIndex
- The index of the block in the file.IOException
- if the file does not exist, or connection issue.public int getBlockLockId()
public long getBlockSizeByte(int fId)
fId
- the file idpublic ClientBlockInfo getClientBlockInfo(int fId, int blockIndex) throws IOException
fId
- the file idblockIndex
- The index of the block in the file.IOException
public ClientDependencyInfo getClientDependencyInfo(int did) throws IOException
did
- the dependency idIOException
public long getCreationTimeMs(int fId)
fId
- the file idpublic TachyonFile getFile(int fid) throws IOException
TachyonFile
based on the file id.
NOTE: This *will* use cached file metadata, and so will not see changes to dynamic properties,
such as the pinned flag. This is also different from the behavior of getFile(path), which
by default will not use cached metadata.fid
- file id.IOException
public TachyonFile getFile(int fid, boolean useCachedMetadata) throws IOException
TachyonFile
based on the file id. If useCachedMetadata, this will not see
changes to the file's pin setting, or other dynamic properties.IOException
public TachyonFile getFile(String path) throws IOException
TachyonFile
based on the path. Does not utilize the file metadata cache.path
- file path.IOException
public TachyonFile getFile(String path, boolean useCachedMetadata) throws IOException
TachyonFile
based on the path. If useCachedMetadata, this will not see
changes to the file's pin setting, or other dynamic properties.IOException
public List<Long> getFileBlockIdList(int fId) throws IOException
fId
- the file idIOException
public List<ClientBlockInfo> getFileBlocks(int fid) throws IOException
fid
- the file idIOException
public List<String> getFileHosts(int fileId) throws IOException
fileId
- the file idIOException
public int getFileId(String path) throws IOException
path
- the path in Tachyon file systemIOException
public List<NetAddress> getFileNetAddresses(int fileId) throws IOException
IOException
public List<List<String>> getFilesHosts(List<Integer> fileIds) throws IOException
IOException
public List<List<NetAddress>> getFilesNetAddresses(List<Integer> fileIds) throws IOException
IOException
public int getNumberOfFiles(String path) throws IOException
path
- the path in Tachyon file systemIOException
public RawTable getRawTable(int id) throws IOException
id
- the id of the raw tableIOException
public RawTable getRawTable(String path) throws IOException
path
- the path of the raw tableIOException
public String getUnderfsAddress() throws IOException
IOException
public List<ClientWorkerInfo> getWorkersInfo() throws IOException
IOException
public boolean hasLocalWorker() throws IOException
IOException
public boolean isConnected()
public List<Integer> listFiles(String path, boolean recursive) throws IOException
recursive
is
truepath
- the path in Tachyon file systemrecursive
- if true list the files recursivelyIOException
public List<ClientFileInfo> listStatus(String path) throws IOException
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 pathIOException
public List<String> ls(String path, boolean recursive) throws IOException
path
- the path in the TFS.recursive
- whether or not to list files/directories under path recursively.IOException
- if some TException is thrown when trying to read content of path.public boolean mkdir(String path) throws IOException
path
- Directory path.IOException
public void outOfMemoryForPinFile(int fid) throws IOException
fid
- the file idIOException
public void releaseSpace(long releaseSpaceBytes)
public boolean rename(int fId, String path) throws IOException
fId
- the file idpath
- the new path of the file in Tachyon file systemIOException
public boolean rename(String srcPath, String dstPath) throws IOException
srcPath
- dstPath
- IOException
public void reportLostFile(int fileId) throws IOException
fileId
- the lost file idIOException
public void requestFilesInDependency(int depId) throws IOException
depId
- the dependency idIOException
public boolean requestSpace(long requestSpaceBytes) throws IOException
requestSpaceBytes
- the space size in bytesIOException
public String toString()
public void setPinned(int fid, boolean pinned) throws IOException
IOException
public void pinFile(int fid) throws IOException
IOException
public void unpinFile(int fid) throws IOException
IOException
public boolean isPinned(int fid, boolean useCachedMetadata) throws IOException
IOException
public void updateRawTableMetadata(int id, ByteBuffer metadata) throws IOException
id
- the raw table's idmetadata
- the new meta dataIOException
Copyright © 2014. All rights reserved.