Class MemoryBlobStore
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
-
- org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,Cache.Backend<AbstractBlobStore.BlockId,AbstractBlobStore.Data>
,BlobStore
,GarbageCollectableBlobStore
public class MemoryBlobStore extends AbstractBlobStore
A memory blob store. Useful for testing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore
AbstractBlobStore.BlockId, AbstractBlobStore.Data
-
-
Field Summary
-
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 MemoryBlobStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
Clear the cache.long
countDeleteChunks(java.util.List<java.lang.String> chunkIds, long maxLastModifiedTime)
Ignores the maxlastModifiedTimejava.util.Iterator<java.lang.String>
getAllChunkIds(long maxLastModifiedTime)
Ignores the maxlastModifiedTimeprotected boolean
isMarkEnabled()
protected void
mark(AbstractBlobStore.BlockId id)
protected byte[]
readBlockFromBackend(AbstractBlobStore.BlockId id)
Load the block from the storage backend.void
startMark()
Start the mark phase.protected void
storeBlock(byte[] digest, int level, byte[] data)
Store a block of data.int
sweep()
Remove all unused blocks.-
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
-
-
-
-
Method Detail
-
readBlockFromBackend
protected byte[] readBlockFromBackend(AbstractBlobStore.BlockId id)
Description copied from class:AbstractBlobStore
Load the block from the storage backend. Returns null if the block was not found.- Specified by:
readBlockFromBackend
in classAbstractBlobStore
- Parameters:
id
- the block id- Returns:
- the block data, or null
-
storeBlock
protected void storeBlock(byte[] digest, int level, byte[] data)
Description copied from class:AbstractBlobStore
Store a block of data.- Specified by:
storeBlock
in 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)
-
startMark
public void startMark() throws java.io.IOException
Description copied from interface:GarbageCollectableBlobStore
Start the mark phase.- Specified by:
startMark
in interfaceGarbageCollectableBlobStore
- Specified by:
startMark
in classAbstractBlobStore
- Throws:
java.io.IOException
-
isMarkEnabled
protected boolean isMarkEnabled()
- Specified by:
isMarkEnabled
in classAbstractBlobStore
-
mark
protected void mark(AbstractBlobStore.BlockId id)
- Specified by:
mark
in classAbstractBlobStore
-
sweep
public int sweep()
Description copied from interface:GarbageCollectableBlobStore
Remove all unused blocks.- Specified by:
sweep
in interfaceGarbageCollectableBlobStore
- Specified by:
sweep
in classAbstractBlobStore
- Returns:
- the number of removed blocks
-
countDeleteChunks
public long countDeleteChunks(java.util.List<java.lang.String> chunkIds, long maxLastModifiedTime) throws java.lang.Exception
Ignores the maxlastModifiedTime- 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:
java.lang.Exception
- the exception
-
getAllChunkIds
public java.util.Iterator<java.lang.String> getAllChunkIds(long maxLastModifiedTime) throws java.lang.Exception
Ignores the maxlastModifiedTime- 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:
java.lang.Exception
- the exception
-
clearCache
public void clearCache()
Description copied from interface:GarbageCollectableBlobStore
Clear the cache.
-
-