Example #1
0
 private function createUploadPromise()
 {
     // Creates an iterator that yields promises for either upload or
     // multipart upload operations for each file in the source directory.
     $files = Aws\recursive_dir_iterator($this->source['path']);
     // Filter out directories.
     $files = \Aws\filter($files, function ($file) {
         return !is_dir($file);
     });
     // Map each file into a promise that performs the actual transfer.
     $files = \Aws\map($files, function ($file) {
         return filesize($file) >= $this->mupThreshold ? $this->uploadMultipart($file) : $this->upload($file);
     });
     // Create an EachPromise, that will concurrently handle the upload
     // operations' yielded promises from the iterator.
     return Promise\each_limit_all($files, $this->concurrency);
 }
Example #2
0
 private function createUploadPromise()
 {
     // Map each file into a promise that performs the actual transfer.
     $files = \ILAB_Aws\map($this->getUploadsIterator(), function ($file) {
         return filesize($file) >= $this->mupThreshold ? $this->uploadMultipart($file) : $this->upload($file);
     });
     // Create an EachPromise, that will concurrently handle the upload
     // operations' yielded promises from the iterator.
     return Promise\each_limit_all($files, $this->concurrency);
 }