Class FilterBlobContainer

org.elasticsearch.common.blobstore.support.FilterBlobContainer
All Implemented Interfaces:
BlobContainer

public abstract class FilterBlobContainer extends implements BlobContainer
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     blobName)
    Tests whether a blob with the given blob name exists in the container.
    Lists all child containers under this container.
    Deletes this container and all its contents from the repository.
    void
    <> blobNames)
    Deletes the blobs with given names.
    Lists all blobs in the container.
     blobNamePrefix)
    Lists all blobs in the container that match the specified prefix.
    Gets the BlobPath that defines the implementation specific paths to where the blobs are contained.
     blobName)
    Creates a new for the given blob name.
     blobName, long position, long length)
    Creates a new that can be used to read the given blob starting from a specific position in the blob.
    long
    Provides a hint to clients for a suitable length to use with BlobContainer.readBlob(String, long, long).
    protected abstract BlobContainer
     
    void
     blobName, boolean failIfAlreadyExists, boolean atomic, org.elasticsearch.core.CheckedConsumer<,​> writer)
    Write a blob by providing a consumer that will write its contents to an output stream.
    void
     blobName,  inputStream, long blobSize, boolean failIfAlreadyExists)
    Reads blob content from the input stream and writes it to the container in a new blob with the given name.
    void
     blobName, BytesReference bytes, boolean failIfAlreadyExists)
    Reads blob content from a BytesReference and writes it to the container in a new blob with the given name, using an atomic write operation if the implementation supports it.

    Methods inherited from class java.lang.

    , , , , , , , , , ,

    Methods inherited from interface org.elasticsearch.common.blobstore.BlobContainer

    writeBlob
  • Constructor Details

    • FilterBlobContainer

      public FilterBlobContainer(BlobContainer delegate)
  • Method Details

    • wrapChild

      protected abstract BlobContainer wrapChild(BlobContainer child)
    • path

      public BlobPath path()
      Description copied from interface: BlobContainer
      Gets the BlobPath that defines the implementation specific paths to where the blobs are contained.
      Specified by:
      path in interface BlobContainer
      Returns:
      the BlobPath where the blobs are contained
    • blobExists

      public boolean blobExists( blobName) throws
      Description copied from interface: BlobContainer
      Tests whether a blob with the given blob name exists in the container.
      Specified by:
      blobExists in interface BlobContainer
      Parameters:
      blobName - The name of the blob whose existence is to be determined.
      Returns:
      true if a blob exists in the BlobContainer with the given name, and false otherwise.
      Throws:
    • readBlob

      public  readBlob( blobName) throws
      Description copied from interface: BlobContainer
      Creates a new for the given blob name.
      Specified by:
      readBlob in interface BlobContainer
      Parameters:
      blobName - The name of the blob to get an for.
      Returns:
      The InputStream to read the blob.
      Throws:
      - if the blob does not exist
      - if the blob can not be read.
    • readBlob

      public  readBlob( blobName, long position, long length) throws
      Description copied from interface: BlobContainer
      Creates a new that can be used to read the given blob starting from a specific position in the blob. The length is an indication of the number of bytes that are expected to be read from the .
      Specified by:
      readBlob in interface BlobContainer
      Parameters:
      blobName - The name of the blob to get an for.
      position - The position in the blob where the next byte will be read.
      length - An indication of the number of bytes to be read.
      Returns:
      The InputStream to read the blob.
      Throws:
      - if the blob does not exist
      - if the blob can not be read.
    • readBlobPreferredLength

      public long readBlobPreferredLength()
      Description copied from interface: BlobContainer
      Provides a hint to clients for a suitable length to use with BlobContainer.readBlob(String, long, long). Some blob containers have nontrivial costs attached to each readBlob call, so it is a good idea for consumers to speculatively request more data than they need right now and to re-use this stream for future needs if possible. Also, some blob containers return streams that are expensive to close before the stream has been fully consumed, and the cost may depend on the length of the data that was left unconsumed. For these containers it's best to bound the cost of a partial read by bounding the length of the data requested.
      Specified by:
      readBlobPreferredLength in interface BlobContainer
      Returns:
      a hint to consumers regarding the length of data to request if there is a good chance that future reads can be satisfied from the same stream.
    • writeBlob

      public void writeBlob( blobName,  inputStream, long blobSize, boolean failIfAlreadyExists) throws
      Description copied from interface: BlobContainer
      Reads blob content from the input stream and writes it to the container in a new blob with the given name. This method assumes the container does not already contain a blob of the same blobName. If a blob by the same name already exists, the operation will fail and an will be thrown.
      Specified by:
      writeBlob in interface BlobContainer
      Parameters:
      blobName - The name of the blob to write the contents of the input stream to.
      inputStream - The input stream from which to retrieve the bytes to write to the blob.
      blobSize - The size of the blob to be written, in bytes. It is implementation dependent whether this value is used in writing the blob to the repository.
      failIfAlreadyExists - whether to throw a FileAlreadyExistsException if the given blob already exists
      Throws:
      - if failIfAlreadyExists is true and a blob by the same name already exists
      - if the input stream could not be read, or the target blob could not be written to.
    • writeBlob

      public void writeBlob( blobName, boolean failIfAlreadyExists, boolean atomic, org.elasticsearch.core.CheckedConsumer<,​> writer) throws
      Description copied from interface: BlobContainer
      Write a blob by providing a consumer that will write its contents to an output stream. This method allows serializing a blob's contents directly to the blob store without having to materialize the serialized version in full before writing.
      Specified by:
      writeBlob in interface BlobContainer
      Parameters:
      blobName - the name of the blob to write
      failIfAlreadyExists - whether to throw a FileAlreadyExistsException if the given blob already exists
      atomic - whether the write should be atomic in case the implementation supports it
      writer - consumer for an output stream that will write the blob contents to the stream
      Throws:
    • writeBlobAtomic

      public void writeBlobAtomic( blobName, BytesReference bytes, boolean failIfAlreadyExists) throws
      Description copied from interface: BlobContainer
      Reads blob content from a BytesReference and writes it to the container in a new blob with the given name, using an atomic write operation if the implementation supports it.
      Specified by:
      writeBlobAtomic in interface BlobContainer
      Parameters:
      blobName - The name of the blob to write the contents of the input stream to.
      bytes - The bytes to write
      failIfAlreadyExists - whether to throw a FileAlreadyExistsException if the given blob already exists
      Throws:
      - if failIfAlreadyExists is true and a blob by the same name already exists
      - if the input stream could not be read, or the target blob could not be written to.
    • delete

      public DeleteResult delete() throws
      Description copied from interface: BlobContainer
      Deletes this container and all its contents from the repository.
      Specified by:
      delete in interface BlobContainer
      Returns:
      delete result
      Throws:
      - on failure
    • deleteBlobsIgnoringIfNotExists

      public void deleteBlobsIgnoringIfNotExists(<> blobNames) throws
      Description copied from interface: BlobContainer
      Deletes the blobs with given names. This method will not throw an exception when one or multiple of the given blobs don't exist and simply ignore this case.
      Specified by:
      deleteBlobsIgnoringIfNotExists in interface BlobContainer
      Parameters:
      blobNames - the names of the blobs to delete
      Throws:
      - if a subset of blob exists but could not be deleted.
    • listBlobs

      public <,​BlobMetadata> listBlobs() throws
      Description copied from interface: BlobContainer
      Lists all blobs in the container.
      Specified by:
      listBlobs in interface BlobContainer
      Returns:
      A map of all the blobs in the container. The keys in the map are the names of the blobs and the values are BlobMetadata, containing basic information about each blob.
      Throws:
      - if there were any failures in reading from the blob container.
    • children

      public <,​BlobContainer> children() throws
      Description copied from interface: BlobContainer
      Lists all child containers under this container. A child container is defined as a container whose BlobContainer.path() method returns a path that has this containers BlobContainer.path() return as its prefix and has one more path element than the current container's path.
      Specified by:
      children in interface BlobContainer
      Returns:
      Map of name of the child container to child container
      Throws:
      - on failure to list child containers
    • listBlobsByPrefix

      public <,​ blobNamePrefix) throws
      Description copied from interface: BlobContainer
      Lists all blobs in the container that match the specified prefix.
      Specified by:
      listBlobsByPrefix in interface BlobContainer
      Parameters:
      blobNamePrefix - The prefix to match against blob names in the container.
      Returns:
      A map of the matching blobs in the container. The keys in the map are the names of the blobs and the values are BlobMetadata, containing basic information about each blob.
      Throws:
      - if there were any failures in reading from the blob container.