public class PagedDoraWorker extends AbstractWorker implements DoraWorker
Modifier and Type | Field and Description |
---|---|
static long |
DUMMY_BLOCK_SIZE |
protected AlluxioConfiguration |
mConf |
protected DoraUfsManager |
mUfsManager |
Modifier | Constructor and Description |
---|---|
|
PagedDoraWorker(AtomicReference<Long> workerId,
WorkerIdentity identity,
AlluxioConfiguration conf,
CacheManager cacheManager,
MembershipManager membershipManager)
Constructor.
|
protected |
PagedDoraWorker(AtomicReference<Long> workerId,
WorkerIdentity identity,
AlluxioConfiguration conf,
CacheManager cacheManager,
MembershipManager membershipManager,
BlockMasterClientPool blockMasterClientPool,
FileSystemContext fileSystemContext) |
Modifier and Type | Method and Description |
---|---|
FileInfo |
buildFileInfoFromUfsStatus(UfsStatus status,
String ufsFullPath)
Build FileInfo from UfsStatus and UFS full Path.
|
DoraMeta.FileStatus |
buildFileStatusFromUfsStatus(UfsStatus status,
String ufsFullPath)
Build FileStatus from UfsStatus and UFS full Path.
|
protected void |
checkCopyPermission(String srcPath,
String dstPath) |
protected void |
checkMovePermission(String srcPath,
String dstPath) |
void |
cleanupSession(long sessionId)
Cleans up the session.
|
void |
close()
Closes the server.
|
void |
completeFile(String path,
CompleteFilePOptions options,
String uuid)
Complete writing a file.
|
com.google.common.util.concurrent.ListenableFuture<List<RouteFailure>> |
copy(List<Route> routes,
UfsReadOptions readOptions,
WriteOptions writeOptions)
Copies files from src to dst.
|
void |
createDirectory(String path,
CreateDirectoryPOptions options)
Create a directory.
|
OpenFileHandle |
createFile(String path,
CreateFilePOptions options)
Create File.
|
BlockReader |
createFileReader(String fileId,
long offset,
boolean positionShort,
Protocol.OpenUfsBlockOptions options)
Creates the file reader to read from Alluxio dora.
|
BlockWriter |
createFileWriter(String fileId,
String ufsPath)
Creates the file writer to write to Alluxio dora.
|
void |
delete(String path,
DeletePOptions options)
Delete a file.
|
boolean |
exists(String path,
ExistsPOptions options)
Check existence of a file or dir.
|
WorkerNetAddress |
getAddress()
Get the address of the Dora Worker.
|
protected int |
getCachedPercentage(FileInfo fi,
String ufsFullPath) |
Set<Class<? extends Server>> |
getDependencies() |
FileInfo |
getFileInfo(String ufsFullPath,
GetStatusPOptions options)
Gets the file information.
|
protected FileInfo |
getGrpcFileInfo(String ufsFullPath,
long syncIntervalMs) |
String |
getName() |
protected DoraOpenFileHandleContainer |
getOpenFileHandleContainer() |
Map<ServiceType,GrpcService> |
getServices() |
protected UnderFileSystem |
getUfsInstance(String ufsUriStr) |
protected UnderFileSystem |
getUnderFileSystem(String ufsPath) |
AtomicReference<Long> |
getWorkerId() |
UfsStatus[] |
listStatus(String path,
ListStatusPOptions options)
List status from Under File System.
|
com.google.common.util.concurrent.ListenableFuture<LoadFileResponse> |
load(boolean loadData,
boolean skipIfExists,
List<UfsStatus> ufsStatuses,
UfsReadOptions options)
Loads the metadata and data of files from UFS to Alluxio.
|
protected void |
loadData(String ufsPath,
long mountId,
long length) |
com.google.common.util.concurrent.ListenableFuture<List<RouteFailure>> |
move(List<Route> routes,
UfsReadOptions readOptions,
WriteOptions writeOptions)
Moves files from src to dst.
|
void |
rename(String src,
String dst,
RenamePOptions options)
Rename src to dst.
|
void |
setAttribute(String path,
SetAttributePOptions options)
Set attribute for this file/dir.
|
void |
start(WorkerNetAddress address)
Starts the Alluxio server.
|
void |
stop()
Stops the Alluxio server.
|
getExecutorService
public static final long DUMMY_BLOCK_SIZE
protected final DoraUfsManager mUfsManager
protected final AlluxioConfiguration mConf
@Inject public PagedDoraWorker(@Named(value="workerId") AtomicReference<Long> workerId, WorkerIdentity identity, AlluxioConfiguration conf, CacheManager cacheManager, MembershipManager membershipManager)
workerId
- identity
- conf
- cacheManager
- membershipManager
- protected PagedDoraWorker(AtomicReference<Long> workerId, WorkerIdentity identity, AlluxioConfiguration conf, CacheManager cacheManager, MembershipManager membershipManager, BlockMasterClientPool blockMasterClientPool, FileSystemContext fileSystemContext)
protected UnderFileSystem getUfsInstance(String ufsUriStr)
public Set<Class<? extends Server>> getDependencies()
getDependencies
in interface Server<WorkerNetAddress>
public String getName()
getName
in interface Server<WorkerNetAddress>
public Map<ServiceType,GrpcService> getServices()
getServices
in interface Server<WorkerNetAddress>
public void start(WorkerNetAddress address) throws IOException
Server
start
in interface Server<WorkerNetAddress>
start
in class AbstractWorker
address
- the start optionsIOException
public void stop() throws IOException
Server
#start(T)
should be
cleaned up and shutdown.stop
in interface Server<WorkerNetAddress>
stop
in class AbstractWorker
IOException
public void close() throws IOException
Server
close
in interface Server<WorkerNetAddress>
close
in class AbstractWorker
IOException
public AtomicReference<Long> getWorkerId()
getWorkerId
in interface DataWorker
@Nullable public UfsStatus[] listStatus(String path, ListStatusPOptions options) throws IOException, AccessControlException
DoraWorker
listStatus
in interface DoraWorker
path
- the path of a dir or fileoptions
- the option for listStatus()null
if this abstract pathname does not denote a directory.IOException
AccessControlException
public FileInfo getFileInfo(String ufsFullPath, GetStatusPOptions options) throws IOException, AccessControlException
DoraWorker
getFileInfo
in interface DoraWorker
ufsFullPath
- the file idoptions
- the options for the GetStatusPRequestIOException
AccessControlException
protected FileInfo getGrpcFileInfo(String ufsFullPath, long syncIntervalMs) throws IOException
IOException
public FileInfo buildFileInfoFromUfsStatus(UfsStatus status, String ufsFullPath)
status
- ufsFullPath
- public DoraMeta.FileStatus buildFileStatusFromUfsStatus(UfsStatus status, String ufsFullPath)
status
- the ufs statusufsFullPath
- the full ufs pathpublic BlockReader createFileReader(String fileId, long offset, boolean positionShort, Protocol.OpenUfsBlockOptions options) throws IOException, AccessControlException
DoraWorker
createFileReader
in interface DoraWorker
fileId
- the ID of the UFS fileoffset
- the offset within the blockpositionShort
- whether the operation is using positioned read to a small buffer sizeoptions
- the optionsIOException
- if it fails to get block readerAccessControlException
public BlockWriter createFileWriter(String fileId, String ufsPath) throws AccessControlException, IOException
DoraWorker
createFileWriter
in interface DoraWorker
fileId
- the ID of the UFS fileufsPath
- the path of UFS fileAccessControlException
IOException
public com.google.common.util.concurrent.ListenableFuture<LoadFileResponse> load(boolean loadData, boolean skipIfExists, List<UfsStatus> ufsStatuses, UfsReadOptions options) throws AccessControlException, IOException
DoraWorker
load
in interface DoraWorker
loadData
- true if data should also be loaded, otherwise metadata onlyskipIfExists
- true if data loading should be skipped if it's already loadedufsStatuses
- the files to loadAccessControlException
IOException
protected void loadData(String ufsPath, long mountId, long length) throws AccessControlException, IOException
AccessControlException
IOException
public com.google.common.util.concurrent.ListenableFuture<List<RouteFailure>> copy(List<Route> routes, UfsReadOptions readOptions, WriteOptions writeOptions)
DoraWorker
copy
in interface DoraWorker
routes
- the files to copyreadOptions
- the options for readingwriteOptions
- the options for writingprotected UnderFileSystem getUnderFileSystem(String ufsPath)
public com.google.common.util.concurrent.ListenableFuture<List<RouteFailure>> move(List<Route> routes, UfsReadOptions readOptions, WriteOptions writeOptions)
DoraWorker
move
in interface DoraWorker
routes
- the files to movereadOptions
- the options for readingwriteOptions
- the options for writingpublic OpenFileHandle createFile(String path, CreateFilePOptions options) throws AccessControlException, IOException
DoraWorker
createFile
in interface DoraWorker
path
- the path of this fileoptions
- the options for this operationAccessControlException
IOException
public void completeFile(String path, CompleteFilePOptions options, String uuid) throws IOException, AccessControlException
DoraWorker
completeFile
in interface DoraWorker
path
- the path of this fileoptions
- the options for this operationuuid
- the uuid string of its file open handleIOException
AccessControlException
public void delete(String path, DeletePOptions options) throws IOException, AccessControlException
DoraWorker
delete
in interface DoraWorker
path
- the path of this fileoptions
- the options for this operationIOException
AccessControlException
public void rename(String src, String dst, RenamePOptions options) throws IOException, AccessControlException
DoraWorker
rename
in interface DoraWorker
src
- the source file/dirdst
- the destination file/diroptions
- the options for this operationsIOException
AccessControlException
public void createDirectory(String path, CreateDirectoryPOptions options) throws IOException, AccessControlException
DoraWorker
createDirectory
in interface DoraWorker
path
- the directory nameoptions
- the options for this operationsIOException
AccessControlException
public boolean exists(String path, ExistsPOptions options) throws IOException
DoraWorker
exists
in interface DoraWorker
path
- the path of this file or diroptions
- the options of this operationIOException
public void setAttribute(String path, SetAttributePOptions options) throws IOException
setAttribute
in interface DoraWorker
path
- the pth of this file or diroptions
- the options of this operationIOException
public void cleanupSession(long sessionId)
SessionCleanable
cleanupSession
in interface SessionCleanable
sessionId
- the session idprotected void checkCopyPermission(String srcPath, String dstPath) throws AccessControlException, IOException
AccessControlException
IOException
protected void checkMovePermission(String srcPath, String dstPath) throws AccessControlException, IOException
AccessControlException
IOException
protected DoraOpenFileHandleContainer getOpenFileHandleContainer()
public WorkerNetAddress getAddress()
DoraWorker
getAddress
in interface DoraWorker
Copyright © 2023. All Rights Reserved.