|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.metanotion.util.skiplist.SkipSpan
net.metanotion.io.block.index.BSkipSpan
net.metanotion.io.block.index.IBSkipSpan
public class IBSkipSpan
I2P version of BSkipSpan BSkipSpan stores all keys and values in-memory, backed by the file. IBSkipSpan stores only the first key, and no values, in-memory. For a get(), here we do a linear search through the span in the file and load only the found value (super() does a binary search in-memory). For a put() or remove(), we load all keys and values for the span from the file, make the modification, flush() out the keys and values, and null out the keys and values in-memory. Recommended span size is 16.
Field Summary |
---|
Fields inherited from class net.metanotion.io.block.index.BSkipSpan |
---|
bf, CONT_HEADER_LEN, HEADER_LEN, isKilled, keySer, MAGIC, nextPage, overflowPage, page, prevPage, spanSize, valSer |
Fields inherited from class net.metanotion.util.skiplist.SkipSpan |
---|
keys, MAX_SIZE, next, nKeys, prev, vals |
Constructor Summary | |
---|---|
IBSkipSpan(BlockFile bf,
BSkipList bsl,
int spanPage,
Serializer key,
Serializer val)
|
Method Summary | |
---|---|
Comparable |
firstKey()
Does not call super, we always store first key here |
void |
flush()
Flush to disk and null out in-memory keys and values, saving only the first key |
Object |
get(Comparable key)
Linear search if in file, Binary search if in memory |
SkipSpan |
getSpan(Comparable key,
int[] search)
Load whole span from file, do the operation, flush out, then null out in-memory data again. |
protected void |
loadData()
I2P - second half of load() Load the whole span's keys and values into memory |
SkipSpan |
newInstance(SkipList sl)
|
SkipSpan |
put(Comparable key,
Object val,
SkipList sl)
Load whole span from file, do the operation, flush out, then null out in-memory data again. |
Object[] |
remove(Comparable key,
SkipList sl)
Load whole span from file, do the operation, flush out, then null out in-memory data again. |
(package private) void |
seekAndLoadData()
Seek to the start of the span and load the data Package private so BSkipIterator can call it |
Methods inherited from class net.metanotion.io.block.index.BSkipSpan |
---|
init, killInstance, loadData, loadInit, lostEntries, toString |
Methods inherited from class net.metanotion.util.skiplist.SkipSpan |
---|
getEnd, print |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IBSkipSpan(BlockFile bf, BSkipList bsl, int spanPage, Serializer key, Serializer val) throws IOException
IOException
Method Detail |
---|
public SkipSpan newInstance(SkipList sl)
newInstance
in class BSkipSpan
public void flush()
flush
in class BSkipSpan
protected void loadData() throws IOException
loadData
in class BSkipSpan
IOException
void seekAndLoadData() throws IOException
IOException
public Comparable firstKey()
firstKey
in class SkipSpan
public SkipSpan getSpan(Comparable key, int[] search)
getSpan
in class SkipSpan
public Object get(Comparable key)
get
in class SkipSpan
public SkipSpan put(Comparable key, Object val, SkipList sl)
put
in class SkipSpan
public Object[] remove(Comparable key, SkipList sl)
remove
in class SkipSpan
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |