tachyon.client
Class TachyonClient

java.lang.Object
  extended by tachyon.client.TachyonClient

public class TachyonClient
extends Object

Tachyon's user client API. It contains a MasterClient and several WorkerClients depending on how many workers the client program is interacting with.


Method Summary
 void accessLocalFile(int fileId)
           
 void addCheckpoint(int fileId)
           
 boolean addCheckpointPath(int id, String path)
          This API is not recommended to use.
 void cacheFile(int fileId)
           
 void close()
           
 void connect()
           
 File createAndGetUserTempFolder()
           
 String createAndGetUserUnderfsTempFolder()
           
 int createFile(String path)
           
 int createRawTable(String path, int columns)
           
 int createRawTable(String path, int columns, ByteBuffer metadata)
           
 boolean delete(int fileId)
           
 boolean delete(String path)
           
 boolean exist(String path)
           
static TachyonClient getClient(InetSocketAddress tachyonAddress)
           
static TachyonClient getClient(String tachyonAddress)
           
 TachyonFile getFile(int fileId)
           
 TachyonFile getFile(String path)
           
 TachyonFile getFile(String path, boolean useCachedMetadata)
           
 List<String> getFileHosts(int fileId)
           
 int getFileId(String path)
           
 List<NetAddress> getFileNetAddresses(int fileId)
           
 List<List<String>> getFilesHosts(List<Integer> fileIds)
           
 List<List<NetAddress>> getFilesNetAddresses(List<Integer> fileIds)
           
 int getNumberOfFiles(String folderPath)
           
 RawTable getRawTable(int id)
           
 RawTable getRawTable(String path)
           
 String getRootFolder()
           
 String getUnderfsAddress()
           
 boolean hasLocalWorker()
           
 boolean isConnected()
           
 List<Integer> listFiles(String path, boolean recursive)
           
 List<ClientFileInfo> listStatus(String path)
           
 boolean lockFile(int fileId)
           
 List<String> ls(String path, boolean recursive)
           
 int mkdir(String path)
          Create a directory if it does not exist.
 void outOfMemoryForPinFile(int fileId)
           
 void releaseSpace(long releaseSpaceBytes)
           
 boolean rename(String srcPath, String dstPath)
           
 boolean requestSpace(long requestSpaceBytes)
           
 boolean unlockFile(int fileId)
           
 boolean unpinFile(int fileId)
           
 void updateRawTableMetadata(int id, ByteBuffer metadata)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClient

public static TachyonClient getClient(InetSocketAddress tachyonAddress)

getClient

public static TachyonClient getClient(String tachyonAddress)

accessLocalFile

public void accessLocalFile(int fileId)

addCheckpoint

public void addCheckpoint(int fileId)
                   throws IOException
Throws:
IOException

addCheckpointPath

public boolean addCheckpointPath(int id,
                                 String path)
                          throws FileDoesNotExistException,
                                 SuspectedFileSizeException,
                                 org.apache.thrift.TException,
                                 IOException
This API is not recommended to use.

Parameters:
id - file id
path - existing checkpoint path
Returns:
true if the checkpoint path is added successfully, false otherwise.
Throws:
org.apache.thrift.TException
SuspectedFileSizeException
FileDoesNotExistException
IOException

cacheFile

public void cacheFile(int fileId)
               throws IOException
Throws:
IOException

connect

public void connect()

close

public void close()
           throws org.apache.thrift.TException
Throws:
org.apache.thrift.TException

createAndGetUserTempFolder

public File createAndGetUserTempFolder()

createAndGetUserUnderfsTempFolder

public String createAndGetUserUnderfsTempFolder()
                                         throws IOException
Throws:
IOException

createRawTable

public int createRawTable(String path,
                          int columns)
                   throws InvalidPathException,
                          FileAlreadyExistException,
                          TableColumnException
Throws:
InvalidPathException
FileAlreadyExistException
TableColumnException

createRawTable

public int createRawTable(String path,
                          int columns,
                          ByteBuffer metadata)
                   throws InvalidPathException,
                          FileAlreadyExistException,
                          TableColumnException
