Class FileUploader


  • public class FileUploader
    extends FileOperation
    This is an internal class and not meant to be used by the end users of the 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.
    • Constructor Detail

      • FileUploader

        public FileUploader​(GPUdb db,
                            List<String> fileNames,
                            String remoteDirName,
                            UploadOptions options,
                            FileUploadListener callback,
                            GPUdbFileHandler.Options fileHandlerOptions)
                     throws GPUdbException
        Constructs a new FileUploader manager for uploading a given set of files to a given KiFS directory.
        Parameters:
        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.
        Throws:
        GPUdbException
    • Method Detail

      • upload

        public void upload()
                    throws GPUdbException
        This is the main upload method which is to be called by the users of this class. Internally depending whether there are files to be uploaded one shot or in parts it will call the methods uploadFullFiles() and uploadMultiPartFiles()
        Throws:
        GPUdbException - If an error occurs transferring any of the files to the server.
      • setUploadOptions

        public void setUploadOptions​(UploadOptions uploadOptions)
      • getRankForLocalDist

        public int getRankForLocalDist()
      • setRankForLocalDist

        public void setRankForLocalDist​(int rankForLocalDist)