Interface BlobStore

    • Method Detail

      • getContext

        BlobStoreContext getContext()
        Returns:
        a reference to the context that created this BlobStore.
      • listAssignableLocations

        Set<? extends Location> listAssignableLocations()
        The get locations command returns all the valid locations for containers. A location has a scope, which is typically region or zone. A region is a general area, like eu-west, where a zone is similar to a datacenter. If a location has a parent, that implies it is within that location. For example a location can be a rack, whose parent is likely to be a zone.
      • containerExists

        boolean containerExists​(String container)
        determines if a service-level container exists
      • createContainerInLocation

        boolean createContainerInLocation​(@Nullable
                                          Location location,
                                          String container)
        Creates a namespace for your blobs

        A container is a namespace for your objects. Depending on the service, the scope can be global, identity, or sub-identity scoped. For example, in Amazon S3, containers are called buckets, and they must be uniquely named such that no-one else in the world conflicts. In other blobstores, the naming convention of the container is less strict. All blobstores allow you to list your containers and also the contents within them. These contents can either be blobs, folders, or virtual paths.

        Parameters:
        location - some blobstores allow you to specify a location, such as US-EAST, for where this container will exist. null will choose a default location
        container - namespace. Typically constrained to lowercase alpha-numeric and hyphens.
        Returns:
        true if the container was created, false if it already existed.
      • list

        PageSet<? extends StorageMetadata> list​(String container)
        Lists all resources in a container non-recursive.
        Parameters:
        container - what to list
        Returns:
        a list that may be incomplete, depending on whether PageSet#getNextMarker is set
      • list

        PageSet<? extends StorageMetadata> list​(String container,
                                                ListContainerOptions options)
        Like list(String) except you can control the size, recursion, and context of the list using options
        Parameters:
        container - what to list
        options - size, recursion, and context of the list
        Returns:
        a list that may be incomplete, depending on whether PageSet#getNextMarker is set
      • clearContainer

        void clearContainer​(String container)
        This will delete the contents of a container at its root path without deleting the container
        Parameters:
        container - what to clear
      • clearContainer

        void clearContainer​(String container,
                            ListContainerOptions options)
        Like clearContainer(String) except you can use options to do things like recursive deletes, or clear at a different path than root.
        Parameters:
        container - what to clear
        options - recursion and path to clear
      • deleteContainer

        void deleteContainer​(String container)
        This will delete everything inside a container recursively.
        Parameters:
        container - what to delete
        container - name of the container to delete
      • deleteContainerIfEmpty

        boolean deleteContainerIfEmpty​(String container)
        Deletes a container if it is empty.
        Parameters:
        container - name of the container to delete
        Returns:
        true if the container was deleted or does not exist
      • directoryExists

        @Deprecated
        boolean directoryExists​(String container,
                                String directory)
        Deprecated.
        use prefix and delimiter instead
        Determines if a directory exists
        Parameters:
        container - container where the directory resides
        directory - full path to the directory
      • createDirectory

        @Deprecated
        void createDirectory​(String container,
                             String directory)
        Deprecated.
        use prefix and delimiter instead
        Creates a folder or a directory marker depending on the service
        Parameters:
        container - container to create the directory in
        directory - full path to the directory
      • deleteDirectory

        @Deprecated
        void deleteDirectory​(String containerName,
                             String name)
        Deprecated.
        use prefix and delimiter instead
        Deletes a folder or a directory marker depending on the service
        Parameters:
        container - container to delete the directory from
        directory - full path to the directory to delete
      • blobExists

        boolean blobExists​(String container,
                           String name)
        Determines if a blob exists
        Parameters:
        container - container where the blob resides
        directory - full path to the blob
      • putBlob

        String putBlob​(String container,
                       Blob blob)
        Adds a Blob representing the data at location container/blob.metadata.name
        Parameters:
        container - container to place the blob.
        blob - fully qualified name relative to the container.
        options - byte range or condition options
        Returns:
        etag of the blob you uploaded, possibly null where etags are unsupported
        Throws:
        ContainerNotFoundException - if the container doesn't exist
      • putBlob

        String putBlob​(String container,
                       Blob blob,
                       PutOptions options)
        Adds a Blob representing the data at location container/blob.metadata.name options using multipart strategies.
        Parameters:
        container - container to place the blob.
        blob - fully qualified name relative to the container.
        options - byte range options
        Returns:
        etag of the blob you uploaded, possibly null where etags are unsupported
        Throws:
        ContainerNotFoundException - if the container doesn't exist
      • copyBlob

        @Beta
        String copyBlob​(String fromContainer,
                        String fromName,
                        String toContainer,
                        String toName,
                        CopyOptions options)
        Copy blob from one container to another. Some providers implement this more efficiently than corresponding getBlob and putBlob operations. Note: options are currently ignored
        Returns:
        ETag of new blob
        Throws:
        ContainerNotFoundException - if either container does not exist
      • blobMetadata

        @Nullable
        BlobMetadata blobMetadata​(String container,
                                  String name)
        Retrieves the metadata of a Blob at location container/name
        Parameters:
        container - container where this exists.
        name - fully qualified name relative to the container.
        Returns:
        null if name isn't present or the blob you intended to receive.
        Throws:
        ContainerNotFoundException - if the container doesn't exist
      • getBlob

        @Nullable
        Blob getBlob​(String container,
                     String name)
        Retrieves a Blob representing the data at location container/name
        Parameters:
        container - container where this exists.
        name - fully qualified name relative to the container.
        Returns:
        the blob you intended to receive or null, if it doesn't exist.
        Throws:
        ContainerNotFoundException - if the container doesn't exist
      • getBlob

        @Nullable
        Blob getBlob​(String container,
                     String name,
                     GetOptions options)
        Retrieves a Blob representing the data at location container/name
        Parameters:
        container - container where this exists.
        name - fully qualified name relative to the container.
        options - byte range or condition options
        Returns:
        the blob you intended to receive or null, if it doesn't exist.
        Throws:
        ContainerNotFoundException - if the container doesn't exist
      • removeBlob

        void removeBlob​(String container,
                        String name)
        Deletes a Blob representing the data at location container/name
        Parameters:
        container - container where this exists.
        name - fully qualified name relative to the container.
        Throws:
        ContainerNotFoundException - if the container doesn't exist
      • removeBlobs

        void removeBlobs​(String container,
                         Iterable<String> names)
        Deletes multiple Blobs representing the data at location container/name
        Parameters:
        container - container where this exists.
        names - fully qualified names relative to the container.
        Throws:
        ContainerNotFoundException - if the container doesn't exist
      • countBlobs

        long countBlobs​(String container)
        Returns:
        a count of all blobs in the container, excluding directory markers
      • countBlobs

        long countBlobs​(String container,
                        ListContainerOptions options)
        Returns:
        a count of all blobs that are in a listing constrained by the options specified, excluding directory markers
      • abortMultipartUpload

        @Beta
        void abortMultipartUpload​(MultipartUpload mpu)
      • getMinimumMultipartPartSize

        @Beta
        long getMinimumMultipartPartSize()
      • getMaximumMultipartPartSize

        @Beta
        long getMaximumMultipartPartSize()
      • getMaximumNumberOfParts

        @Beta
        int getMaximumNumberOfParts()
      • downloadBlob

        @Beta
        void downloadBlob​(String container,
                          String name,
                          File destination)