|
||||||||||
| 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 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 | |
|---|---|
String |
addBlob(String tempFilePath)
Write a blob from a temporary file. |
void |
clearCache()
|
void |
clearInUse()
|
void |
close()
|
long |
getBlobLength(String blobId)
|
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)
|
protected abstract byte[] |
readBlockFromBackend(AbstractBlobStore.BlockId id)
|
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. |
| 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 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 addBlob(String tempFilePath)
throws Exception
BlobStore
addBlob in interface BlobStoretempFilePath - 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
readBlob in interface BlobStoreExceptionpublic 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
Exception
public long getBlobLength(String blobId)
throws IOException
getBlobLength in interface BlobStoreIOException
protected void mark(String blobId)
throws IOException
IOExceptionpublic void close()
close in interface Closeableclose in interface BlobStore
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||