public class DoraCacheClient extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DUMMY_BLOCK_ID |
Constructor and Description |
---|
DoraCacheClient(FileSystemContext context)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Map<String,List<WorkerNetAddress>> |
checkFileLocation(String path,
GetStatusPOptions options)
Get a map that maps file path to the workers list.
|
protected BlockWorkerInfo |
choosePreferredWorker(List<BlockWorkerInfo> workers)
Chooses a client preferred worker from multiple workers which hold multiple replicas.
|
void |
completeFile(String path,
CompleteFilePOptions options,
String uuid)
Mark the newly created and written file as complete.
|
void |
createDirectory(String path,
CreateDirectoryPOptions options)
Create a dir.
|
Pair<URIStatus,String> |
createFile(String path,
CreateFilePOptions options)
Create File.
|
protected GrpcDataReader.Factory |
createGrpcDataReader(WorkerNetAddress workerNetAddress,
Protocol.OpenUfsBlockOptions ufsOptions) |
protected NettyDataReader |
createNettyDataReader(WorkerNetAddress workerNetAddress,
Protocol.OpenUfsBlockOptions ufsOptions) |
DoraCachePositionReader |
createNettyPositionReader(URIStatus status,
Protocol.OpenUfsBlockOptions ufsOptions,
Optional<CloseableSupplier<PositionReader>> externalPositionReader) |
void |
delete(String path,
DeletePOptions options)
Delete a file.
|
boolean |
exists(String path,
ExistsPOptions options)
Check existence of a file or dir.
|
protected long |
getChunkSize() |
FileSystemContext |
getContext()
Get Context.
|
PositionReadFileInStream |
getInStream(URIStatus status,
Protocol.OpenUfsBlockOptions ufsOptions)
Get a stream to read the data from dora cache cluster.
|
DoraFileOutStream |
getOutStream(AlluxioURI alluxioPath,
FileSystemContext fsContext,
OutStreamOptions outStreamOptions,
FileOutStream ufsOutStream,
String uuid)
Get a stream to write the data to dora cache cluster.
|
URIStatus |
getStatus(String path,
GetStatusPOptions options)
Get status.
|
protected URIStatus |
getStatusByGrpc(String path,
GetStatusPOptions options) |
WorkerNetAddress |
getWorkerNetAddress(String path)
Get the worker net address of the specific file path.
|
List<URIStatus> |
listStatus(String path,
ListStatusPOptions options)
List Status from Worker.
|
void |
rename(String src,
String dst,
RenamePOptions options)
Rename a src file/dir to dst file/dir.
|
void |
setAttribute(String path,
SetAttributePOptions options)
Set attributes for a file or dir.
|
public static final int DUMMY_BLOCK_ID
public DoraCacheClient(FileSystemContext context)
context
- public PositionReadFileInStream getInStream(URIStatus status, Protocol.OpenUfsBlockOptions ufsOptions)
status
- ufsOptions
- public DoraFileOutStream getOutStream(AlluxioURI alluxioPath, FileSystemContext fsContext, OutStreamOptions outStreamOptions, @Nullable FileOutStream ufsOutStream, String uuid) throws IOException
alluxioPath
- the alluxio path to be writtenfsContext
- the file system contextoutStreamOptions
- the output stream optionsufsOutStream
- the UfsOutStream for writing data to UFSuuid
- the UUID for a certain FileOutStreamIOException
protected long getChunkSize()
public DoraCachePositionReader createNettyPositionReader(URIStatus status, Protocol.OpenUfsBlockOptions ufsOptions, Optional<CloseableSupplier<PositionReader>> externalPositionReader)
status
- ufsOptions
- externalPositionReader
- protected GrpcDataReader.Factory createGrpcDataReader(WorkerNetAddress workerNetAddress, Protocol.OpenUfsBlockOptions ufsOptions)
protected NettyDataReader createNettyDataReader(WorkerNetAddress workerNetAddress, Protocol.OpenUfsBlockOptions ufsOptions)
public List<URIStatus> listStatus(String path, ListStatusPOptions options) throws PermissionDeniedException
path
- options
- RuntimeException
PermissionDeniedException
public URIStatus getStatus(String path, GetStatusPOptions options) throws PermissionDeniedException
path
- options
- PermissionDeniedException
protected URIStatus getStatusByGrpc(String path, GetStatusPOptions options) throws PermissionDeniedException
PermissionDeniedException
public Pair<URIStatus,String> createFile(String path, CreateFilePOptions options) throws PermissionDeniedException
path
- the file pathoptions
- the option for creating operationRuntimeException
PermissionDeniedException
public Map<String,List<WorkerNetAddress>> checkFileLocation(String path, GetStatusPOptions options) throws IOException
path
- the file path to checkoptions
- the get status optionsIOException
public void completeFile(String path, CompleteFilePOptions options, String uuid) throws PermissionDeniedException
path
- The file pathoptions
- the close optionuuid
- the uuid of its open file handlePermissionDeniedException
public void delete(String path, DeletePOptions options) throws PermissionDeniedException
path
- options
- PermissionDeniedException
public void rename(String src, String dst, RenamePOptions options) throws PermissionDeniedException
src
- the source file/dirdst
- the destination file/diroptions
- the rename optionPermissionDeniedException
public void createDirectory(String path, CreateDirectoryPOptions options) throws PermissionDeniedException
path
- the name of the diroptions
- the option of this operationPermissionDeniedException
public boolean exists(String path, ExistsPOptions options) throws InvalidPathException, IOException, AlluxioException
path
- the path of the file or diroptions
- the option of this operationInvalidPathException
IOException
AlluxioException
public void setAttribute(String path, SetAttributePOptions options) throws FileDoesNotExistException, IOException, AlluxioException
path
- the path of the file or diroptions
- the option of this operationFileDoesNotExistException
IOException
AlluxioException
public WorkerNetAddress getWorkerNetAddress(String path)
path
- the file pathprotected BlockWorkerInfo choosePreferredWorker(List<BlockWorkerInfo> workers)
workers
- a list of workerspublic FileSystemContext getContext()
Copyright © 2023. All Rights Reserved.