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.CachingBlobStore
Implementation 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.String
COLLECTION_BLOBS
-
Constructor Summary
Constructors Constructor Description MongoBlobStore(@NotNull com.mongodb.client.MongoDatabase db, long cacheSize, @Nullable DocumentNodeStoreBuilder<?> builder)
Constructs a newMongoBlobStore
MongoBlobStore(com.mongodb.client.MongoDatabase db)
Constructs a newMongoBlobStore
MongoBlobStore(com.mongodb.client.MongoDatabase db, long cacheSize)
Constructs a newMongoBlobStore
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
countDeleteChunks(java.util.List<java.lang.String> chunkIds, long maxLastModifiedTime)
java.util.Iterator<java.lang.String>
getAllChunkIds(long maxLastModifiedTime)
protected boolean
isMarkEnabled()
protected void
mark(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId blockId)
protected byte[]
readBlockFromBackend(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore.BlockId blockId)
void
startMark()
protected void
storeBlock(byte[] digest, int level, byte[] data)
int
sweep()
-
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:
storeBlock
in 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:
readBlockFromBackend
in classorg.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
- Throws:
java.lang.Exception
-
startMark
public void startMark() throws java.io.IOException
- Specified by:
startMark
in interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
- Specified by:
startMark
in classorg.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
- Throws:
java.io.IOException
-
isMarkEnabled
protected boolean isMarkEnabled()
- Specified by:
isMarkEnabled
in 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:
mark
in classorg.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
- Throws:
java.lang.Exception
-
sweep
public int sweep() throws java.io.IOException
- Specified by:
sweep
in interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
- Specified by:
sweep
in 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
-
-