public class CloudBlobStore extends CachingBlobStore
BlobStore
to store blobs in a cloud blob store.
Extends AbstractBlobStore
and breaks the the binary to chunks for easier management.
AbstractBlobStore.BlockId, AbstractBlobStore.Data
blobCacheSize, cache, DEFAULT_CACHE_SIZE, MEM_CACHE_NAME
BLOCK_SIZE_LIMIT, HASH_ALGORITHM, inUse, TYPE_DATA, TYPE_HASH
Constructor and Description |
---|
CloudBlobStore() |
Modifier and Type | Method and Description |
---|---|
long |
countDeleteChunks(java.util.List<java.lang.String> chunkIds,
long maxLastModifiedTime)
Deletes the blobs with the given ids.
|
void |
deleteBucket()
Delete the cloud container and all its contents.
|
java.lang.String |
getAccessKey() |
java.util.Iterator<java.lang.String> |
getAllChunkIds(long maxLastModifiedTime)
Gets all the identifiers.
|
protected java.lang.String |
getCloudContainer() |
java.lang.String |
getCloudProvider() |
java.lang.String |
getSecretKey() |
void |
init()
Instantiates a connection to the cloud blob store.
|
protected boolean |
isMarkEnabled() |
protected void |
mark(AbstractBlobStore.BlockId id) |
protected byte[] |
readBlockFromBackend(AbstractBlobStore.BlockId blockId)
Reads the data from the actual cloud service.
|
void |
setAccessKey(java.lang.String accessKey) |
void |
setCloudContainer(java.lang.String cloudContainer) |
void |
setCloudProvider(java.lang.String cloudProvider) |
void |
setSecretKey(java.lang.String secretKey) |
void |
startMark()
Start the mark phase.
|
protected void |
storeBlock(byte[] digest,
int level,
byte[] data)
Uploads the block to the cloud service.
|
int |
sweep()
Remove all unused blocks.
|
clearCache, getBlobCacheSize, getCacheStats
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
protected java.lang.String getCloudContainer()
public void setCloudContainer(java.lang.String cloudContainer)
public java.lang.String getAccessKey()
public void setAccessKey(java.lang.String accessKey)
public java.lang.String getSecretKey()
public void setSecretKey(java.lang.String secretKey)
public java.lang.String getCloudProvider()
public void setCloudProvider(java.lang.String cloudProvider)
public void init() throws java.lang.Exception
java.lang.Exception
- if an error occursprotected void storeBlock(byte[] digest, int level, byte[] data) throws java.io.IOException
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 blockId) throws java.lang.Exception
readBlockFromBackend
in class AbstractBlobStore
blockId
- the block idjava.lang.Exception
public void deleteBucket()
public void startMark() throws java.io.IOException
GarbageCollectableBlobStore
startMark
in interface GarbageCollectableBlobStore
startMark
in class AbstractBlobStore
java.io.IOException
protected void mark(AbstractBlobStore.BlockId id) throws java.lang.Exception
mark
in class AbstractBlobStore
java.lang.Exception
public int sweep() throws java.io.IOException
GarbageCollectableBlobStore
sweep
in interface GarbageCollectableBlobStore
sweep
in class AbstractBlobStore
java.io.IOException
protected boolean isMarkEnabled()
isMarkEnabled
in class AbstractBlobStore
public 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 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 exceptionCopyright © 2012–2022 The Apache Software Foundation. All rights reserved.