Class AbstractBlobStore

    • Field Detail

      • BYTE_RANGE_SEP

        public static final char BYTE_RANGE_SEP
        Separator between key and byte range (start/end, specified at end of key).

        Used when the blob provider is configured to allow byte ranges.

        See Also:
        Constant Field Values
      • blobProviderId

        protected final String blobProviderId
      • name

        protected final String name
    • Constructor Detail

      • AbstractBlobStore

        public AbstractBlobStore​(String name,
                                 KeyStrategy keyStrategy)
      • AbstractBlobStore

        public AbstractBlobStore​(String blobProviderId,
                                 String name,
                                 KeyStrategy keyStrategy)
        Since:
        11.5
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: BlobStore
        Name used for debugging / tracing.
        Specified by:
        getName in interface BlobStore
      • logTrace

        protected void logTrace​(String arrow,
                                String message)
      • logTrace

        protected void logTrace​(String message)
      • hasVersioning

        public boolean hasVersioning()
        Description copied from interface: BlobStore
        Whether this blob store has versioning.

        With versioning, two writes may use the same key. The returned keys will include a different version number to distinguish the writes.

        Specified by:
        hasVersioning in interface BlobStore
      • unwrap

        public BlobStore unwrap()
        Description copied from interface: BlobStore
        If this blob store wraps another one, returns it, otherwise returns this.
        Specified by:
        unwrap in interface BlobStore
        Returns:
        the lowest-level blob store
      • writeBlob

        public String writeBlob​(BlobWriteContext blobWriteContext)
                         throws IOException
        Description copied from interface: BlobStore
        Writes a blob.

        Note that the returned key may be different than the one requested by the BlobWriteContext, if the blob store needs additional version info to retrieve it.

        Specified by:
        writeBlob in interface BlobStore
        Parameters:
        blobWriteContext - the context of the blob write, including the blob
        Returns:
        the key to use to read this blob in the future
        Throws:
        IOException
      • writeBlobUsingOptimizedCopy

        protected String writeBlobUsingOptimizedCopy​(BlobWriteContext blobWriteContext)
                                              throws IOException
        Tries to do an optimize copy to write this blob. Returns null if that's not possible.
        Throws:
        IOException
        Since:
        11.5
      • useAsyncDigest

        public boolean useAsyncDigest()
        Whether this blob store is configured for async digest computation.
        Since:
        11.5
      • deleteBlob

        public void deleteBlob​(BlobContext blobContext)
        Description copied from interface: BlobStore
        Deletes a blob.
        Specified by:
        deleteBlob in interface BlobStore
        Parameters:
        blobContext - the blob context
      • copyBlobIsOptimized

        public boolean copyBlobIsOptimized​(BlobStore sourceStore)
        Description copied from interface: BlobStore
        Checks if blob copy/move from another blob store to this one can be done efficiently.
        Specified by:
        copyBlobIsOptimized in interface BlobStore
        Parameters:
        sourceStore - the source store
        Returns:
        true if the copy/move can be done efficiently
      • stripBlobKeyPrefix

        protected String stripBlobKeyPrefix​(String key)
      • stripBlobKeyVersionSuffix

        protected String stripBlobKeyVersionSuffix​(String key)
      • getByteRangeFromKey

        public static ByteRange getByteRangeFromKey​(org.apache.commons.lang3.mutable.MutableObject<String> keyHolder)
      • randomString

        protected String randomString()
        Returns a random string suitable as a key.
      • randomLong

        protected long randomLong()
        Returns a random positive long.
      • transfer

        public void transfer​(BlobWriteContext blobWriteContext,
                             Path dest)
                      throws IOException
        Transfers a blob to a file, notifying an observer while doing this.
        Parameters:
        blobWriteContext - the blob write context, to get the blob stream and write observer
        dest - the destination file
        Throws:
        IOException
      • transfer

        public void transfer​(BlobWriteContext blobWriteContext,
                             OutputStream out)
                      throws IOException
        Transfers a blob to an output stream, notifying an observer while doing this.
        Parameters:
        blobWriteContext - the blob write context, to get the blob stream and write observer
        out - the output stream
        Throws:
        IOException
      • notifyAsyncDigest

        protected void notifyAsyncDigest​(String key)
      • getBlobKeyReplacement

        protected String getBlobKeyReplacement​(String key)
        A key may have been replaced by an async digest computation, use the new one.