Class CloudBlobStore

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.apache.jackrabbit.oak.commons.cache.Cache.Backend<org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId,​org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.Data>, org.apache.jackrabbit.oak.spi.blob.BlobStore, org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore

    public class CloudBlobStore
    extends CachingBlobStore
    Implementation of the BlobStore to store blobs in a cloud blob store.

    Extends AbstractBlobStore and breaks the the binary to chunks for easier management.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore

        org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId, org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.Data
    • Constructor Summary

      Constructors 
      Constructor Description
      CloudBlobStore()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long countDeleteChunks​(java.util.List<java.lang.String> chunkIds, long maxLastModifiedTime)  
      void deleteBucket()
      Delete the cloud container and all its contents.
      java.lang.String getAccessKey()  
      java.util.Iterator<java.lang.String> getAllChunkIds​(long maxLastModifiedTime)  
      protected java.lang.String getCloudContainer()  
      java.lang.String getCloudProvider()  
      java.lang.String getSecretKey()  
      void init()
      Instantiates a connection to the cloud blob store.
      protected boolean isMarkEnabled()  
      protected void mark​(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId id)  
      protected byte[] readBlockFromBackend​(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId blockId)
      Reads the data from the actual cloud service.
      void setAccessKey​(java.lang.String accessKey)  
      void setCloudContainer​(java.lang.String cloudContainer)  
      void setCloudProvider​(java.lang.String cloudProvider)  
      void setSecretKey​(java.lang.String secretKey)  
      void startMark()  
      protected void storeBlock​(byte[] digest, int level, byte[] data)
      Uploads the block to the cloud service.
      int sweep()  
      • Methods inherited from class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore

        clearInUse, close, deleteChunks, getBlobId, getBlobLength, getBlockSize, getBlockSizeMin, getInputStream, getOrCreateReferenceKey, getReference, getStatsCollector, load, mark, markInUse, readBlob, resolveChunks, setBlockSize, setBlockSizeMin, setReferenceKey, setReferenceKeyEncoded, setReferenceKeyPlainText, setStatsCollector, usesBlobId, writeBlob, writeBlob, writeBlob
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CloudBlobStore

        public CloudBlobStore()
    • Method Detail

      • getCloudContainer

        protected java.lang.String getCloudContainer()
      • setCloudContainer

        public void setCloudContainer​(java.lang.String cloudContainer)
      • getAccessKey

        public java.lang.String getAccessKey()
      • setAccessKey

        public void setAccessKey​(java.lang.String accessKey)
      • getSecretKey

        public java.lang.String getSecretKey()
      • setSecretKey

        public void setSecretKey​(java.lang.String secretKey)
      • getCloudProvider

        public java.lang.String getCloudProvider()
      • setCloudProvider

        public void setCloudProvider​(java.lang.String cloudProvider)
      • init

        public void init()
                  throws java.lang.Exception
        Instantiates a connection to the cloud blob store.
        Throws:
        java.lang.Exception - if an error occurs
      • storeBlock

        protected void storeBlock​(byte[] digest,
                                  int level,
                                  byte[] data)
                           throws java.io.IOException
        Uploads the block to the cloud service.
        Specified by:
        storeBlock in class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
        Throws:
        java.io.IOException
      • readBlockFromBackend

        protected byte[] readBlockFromBackend​(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId blockId)
                                       throws java.lang.Exception
        Reads the data from the actual cloud service.
        Specified by:
        readBlockFromBackend in class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
        Throws:
        java.lang.Exception
      • deleteBucket

        public void deleteBucket()
        Delete the cloud container and all its contents.
      • startMark

        public void startMark()
                       throws java.io.IOException
        Specified by:
        startMark in interface org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
        Specified by:
        startMark in class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
        Throws:
        java.io.IOException
      • mark

        protected void mark​(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId id)
                     throws java.lang.Exception
        Specified by:
        mark in class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
        Throws:
        java.lang.Exception
      • sweep

        public int sweep()
                  throws java.io.IOException
        Specified by:
        sweep in interface org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
        Specified by:
        sweep in class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
        Throws:
        java.io.IOException
      • isMarkEnabled

        protected boolean isMarkEnabled()
        Specified by:
        isMarkEnabled in class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
      • getAllChunkIds

        public java.util.Iterator<java.lang.String> getAllChunkIds​(long maxLastModifiedTime)
                                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • countDeleteChunks

        public long countDeleteChunks​(java.util.List<java.lang.String> chunkIds,
                                      long maxLastModifiedTime)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception