public class TachyonFS extends Object
Modifier and Type | Method and Description |
---|---|
void |
cacheBlock(long blockId)
Notify the worker the block is cached.
|
void |
cancelBlock(long blockId)
Notify the worker the block is canceled.
|
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)
Deprecated.
|
int |
createFile(TachyonURI path)
Creates a file with the default block size (1GB) in the system.
|
int |
createFile(TachyonURI path,
long blockSizeByte)
Creates a file in the system.
|
int |
createFile(TachyonURI path,
TachyonURI ufsPath)
Creates a file in the system with a pre-defined underfsPath.
|
int |
createFile(TachyonURI path,
TachyonURI ufsPath,
long blockSizeByte,
boolean recursive)
Creates a new file in the file system.
|
int |
createRawTable(TachyonURI path,
int columns)
Create a RawTable and return its id
|
int |
createRawTable(TachyonURI path,
int columns,
ByteBuffer metadata)
Create a RawTable and return its id
|
boolean |
delete(int fid,
boolean recursive)
Deletes the file denoted by the file id.
|
boolean |
delete(int fileId,
TachyonURI path,
boolean recursive)
Deletes a file or folder
|
boolean |
delete(String path,
boolean recursive)
Deprecated.
|
boolean |
delete(TachyonURI path,
boolean recursive)
Deletes the file denoted by the path.
|
boolean |
exist(TachyonURI path)
Return whether the file exists or not
|
boolean |
freepath(int fileId,
TachyonURI path,
boolean recursive)
Frees in memory file or folder
|
boolean |
freepath(TachyonURI path,
boolean recursive)
Frees the in-memory blocks of file/folder denoted by the path
|
static TachyonFS |
get(String tachyonPath)
Deprecated.
|
static TachyonFS |
get(String masterHost,
int masterPort,
boolean zookeeperMode)
Create a TachyonFS handler.
|
static TachyonFS |
get(TachyonURI tachyonURI)
Create a TachyonFS handler.
|
long |
getBlockId(int fileId,
int blockIndex)
Get the block id by the file id and block index.
|
ClientDependencyInfo |
getClientDependencyInfo(int depId)
Get a ClientDependencyInfo by the dependency id
|
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)
Deprecated.
|
TachyonFile |
getFile(String path,
boolean useCachedMetadata)
Deprecated.
|
TachyonFile |
getFile(TachyonURI path)
Get
TachyonFile based on the path. |
TachyonFile |
getFile(TachyonURI path,
boolean useCachedMetadata)
Get
TachyonFile based on the path. |
List<ClientBlockInfo> |
getFileBlocks(int fid)
Get all the blocks' info of the file
|
int |
getFileId(TachyonURI path)
Get file id by the path.
|
ClientFileInfo |
getFileStatus(int fileId,
boolean useCachedMetadata)
Get ClientFileInfo object based on fileId.
|
ClientFileInfo |
getFileStatus(int fileId,
TachyonURI path) |
ClientFileInfo |
getFileStatus(int fileId,
TachyonURI path,
boolean useCachedMetadata)
Advanced API.
|
String |
getLocalBlockTemporaryPath(long blockId,
long initialBytes)
Get block's temporary path from worker with initial space allocated.
|
RawTable |
getRawTable(int id)
Get the RawTable by id
|
RawTable |
getRawTable(TachyonURI path)
Get the RawTable by path
|
String |
getUfsAddress() |
TachyonURI |
getUri() |
List<ClientWorkerInfo> |
getWorkersInfo() |
boolean |
hasLocalWorker() |
boolean |
isConnected() |
List<ClientFileInfo> |
listStatus(TachyonURI path)
If the
path is a directory, return all the direct entries in it. |
boolean |
mkdir(TachyonURI path)
Create a directory if it does not exist.
|
boolean |
mkdirs(TachyonURI path,
boolean recursive)
Creates a folder.
|
void |
pinFile(int fid)
Alias for setPinned(fid, true).
|
boolean |
promoteBlock(long blockId)
Promote block file back to the top StorageTier, after the block file is accessed.
|
boolean |
rename(int fileId,
TachyonURI dstPath)
Renames the file
|
boolean |
rename(int fileId,
TachyonURI srcPath,
TachyonURI dstPath)
Renames a file or folder to another path.
|
boolean |
rename(TachyonURI srcPath,
TachyonURI 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
|
long |
requestSpace(long blockId,
long requestSpaceBytes)
Try to request space for certain block.
|
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
|
@Deprecated 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
get(tachyon.TachyonURI)
public static TachyonFS get(TachyonURI tachyonURI) throws IOException
tachyonURI
- a Tachyon URI contains master address. e.g., tachyon://localhost:19998,
tachyon://localhost:19998/ab/c.txtIOException
public static TachyonFS get(String masterHost, int masterPort, boolean zookeeperMode) throws IOException
masterHost
- master host detailsmasterPort
- port master listens onzookeeperMode
- use zookeeperIOException
public void cacheBlock(long blockId) throws IOException
blockId
- the block idIOException
public void cancelBlock(long blockId) throws IOException
blockId
- the block idIOException
public void close() throws IOException
IOException
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(TachyonURI path, TachyonURI ufsPath, long blockSizeByte, boolean recursive) throws IOException
path
- The path of the fileufsPath
- The path of the file in the under file system. If this is empty, the file does
not exist in the under file system yet.blockSizeByte
- The size of the block in bytes. It is -1 iff ufsPath is non-empty.recursive
- Creates necessary parent folders if true, not otherwise.IOException
@Deprecated public int createFile(String path) throws IOException
path
- the path of the fileIOException
- If file already exists, or path is invalid.public int createRawTable(TachyonURI path, int columns) throws IOException
path
- the RawTable's pathcolumns
- number of columns it hasIOException
public int createRawTable(TachyonURI 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 fileId, TachyonURI path, boolean recursive) throws IOException
fileId
- The id of the file / folder. If it is not -1, path parameter is ignored.
Otherwise, the method uses the path parameter.path
- The path of the file / folder. It could be empty iff id is not -1.recursive
- If fileId or path represents a non-empty folder, delete the folder recursively
or notIOException
@Deprecated public boolean delete(String path, boolean recursive) throws IOException
path
- the file pathrecursive
- if delete the path recursively.IOException
public boolean exist(TachyonURI path) throws IOException
path
- the file's path in Tachyon file systemIOException
public long getBlockId(int fileId, int blockIndex) throws IOException
fileId
- the file idblockIndex
- The index of the block in the file.IOException
- if the file does not exist, or connection issue.public ClientDependencyInfo getClientDependencyInfo(int depId) throws IOException
depId
- the dependency idIOException
public 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(TachyonURI path) throws IOException
TachyonFile
based on the path. Does not utilize the file metadata cache.path
- file path.IOException
@Deprecated public TachyonFile getFile(String path) throws IOException
TachyonFile
based on the path. Does not utilize the file metadata cache.path
- file path.IOException
@Deprecated 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 TachyonFile getFile(TachyonURI 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<ClientBlockInfo> getFileBlocks(int fid) throws IOException
fid
- the file idIOException
public int getFileId(TachyonURI path)
path
- the path in Tachyon file systempublic ClientFileInfo getFileStatus(int fileId, TachyonURI path, boolean useCachedMetadata) throws IOException
fileId
- the file id of the file or folder.path
- the path of the file or folder. valid iff fileId is -1.useCachedMetadata
- if true use the local cached meta dataIOException
public ClientFileInfo getFileStatus(int fileId, TachyonURI path) throws IOException
IOException
public ClientFileInfo getFileStatus(int fileId, boolean useCachedMetadata) throws IOException
fileId
- the file id of the file or folder.useCachedMetadata
- if true use the local cached meta dataIOException
public String getLocalBlockTemporaryPath(long blockId, long initialBytes) throws IOException
blockId
- the id of the blockinitialBytes
- the initial bytes allocated for the block fileIOException
public RawTable getRawTable(int id) throws IOException
id
- the id of the raw tableIOException
public RawTable getRawTable(TachyonURI path) throws IOException
path
- the path of the raw tableIOException
public String getUfsAddress() throws IOException
IOException
public TachyonURI getUri()
public List<ClientWorkerInfo> getWorkersInfo() throws IOException
IOException
public boolean hasLocalWorker() throws IOException
IOException
public boolean isConnected()
public List<ClientFileInfo> listStatus(TachyonURI 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 boolean mkdirs(TachyonURI path, boolean recursive) throws IOException
path
- the path of the folder to be createdrecursive
- Creates necessary parent folders if true, not otherwise.IOException
public void pinFile(int fid) throws IOException
IOException
public boolean freepath(int fileId, TachyonURI path, boolean recursive) throws IOException
fileId
- The id of the file / folder. If it is not -1, path parameter is ignored.
Otherwise, the method uses the path parameter.path
- The path of the file / folder. It could be empty iff id is not -1.recursive
- If fileId or path represents a non-empty folder, free the folder recursively
or notIOException
public boolean promoteBlock(long blockId) throws IOException
blockId
- the id of the blockIOException
public boolean rename(int fileId, TachyonURI srcPath, TachyonURI dstPath) throws IOException
fileId
- The id of the source file / folder. If it is not -1, path parameter is ignored.
Otherwise, the method uses the srcPath parameter.srcPath
- The path of the source file / folder. It could be empty iff id is not -1.dstPath
- The path of the destination file / folder. It could be empty iff id is not -1.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 long requestSpace(long blockId, long requestSpaceBytes) throws IOException
blockId
- the id of the block that space will be allocated forrequestSpaceBytes
- size to request in bytesIOException
public void setPinned(int fid, boolean pinned) throws IOException
IOException
public String toString()
public void unpinFile(int fid) throws IOException
IOException
public void updateRawTableMetadata(int id, ByteBuffer metadata) throws IOException
id
- the raw table's idmetadata
- the new meta dataIOException
public int createFile(TachyonURI path) throws IOException
path
- the path of the fileIOException
- If file already exists, or path is invalid.public int createFile(TachyonURI 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(TachyonURI path, TachyonURI ufsPath) throws IOException
path
- the path of the file in TachyonufsPath
- the path of the file in the underfsIOException
- If file already exists, or path is invalid.public boolean delete(int fid, boolean recursive) throws IOException
fid
- file idrecursive
- if delete the path recursively.IOException
public boolean delete(TachyonURI path, boolean recursive) throws IOException
path
- the file pathrecursive
- if delete the path recursively.IOException
public boolean mkdir(TachyonURI path) throws IOException
path
- Directory path.IOException
public boolean rename(int fileId, TachyonURI dstPath) throws IOException
fileId
- the file iddstPath
- the new path of the file in the file system.IOException
public boolean rename(TachyonURI srcPath, TachyonURI dstPath) throws IOException
srcPath
- The path of the source file / folder.dstPath
- The path of the destination file / folder.IOException
public boolean freepath(TachyonURI path, boolean recursive) throws IOException
path
- the file/folder pathrecursive
- if free the path recursivelyIOException
Copyright © 2015. All Rights Reserved.