public class FileBlobStore extends AbstractBlobStore
AbstractBlobStore.BlockId, AbstractBlobStore.Data
BLOCK_SIZE_LIMIT, HASH_ALGORITHM, inUse, TYPE_DATA, TYPE_HASH
Constructor and Description |
---|
FileBlobStore(java.lang.String dir) |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clear the cache.
|
long |
countDeleteChunks(java.util.List<java.lang.String> chunkIds,
long maxLastModifiedTime)
Deletes the blobs with the given ids.
|
java.util.Iterator<java.lang.String> |
getAllChunkIds(long maxLastModifiedTime)
Gets all the identifiers.
|
protected 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.
|
java.lang.String |
writeBlob(java.lang.String tempFilePath)
Write a blob from a temporary file.
|
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
public java.lang.String writeBlob(java.lang.String tempFilePath) throws java.io.IOException
GarbageCollectableBlobStore
writeBlob
in interface GarbageCollectableBlobStore
writeBlob
in class AbstractBlobStore
tempFilePath
- the temporary file namejava.io.IOException
protected void storeBlock(byte[] digest, int level, byte[] data) throws java.io.IOException
AbstractBlobStore
storeBlock
in class AbstractBlobStore
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)java.io.IOException
protected byte[] readBlockFromBackend(AbstractBlobStore.BlockId id) throws java.io.IOException
AbstractBlobStore
readBlockFromBackend
in class AbstractBlobStore
id
- the block idjava.io.IOException
public void startMark() throws java.io.IOException
GarbageCollectableBlobStore
startMark
in interface GarbageCollectableBlobStore
startMark
in class AbstractBlobStore
java.io.IOException
protected boolean isMarkEnabled()
isMarkEnabled
in class AbstractBlobStore
protected void mark(AbstractBlobStore.BlockId id) throws java.io.IOException
mark
in class AbstractBlobStore
java.io.IOException
public int sweep() throws java.io.IOException
GarbageCollectableBlobStore
sweep
in interface GarbageCollectableBlobStore
sweep
in class AbstractBlobStore
java.io.IOException
public long countDeleteChunks(java.util.List<java.lang.String> chunkIds, long maxLastModifiedTime) throws java.lang.Exception
GarbageCollectableBlobStore
chunkIds
- the chunk idsmaxLastModifiedTime
- the max last modified time to consider for retrieval,
with the special value '0' meaning no filtering by timejava.lang.Exception
- the exceptionpublic java.util.Iterator<java.lang.String> getAllChunkIds(long maxLastModifiedTime) throws java.lang.Exception
GarbageCollectableBlobStore
maxLastModifiedTime
- the max last modified time to consider for retrieval,
with the special value '0' meaning no filtering by timejava.lang.Exception
- the exceptionpublic void clearCache()
GarbageCollectableBlobStore
Copyright © 2012–2022 The Apache Software Foundation. All rights reserved.