|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.mk.blobs.AbstractBlobStore
public abstract class AbstractBlobStore
An abstract data store that splits the binaries in relatively small blocks, so that each block fits in memory.
Each data store id is a list of zero or more entries. Each entry is either
The the format of a 'data' entry is: type (one byte; 0 for data), length (variable size int), data (bytes).
The format of a 'hash of content' entry is: type (one byte; 1 for hash), level (variable size int, 0 meaning not nested), size (variable size long), hash code length (variable size int), hash code.
The format of a 'hash of data store id' entry is: type (one byte; 1 for hash), level (variable size int, nesting level), total size (variable size long), size of data store id (variable size long), hash code length (variable size int), hash code.
| Nested Class Summary | |
|---|---|
static class |
AbstractBlobStore.BlockId
A block id. |
static class |
AbstractBlobStore.Data
The data for a block. |
| Field Summary | |
|---|---|
protected static int |
BLOCK_SIZE_LIMIT
|
protected static String |
HASH_ALGORITHM
|
protected Map<String,WeakReference<String>> |
inUse
|
protected static int |
TYPE_DATA
|
protected static int |
TYPE_HASH
|
protected static int |
TYPE_HASH_COMPRESSED
|
| Constructor Summary | |
|---|---|
AbstractBlobStore()
|
|
| Method Summary | |
|---|---|
void |
clearCache()
|
void |
clearInUse()
|
long |
getBlobLength(String blobId)
Get the length of the blob. |
int |
getBlockSize()
|
long |
getBlockSizeMin()
|
protected abstract boolean |
isMarkEnabled()
|
AbstractBlobStore.Data |
load(AbstractBlobStore.BlockId id)
Load the object. |
protected abstract void |
mark(AbstractBlobStore.BlockId id)
|
protected void |
mark(String blobId)
|
protected void |
markInUse()
|
int |
readBlob(String blobId,
long pos,
byte[] buff,
int off,
int length)
Read a number of bytes from a blob. |
protected abstract byte[] |
readBlockFromBackend(AbstractBlobStore.BlockId id)
Load the block from the storage backend. |
void |
setBlockSize(int x)
|
void |
setBlockSizeMin(int x)
|
abstract void |
startMark()
|
protected abstract void |
storeBlock(byte[] digest,
int level,
byte[] data)
|
abstract int |
sweep()
|
protected void |
usesBlobId(String blobId)
|
String |
writeBlob(InputStream in)
Write a blob from an input stream. |
String |
writeBlob(String tempFilePath)
Write a blob from a temporary file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String HASH_ALGORITHM
protected static final int TYPE_DATA
protected static final int TYPE_HASH
protected static final int TYPE_HASH_COMPRESSED
protected static final int BLOCK_SIZE_LIMIT
protected Map<String,WeakReference<String>> inUse
| Constructor Detail |
|---|
public AbstractBlobStore()
| Method Detail |
|---|
public void setBlockSizeMin(int x)
public long getBlockSizeMin()
public void setBlockSize(int x)
public int getBlockSize()
public String writeBlob(String tempFilePath)
throws Exception
tempFilePath - the temporary file
Exception
public String writeBlob(InputStream in)
throws Exception
BlobStore
writeBlob in interface BlobStorein - the input stream
Exceptionprotected void usesBlobId(String blobId)
public void clearInUse()
public void clearCache()
protected abstract void storeBlock(byte[] digest,
int level,
byte[] data)
throws Exception
Exception
public abstract void startMark()
throws Exception
Exception
public abstract int sweep()
throws Exception
Exceptionprotected abstract boolean isMarkEnabled()
protected abstract void mark(AbstractBlobStore.BlockId id)
throws Exception
Exception
protected void markInUse()
throws Exception
Exception
public int readBlob(String blobId,
long pos,
byte[] buff,
int off,
int length)
throws Exception
BlobStore
readBlob in interface BlobStoreblobId - the blob idpos - the position within the blobbuff - the target byte arrayoff - the offset within the target arraylength - the number of bytes to read
Exceptionpublic AbstractBlobStore.Data load(AbstractBlobStore.BlockId id)
Cache.Backend
load in interface Cache.Backend<AbstractBlobStore.BlockId,AbstractBlobStore.Data>id - the key
protected abstract byte[] readBlockFromBackend(AbstractBlobStore.BlockId id)
throws Exception
id - the block id
Exception
public long getBlobLength(String blobId)
throws IOException
BlobStore
getBlobLength in interface BlobStoreblobId - the blob id
IOException
protected void mark(String blobId)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||