Class RDBBlobStore
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
-
- org.apache.jackrabbit.oak.plugins.blob.CachingBlobStore
-
- org.apache.jackrabbit.oak.plugins.document.rdb.RDBBlobStore
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Cache.Backend<AbstractBlobStore.BlockId,AbstractBlobStore.Data>,BlobStore,GarbageCollectableBlobStore
public class RDBBlobStore extends CachingBlobStore implements Closeable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
AbstractBlobStore.BlockId, AbstractBlobStore.Data
-
-
Field Summary
Fields Modifier and Type Field Description protected RDBConnectionHandlerchprotected static intIDSIZEprotected StringtnDataprotected StringtnMeta-
Fields inherited from class org.apache.jackrabbit.oak.plugins.blob.CachingBlobStore
blobCacheSize, cache, DEFAULT_CACHE_SIZE, MEM_CACHE_NAME
-
Fields inherited from class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
BLOCK_SIZE_LIMIT, HASH_ALGORITHM, inUse, TYPE_DATA, TYPE_HASH
-
-
Constructor Summary
Constructors Constructor Description RDBBlobStore(@NotNull DataSource ds)Creates a RDBBlobStore instance using the providedDataSourceusing defaultDocumentNodeStoreBuilderandRDBOptions.RDBBlobStore(@NotNull DataSource ds, @Nullable DocumentNodeStoreBuilder<?> builder, @Nullable RDBOptions options)Creates a RDBBlobStore instance using the providedDataSourceusing the givenDocumentNodeStoreBuilderandRDBOptions.RDBBlobStore(@NotNull DataSource ds, @Nullable RDBOptions options)Creates a RDBBlobStore instance using the providedDataSourceusing defaultDocumentNodeStoreBuilderand the givenRDBOptions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longcountDeleteChunks(List<String> chunkIds, long maxLastModifiedTime)Deletes the blobs with the given ids.protected voidfinalize()Iterator<String>getAllChunkIds(long maxLastModifiedTime)Gets all the identifiers.protected booleanisMarkEnabled()protected voidmark(AbstractBlobStore.BlockId blockId)protected byte[]readBlockFromBackend(byte[] digest)protected byte[]readBlockFromBackend(AbstractBlobStore.BlockId blockId)Load the block from the storage backend.voidstartMark()Start the mark phase.protected voidstoreBlock(byte[] digest, int level, byte[] data)Store a block of data.intsweep()Remove all unused blocks.-
Methods inherited from class org.apache.jackrabbit.oak.plugins.blob.CachingBlobStore
clearCache, getBlobCacheSize, getCacheStats
-
Methods inherited from class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
clearInUse, deleteChunks, getBlobId, getBlobLength, getBlockSize, getBlockSizeMin, getInputStream, getOrCreateReferenceKey, getReference, getStatsCollector, load, mark, markInUse, readBlob, resolveChunks, setBlockSize, setBlockSizeMin, setReferenceKey, setReferenceKeyEncoded, setReferenceKeyPlainText, setStatsCollector, usesBlobId, writeBlob, writeBlob, writeBlob
-
-
-
-
Field Detail
-
IDSIZE
protected static final int IDSIZE
-
ch
protected RDBConnectionHandler ch
-
tnData
protected String tnData
-
tnMeta
protected String tnMeta
-
-
Constructor Detail
-
RDBBlobStore
public RDBBlobStore(@NotNull @NotNull DataSource ds, @Nullable @Nullable DocumentNodeStoreBuilder<?> builder, @Nullable @Nullable RDBOptions options)Creates a RDBBlobStore instance using the providedDataSourceusing the givenDocumentNodeStoreBuilderandRDBOptions.
-
RDBBlobStore
public RDBBlobStore(@NotNull @NotNull DataSource ds, @Nullable @Nullable RDBOptions options)Creates a RDBBlobStore instance using the providedDataSourceusing defaultDocumentNodeStoreBuilderand the givenRDBOptions.
-
RDBBlobStore
public RDBBlobStore(@NotNull @NotNull DataSource ds)Creates a RDBBlobStore instance using the providedDataSourceusing defaultDocumentNodeStoreBuilderandRDBOptions.
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractBlobStore
-
finalize
protected void finalize() throws Throwable
-
storeBlock
protected void storeBlock(byte[] digest, int level, byte[] data) throws IOExceptionDescription copied from class:AbstractBlobStoreStore a block of data.- Specified by:
storeBlockin classAbstractBlobStore- Parameters:
digest- the content hash (32 bytes)level- the indirection level (0 is for user data, 1 is a list of digests that point to user data, 2 is a list of digests that point to digests, and so on). This parameter is for informational use only, and it is not required to store it unless that's easy to achievedata- the data to be stored (the number of bytes is at most the block size)- Throws:
IOException
-
readBlockFromBackend
protected byte[] readBlockFromBackend(byte[] digest) throws Exception- Throws:
Exception
-
readBlockFromBackend
protected byte[] readBlockFromBackend(AbstractBlobStore.BlockId blockId) throws Exception
Description copied from class:AbstractBlobStoreLoad the block from the storage backend. Returns null if the block was not found.- Specified by:
readBlockFromBackendin classAbstractBlobStore- Parameters:
blockId- the block id- Returns:
- the block data, or null
- Throws:
Exception
-
startMark
public void startMark() throws IOExceptionDescription copied from interface:GarbageCollectableBlobStoreStart the mark phase.- Specified by:
startMarkin interfaceGarbageCollectableBlobStore- Specified by:
startMarkin classAbstractBlobStore- Throws:
IOException
-
isMarkEnabled
protected boolean isMarkEnabled()
- Specified by:
isMarkEnabledin classAbstractBlobStore
-
mark
protected void mark(AbstractBlobStore.BlockId blockId) throws Exception
- Specified by:
markin classAbstractBlobStore- Throws:
Exception
-
sweep
public int sweep() throws IOExceptionDescription copied from interface:GarbageCollectableBlobStoreRemove all unused blocks.- Specified by:
sweepin interfaceGarbageCollectableBlobStore- Specified by:
sweepin classAbstractBlobStore- Returns:
- the number of removed blocks
- Throws:
IOException
-
countDeleteChunks
public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception
Description copied from interface:GarbageCollectableBlobStoreDeletes the blobs with the given ids.- Specified by:
countDeleteChunksin interfaceGarbageCollectableBlobStore- Parameters:
chunkIds- the chunk idsmaxLastModifiedTime- the max last modified time to consider for retrieval, with the special value '0' meaning no filtering by time- Returns:
- long the count of successful deletions
- Throws:
Exception- the exception
-
getAllChunkIds
public Iterator<String> getAllChunkIds(long maxLastModifiedTime) throws Exception
Description copied from interface:GarbageCollectableBlobStoreGets all the identifiers.- Specified by:
getAllChunkIdsin interfaceGarbageCollectableBlobStore- Parameters:
maxLastModifiedTime- the max last modified time to consider for retrieval, with the special value '0' meaning no filtering by time- Returns:
- the identifiers
- Throws:
Exception- the exception
-
-