public class HeapReader
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HeapReader.entries
static iterator of entries in BLOBHeap files:
this is used to import heap dumps into a write-enabled index heap
|
static class |
HeapReader.entry |
Modifier and Type | Field and Description |
---|---|
private java.util.Date |
closeDate |
protected Writer |
file |
private java.io.File |
fingerprintFileGap |
private java.io.File |
fingerprintFileIdx |
protected Gap |
free |
protected java.io.File |
heapFile |
protected HandleMap |
index |
protected int |
keylength |
private static ConcurrentLog |
log |
protected ByteOrder |
ordering |
private static byte |
zero |
Constructor and Description |
---|
HeapReader(java.io.File heapFile,
int keylength,
ByteOrder ordering) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkKey(byte[] key,
long pos) |
void |
close() |
void |
close(boolean writeIDX)
close the BLOB table
|
boolean |
containsKey(byte[] key)
test if a key is in the heap file.
|
private static void |
deleteAllFingerprints(java.io.File f,
java.lang.String exception1,
java.lang.String exception2) |
void |
deleteFingerprint()
deletion of the fingerprint: this should happen if the heap is written or entries are deleted
if the files are not deleted then it may be possible that they are not used anyway because the
fingerprint hash does not fit with the heap dump file hash.
|
void |
finalize() |
protected static java.lang.String |
fingerprintFileHash(java.io.File f) |
protected byte[] |
first()
find a special blob in the heap: one that has the smallest key
this method is useful if the entries are ordered using their keys.
|
protected byte[] |
firstKey()
find a special key in the heap: the one with the smallest key
this method is useful if the entries are ordered using their keys.
|
byte[] |
get(byte[] key)
read a blob from the heap
|
byte[] |
get(java.lang.Object key) |
private boolean |
initIndexReadDump() |
private void |
initIndexReadFromHeap() |
boolean |
isEmpty() |
int |
keylength()
ask for the length of the primary key
|
CloneableIterator<byte[]> |
keys(boolean up,
boolean rotating)
iterator over all keys
|
CloneableIterator<byte[]> |
keys(boolean up,
byte[] firstKey)
iterate over all keys
|
protected byte[] |
last()
find a special blob in the heap: one that has the largest key
this method is useful if the entries are ordered using their keys.
|
protected byte[] |
lastKey()
find a special key in the heap: the one with the largest key
this method is useful if the entries are ordered using their keys.
|
long |
length() |
long |
length(byte[] key)
retrieve the size of the BLOB.
|
java.io.File |
location() |
static void |
main(java.lang.String[] args) |
long |
mem() |
private void |
mergeFreeEntries() |
java.lang.String |
name() |
protected byte[] |
normalizeKey(byte[] key) |
protected static byte[] |
normalizeKey(byte[] key,
int keylength) |
void |
optimize() |
ByteOrder |
ordering() |
int |
size()
the number of BLOBs in the heap
|
private static final ConcurrentLog log
protected int keylength
protected java.io.File heapFile
protected final ByteOrder ordering
protected Writer file
protected HandleMap index
protected Gap free
private java.io.File fingerprintFileIdx
private java.io.File fingerprintFileGap
private java.util.Date closeDate
private static final byte zero
public HeapReader(java.io.File heapFile, int keylength, ByteOrder ordering) throws java.io.IOException
java.io.IOException
public long mem()
public void optimize()
protected byte[] normalizeKey(byte[] key)
protected static byte[] normalizeKey(byte[] key, int keylength)
private boolean initIndexReadDump()
public void deleteFingerprint()
protected static java.lang.String fingerprintFileHash(java.io.File f)
private static void deleteAllFingerprints(java.io.File f, java.lang.String exception1, java.lang.String exception2)
private void initIndexReadFromHeap() throws java.io.IOException
java.io.IOException
private void mergeFreeEntries() throws java.io.IOException
java.io.IOException
public java.lang.String name()
public java.io.File location()
public int size()
public boolean isEmpty()
public boolean containsKey(byte[] key)
key
- public ByteOrder ordering()
protected byte[] firstKey() throws java.io.IOException
java.io.IOException
protected byte[] first() throws java.io.IOException, SpaceExceededException
java.io.IOException
SpaceExceededException
protected byte[] lastKey() throws java.io.IOException
java.io.IOException
protected byte[] last() throws java.io.IOException, SpaceExceededException
java.io.IOException
SpaceExceededException
public byte[] get(byte[] key) throws java.io.IOException, SpaceExceededException
key
- java.io.IOException
SpaceExceededException
public byte[] get(java.lang.Object key)
protected boolean checkKey(byte[] key, long pos) throws java.io.IOException
java.io.IOException
public long length(byte[] key) throws java.io.IOException
key
- java.io.IOException
public void close(boolean writeIDX)
public void close()
public void finalize()
finalize
in class java.lang.Object
public int keylength()
public CloneableIterator<byte[]> keys(boolean up, boolean rotating) throws java.io.IOException
up
- rotating
- java.io.IOException
public CloneableIterator<byte[]> keys(boolean up, byte[] firstKey) throws java.io.IOException
up
- firstKey
- java.io.IOException
public long length()
public static void main(java.lang.String[] args)