public class FileBlobStore extends AbstractBlobStore
AbstractBlobStore.BlockId, AbstractBlobStore.Data
BLOCK_SIZE_LIMIT, HASH_ALGORITHM, inUse, TYPE_DATA, TYPE_HASH, TYPE_HASH_COMPRESSED
Constructor and Description |
---|
FileBlobStore(String dir) |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clear the cache.
|
boolean |
deleteChunks(List<String> chunkIds,
long maxLastModifiedTime)
Deletes the blobs with the given ids.
|
Iterator<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.
|
String |
writeBlob(String tempFilePath)
Write a blob from a temporary file.
|
clearInUse, getBlobId, getBlobLength, getBlockSize, getBlockSizeMin, getInputStream, getOrCreateReferenceKey, getReference, load, mark, markInUse, readBlob, resolveChunks, setBlockSize, setBlockSizeMin, setReferenceKey, setReferenceKeyEncoded, setReferenceKeyPlainText, usesBlobId, writeBlob
public FileBlobStore(String dir)
public String writeBlob(String tempFilePath) throws IOException
GarbageCollectableBlobStore
writeBlob
in interface GarbageCollectableBlobStore
writeBlob
in class AbstractBlobStore
tempFilePath
- the temporary file nameIOException
protected void storeBlock(byte[] digest, int level, byte[] data) throws IOException
AbstractBlobStore
storeBlock
in class AbstractBlobStore
digest
- the content hashlevel
- 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 storedIOException
protected byte[] readBlockFromBackend(AbstractBlobStore.BlockId id) throws IOException
AbstractBlobStore
readBlockFromBackend
in class AbstractBlobStore
id
- the block idIOException
public void startMark() throws IOException
GarbageCollectableBlobStore
startMark
in interface GarbageCollectableBlobStore
startMark
in class AbstractBlobStore
IOException
protected boolean isMarkEnabled()
isMarkEnabled
in class AbstractBlobStore
protected void mark(AbstractBlobStore.BlockId id) throws IOException
mark
in class AbstractBlobStore
IOException
public int sweep() throws IOException
GarbageCollectableBlobStore
sweep
in interface GarbageCollectableBlobStore
sweep
in class AbstractBlobStore
IOException
public boolean deleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception
GarbageCollectableBlobStore
chunkIds
- the chunk idsmaxLastModifiedTime
- the max last modified time to consider for retrievalException
- the exceptionpublic Iterator<String> getAllChunkIds(long maxLastModifiedTime) throws Exception
GarbageCollectableBlobStore
maxLastModifiedTime
- the max last modified time to consider for retrievalException
- the exceptionpublic void clearCache()
GarbageCollectableBlobStore
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.