TritonDataCenter / java-manta

Java Manta Client SDK
Mozilla Public License 2.0
16 stars 26 forks source link

Buckets Operations #544

Closed indianwhocodes closed 5 years ago

indianwhocodes commented 5 years ago

Description

This is the current dev branch for Buckets that I have been working on which consists of operations (API calls) that MantaClient within the Java SDK will eventually support once it's past the testing phase.

NOTE: #544 is currently not review-ready but proactive feedback while I am still working on it will be very much appreciated.

Manta Java SDK Operations

Citing RFD#155, the operations for buckets are as follows:

Note: Some complex operations will be potentially included in later stages:

AWS S3 Java SDK Buckets Operations:

Waiting on Headers Support from Server-Side

This PR is waiting on headers support from the server-side which are integral to supporting some of thebucket-operations the have currently been added to the Java SDK

dekobon commented 5 years ago

I just noticed that in MantaClient:418, the *bucket methods are under the section:

    /* ======================================================================
     * Object Access
     * ====================================================================== */

That doesn't seem to harmonize with the existing code well.

Additionally, the string in the rawPath validation on MantaClient:441 doesn't make sense:

    public boolean createBucket(final String rawPath, final MantaHttpHeaders rawHeaders)
            throws IOException {
        Validate.notBlank(rawPath, "CREATE bucket must not be empty nor null");

You are validating rawPath. How would that message be helpful to a user of the SDK to understand that the path provided was in an invalid format?

In MantaClient:534, this catch is confusing:

            } catch (ConnectionPoolTimeoutException e) {
                LOG.debug("{} for deleting bucket {}", e.getMessage(), path);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
  1. Why do you not bubble up an error for the timeout exception? In this case, the operation never completed successfully. What behavior were you expecting to happen as a user of the SDK?
  2. The log message {} for deleting bucket {} doesn't quite make sense.
  3. Why are you wrapping an IOException in an UncheckedIOException that is specified in the deleteBucket method signature?
dekobon commented 5 years ago

In ConfigContext:87:

Use MantaClient.SEPARATOR rather than hardcoding a slash:

    /**
     * @return String of buckets directory based on Manta username.
     */
    default String getMantaBucketsDirectory() {
        return deriveHomeDirectoryFromUser(getMantaUser()) + "/buckets";
    }
indianwhocodes commented 5 years ago

544 is yet to be ready for review as we are still undergoing some implementation discussions. Nevertheless, cleanup of this PR is required at many places and suggestions are most welcome.