File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
src/main/java/software/amazon/nio/spi/s3 Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -329,6 +329,14 @@ we could test for file existence before deletion this would require an additiona
329329operation. Because S3 only guarantees read after write consistency it would be possible for a file to be created or
330330deleted between these two operations. Therefore, we currently always return ` true `
331331
332+ ### Copies of a directory will also copy contents
333+
334+ Our implementation of ` FileSystemProvider.copy ` will also copy the content of the directory via batched copy operations. This is a variance
335+ from some other implementations such as ` UnixFileSystemProvider ` where directory contents are not copied and the
336+ use of the {@code walkFileTree} is suggested to perform deep copies. In S3 this could result in an explosion
337+ of API calls which would be both expensive in time and possibly money. By performing batch copies we can greatly reduce
338+ the number of calls.
339+
332340## Building this library
333341
334342The library uses the gradle build system and targets Java 11 to allow it to be used in many contexts. To build you can simply run:
Original file line number Diff line number Diff line change @@ -345,18 +345,18 @@ public void delete(Path path) throws IOException {
345345 * specified by the {@link Files#copy(Path, Path, CopyOption[])} method
346346 * except that both the source and target paths must be associated with
347347 * this provider.
348+ * <br>
349+ * Our implementation will also copy the content of the directory via batched copy operations. This is a variance
350+ * from some other implementations such as `UnixFileSystemProvider` where directory contents are not copied and the
351+ * use of the {@code walkFileTree} is suggested to perform deep copies. In S3 this could result in an explosion
352+ * of API calls which would be both expensive in time and possibly money.
348353 *
349354 * @param source the path to the file to copy
350355 * @param target the path to the target file
351356 * @param options options specifying how the copy should be done
352357 */
353358 @ Override
354359 public void copy (Path source , Path target , CopyOption ... options ) throws IOException {
355- //
356- // TODO: source and target can belong to any file system (confirmed, see
357- // https://github.com/awslabs/aws-java-nio-spi-for-s3/issues/135),
358- // we can not assume they points to S3 objects
359- //
360360 try {
361361 // If both paths point to the same object, this is a no-op
362362 if (source .equals (target )) {
You can’t perform that action at this time.
0 commit comments