Throws:
InvalidPathException
FileAlreadyExistException
TableColumnException

createFile

public int createFile(String path)
               throws InvalidPathException,
                      FileAlreadyExistException
Throws:
InvalidPathException
FileAlreadyExistException

delete

public boolean delete(int fileId)

delete

public boolean delete(String path)
               throws InvalidPathException
Throws:
InvalidPathException

exist

public boolean exist(String path)
              throws InvalidPathException
Throws:
InvalidPathException

rename

public boolean rename(String srcPath,
                      String dstPath)
               throws InvalidPathException
Throws:
InvalidPathException

getFileNetAddresses

public List<NetAddress> getFileNetAddresses(int fileId)
                                     throws IOException
Throws:
IOException

getFilesNetAddresses

public List<List<NetAddress>> getFilesNetAddresses(List<Integer> fileIds)
                                            throws IOException
Throws:
IOException

getFileHosts

public List<String> getFileHosts(int fileId)
                          throws IOException
Throws:
IOException

getFilesHosts

public List<List<String>> getFilesHosts(List<Integer> fileIds)
                                 throws IOException
Throws:
IOException

getFile

public TachyonFile getFile(String path)
                    throws InvalidPathException
Throws:
InvalidPathException

getFile

public TachyonFile getFile(String path,
                           boolean useCachedMetadata)
                    throws InvalidPathException
Throws:
InvalidPathException

getFile

public TachyonFile getFile(int fileId)

getFileId

public int getFileId(String path)
              throws InvalidPathException
Throws:
InvalidPathException

getNumberOfFiles

public int getNumberOfFiles(String folderPath)
                     throws FileDoesNotExistException,
                            InvalidPathException,
                            org.apache.thrift.TException
Throws:
FileDoesNotExistException
InvalidPathException
org.apache.thrift.TException

getRawTable

public RawTable getRawTable(String path)
                     throws TableDoesNotExistException,
                            InvalidPathException,
                            org.apache.thrift.TException
Throws:
TableDoesNotExistException
InvalidPathException
org.apache.thrift.TException

getRawTable

public RawTable getRawTable(int id)
                     throws TableDoesNotExistException,
                            org.apache.thrift.TException
Throws:
TableDoesNotExistException
org.apache.thrift.TException

getRootFolder

public String getRootFolder()

hasLocalWorker

public boolean hasLocalWorker()

isConnected

public boolean isConnected()

listFiles

public List<Integer> listFiles(String path,
                               boolean recursive)
                        throws IOException
Throws:
IOException

listStatus

public List<ClientFileInfo> listStatus(String path)
                                throws FileDoesNotExistException,
                                       InvalidPathException,
                                       org.apache.thrift.TException
Throws:
FileDoesNotExistException
InvalidPathException
org.apache.thrift.TException

ls

public List<String> ls(String path,
                       boolean recursive)
                throws IOException
Throws:
IOException

lockFile

public boolean lockFile(int fileId)

mkdir

public int mkdir(String path)
          throws InvalidPathException,
                 FileAlreadyExistException
Create a directory if it does not exist.

Parameters:
path - Directory path.
Returns:
The inode ID of the directory if it is successfully created. -1 if not.
Throws:
InvalidPathException
FileAlreadyExistException

outOfMemoryForPinFile

public void outOfMemoryForPinFile(int fileId)

releaseSpace

public void releaseSpace(long releaseSpaceBytes)

requestSpace

public boolean requestSpace(long requestSpaceBytes)

unpinFile

public boolean unpinFile(int fileId)

unlockFile

public boolean unlockFile(int fileId)

updateRawTableMetadata

public void updateRawTableMetadata(int id,
                                   ByteBuffer metadata)
                            throws TableDoesNotExistException,
                                   org.apache.thrift.TException
Throws:
TableDoesNotExistException
org.apache.thrift.TException

getUnderfsAddress

public String getUnderfsAddress()
                         throws IOException
Throws:
IOException


Copyright © 2013. All Rights Reserved.