Class MongoBlobStore
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
-
- org.apache.jackrabbit.oak.plugins.blob.CachingBlobStore
-
- org.apache.jackrabbit.oak.plugins.document.mongo.MongoBlobStore
-
- 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 MongoBlobStore extends org.apache.jackrabbit.oak.plugins.blob.CachingBlobStoreImplementation of blob store for the MongoDB extending fromCachingBlobStore. It saves blobs into a separate collection in MongoDB (not using GridFS) and it supports basic garbage collection. FIXME: -Do we need to create commands for retry etc.? -Not sure if this is going to work for multiple MKs talking to same MongoDB?
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOLLECTION_BLOBS
-
Constructor Summary
Constructors Constructor Description MongoBlobStore(@NotNull com.mongodb.client.MongoDatabase db, long cacheSize, @Nullable DocumentNodeStoreBuilder<?> builder)Constructs a newMongoBlobStoreMongoBlobStore(com.mongodb.client.MongoDatabase db)Constructs a newMongoBlobStoreMongoBlobStore(com.mongodb.client.MongoDatabase db, long cacheSize)Constructs a newMongoBlobStore
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcountDeleteChunks(java.util.List<java.lang.String> chunkIds, long maxLastModifiedTime)java.util.Iterator<java.lang.String>getAllChunkIds(long maxLastModifiedTime)protected booleanisMarkEnabled()protected voidmark(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId blockId)protected byte[]readBlockFromBackend(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId blockId)voidstartMark()protected voidstoreBlock(byte[] digest, int level, byte[] data)intsweep()-
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, 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
-
-
-
-
Field Detail
-
COLLECTION_BLOBS
public static final java.lang.String COLLECTION_BLOBS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MongoBlobStore
public MongoBlobStore(com.mongodb.client.MongoDatabase db)
Constructs a newMongoBlobStore- Parameters:
db- the database
-
MongoBlobStore
public MongoBlobStore(com.mongodb.client.MongoDatabase db, long cacheSize)Constructs a newMongoBlobStore- Parameters:
db- the databasecacheSize- the cache size
-
MongoBlobStore
public MongoBlobStore(@NotNull @NotNull com.mongodb.client.MongoDatabase db, long cacheSize, @Nullable @Nullable DocumentNodeStoreBuilder<?> builder)Constructs a newMongoBlobStore- Parameters:
db- the databasecacheSize- the cache sizebuilder-DocumentNodeStoreBuilder, supplying further options
-
-
Method Detail
-
storeBlock
protected void storeBlock(byte[] digest, int level, byte[] data) throws java.io.IOException- Specified by:
storeBlockin classorg.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- Specified by:
readBlockFromBackendin classorg.apache.jackrabbit.oak.spi.blob.AbstractBlobStore- Throws:
java.lang.Exception
-
startMark
public void startMark() throws java.io.IOException- Specified by:
startMarkin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Specified by:
startMarkin classorg.apache.jackrabbit.oak.spi.blob.AbstractBlobStore- Throws:
java.io.IOException
-
isMarkEnabled
protected boolean isMarkEnabled()
- Specified by:
isMarkEnabledin classorg.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
-
mark
protected void mark(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId blockId) throws java.lang.Exception- Specified by:
markin classorg.apache.jackrabbit.oak.spi.blob.AbstractBlobStore- Throws:
java.lang.Exception
-
sweep
public int sweep() throws java.io.IOException- Specified by:
sweepin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Specified by:
sweepin classorg.apache.jackrabbit.oak.spi.blob.AbstractBlobStore- Throws:
java.io.IOException
-
countDeleteChunks
public long countDeleteChunks(java.util.List<java.lang.String> chunkIds, long maxLastModifiedTime) throws java.lang.Exception- Throws:
java.lang.Exception
-
getAllChunkIds
public java.util.Iterator<java.lang.String> getAllChunkIds(long maxLastModifiedTime) throws java.lang.Exception- Throws:
java.lang.Exception
-
-