public class FileUploader extends FileOperation
filesystem
API. The consequences of using this class directly in
client code is not guaranteed and maybe undesirable.
This class handles uploading of either single part file or multiple part
uploads. This class extends the class FileOperation
and provides
additional functionalities of creating instances of UploadIoJob
,
starting them and waiting for them to terminate.
The main exposed method to call is upload()
which calls two private
methods named uploadFullFiles()
and uploadMultiPartFiles()
respectively.
The method uploadFullFiles()
does the upload by calling the Java
endpoint to upload all files in one go.
The method uploadMultiPartFiles()
does the uploads by creating
background threads since each file could take a long time to upload.
The multiple parts of a single file are uploaded sequentially in a single
thread and multiple files are uploaded in different threads.db, dirName, fileHandlerOptions, fileNames, fullFileBatchManager, fullFileList, fullRemoteFileNames, multiPartList, multiPartRemoteFileNames, namesOfFilesUploaded, opMode, recursive
Constructor and Description |
---|
FileUploader(GPUdb db,
List<String> fileNames,
String remoteDirName,
UploadOptions options,
FileUploadListener callback,
GPUdbFileHandler.Options fileHandlerOptions)
Constructs a new
FileUploader manager for uploading a given set
of files to a given KiFS directory. |
Modifier and Type | Method and Description |
---|---|
int |
getRankForLocalDist() |
UploadOptions |
getUploadOptions() |
void |
setRankForLocalDist(int rankForLocalDist) |
void |
setUploadOptions(UploadOptions uploadOptions) |
void |
upload()
This is the main upload method which is to be called by the users of
this class.
|
decideMultiPart, getFileInfoFromServer, getKifsPathSeparator, getNamesOfFilesUploaded, localDirExists, localFileExists, parseFileNames, sortFilesIntoFullAndMultipartLists, traverseLocalDirectories
public FileUploader(GPUdb db, List<String> fileNames, String remoteDirName, UploadOptions options, FileUploadListener callback, GPUdbFileHandler.Options fileHandlerOptions) throws GPUdbException
FileUploader
manager for uploading a given set
of files to a given KiFS directory.db
- The GPUdb
instance used to access KiFS.fileNames
- List of names of the local files to upload.remoteDirName
- Name of KiFS directory to upload to.options
- The UploadOptions
object which is used to
configure the upload operation.callback
- The callback FileUploadListener
for this upload
manager to notify as the upload job progresses.fileHandlerOptions
- Options for setting up the files for transfer.GPUdbException
public void upload() throws GPUdbException
uploadFullFiles()
and uploadMultiPartFiles()
GPUdbException
- If an error occurs transferring any of the files
to the server.public UploadOptions getUploadOptions()
public void setUploadOptions(UploadOptions uploadOptions)
public int getRankForLocalDist()
public void setRankForLocalDist(int rankForLocalDist)
Copyright © 2025. All rights reserved.