Package com.gpudb.filesystem.upload
Class UploadIoJob
- java.lang.Object
-
- com.gpudb.filesystem.upload.UploadIoJob
-
public class UploadIoJob extends Object
This is an internal class and not meant to be used by the end users of thefilesystemAPI. The consequences of using this class directly in client code is not guaranteed and maybe undesirable. This class models an uploadOpMode. Different instances of this class will be created for different operations and no instance of this class will be shared. This class handles only multi part upload. It uses a single threaded thread pool internally with an unbounded queue which is used to submit the background tasks modeled by anIoTaskinstance, since multi part upload has to be handled sequentially. An instance of this class is used to handle the upload of a single large file. If there are multiple large files to be uploaded each such file will be handled by a new instance of this class.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.apache.commons.lang3.tuple.Pair<String,UploadIoJob>createNewJob(GPUdb db, GPUdbFileHandler.Options fileHandlerOptions, String localFileName, String remoteFileName, UploadOptions uploadOptions, FileUploadListener callback)Creates a new job for uploading a file.StringgetJobId()ExecutorServicegetThreadPool()voidstart()Starts the job to upload the multipart file by submitting different stages of aMultiPartUploadInfo.MultiPartOperationfor execution.List<Result>stop()This method is used to stop all the runningIoTaskinstances.
-
-
-
Method Detail
-
createNewJob
public static org.apache.commons.lang3.tuple.Pair<String,UploadIoJob> createNewJob(GPUdb db, GPUdbFileHandler.Options fileHandlerOptions, String localFileName, String remoteFileName, UploadOptions uploadOptions, FileUploadListener callback) throws GPUdbException
Creates a new job for uploading a file.- Parameters:
db- TheGPUdbinstance used to access KiFS.fileHandlerOptions- Options for setting up the files for upload.localFileName- Fully-qualified name of the local file to upload.remoteFileName- Fully-qualified name of the uploaded KiFS file.uploadOptions- Options to use during the upload.callback-FileUploadListenerthat can trigger events at various stages of the upload process.- Returns:
Pairof upload job ID and management object- Throws:
GPUdbException
-
getJobId
public String getJobId()
-
getThreadPool
public ExecutorService getThreadPool()
-
start
public void start() throws GPUdbExceptionStarts the job to upload the multipart file by submitting different stages of aMultiPartUploadInfo.MultiPartOperationfor execution. Each stage is modeled as anIoTaskcontaining the file resources necessary to complete that stage of the upload.- Throws:
GPUdbException
-
-