net.metanotion.io.block.index
Class BSkipList
java.lang.Object
net.metanotion.util.skiplist.SkipList
net.metanotion.io.block.index.BSkipList
public class BSkipList
- extends SkipList
On-disk format:
Magic number (long)
first span page (unsigned int)
first level page (unsigned int)
size (unsigned int)
spans (unsigned int)
levels (unsigned int)
Always fits on one page.
firstSpanPage
public int firstSpanPage
firstLevelPage
public int firstLevelPage
skipPage
public int skipPage
bf
public final BlockFile bf
spanHash
final HashMap<Integer,BSkipSpan> spanHash
levelHash
final HashMap<Integer,SkipLevels> levelHash
BSkipList
public BSkipList(int spanSize,
BlockFile bf,
int skipPage,
Serializer key,
Serializer val)
throws IOException
- Throws:
IOException
BSkipList
public BSkipList(int spanSize,
BlockFile bf,
int skipPage,
Serializer key,
Serializer val,
boolean fileOnly)
throws IOException
- Throws:
IOException
close
public void close()
flush
public void flush()
- Overrides:
flush in class SkipList
delete
public void delete()
throws IOException
- must be open (do not call close() first)
- Throws:
IOException
init
public static void init(BlockFile bf,
int page,
int spanSize)
throws IOException
- Throws:
IOException
maxLevels
public int maxLevels()
- Overrides:
maxLevels in class SkipList
- Returns:
- log2(span count), minimum 4
iterator
public SkipIterator iterator()
- Overrides:
iterator in class SkipList
min
public SkipIterator min()
- Overrides:
min in class SkipList
max
public SkipIterator max()
- Overrides:
max in class SkipList
find
public SkipIterator find(Comparable key)
- Overrides:
find in class SkipList
- Returns:
- an iterator where nextKey() is the first one greater than or equal to 'key'
bslck
public boolean bslck(boolean fix,
boolean isMeta)
- Run an integrity check on the skiplist and all the levels in it
- Returns:
- true if the levels were modified.
toString
public String toString()
- Overrides:
toString in class Object