net.metanotion.io.block.index
Class BSkipList

java.lang.Object
  extended by net.metanotion.util.skiplist.SkipList
      extended by 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.


Field Summary
 BlockFile bf
           
 int firstLevelPage
           
 int firstSpanPage
           
(package private)  HashMap<Integer,SkipLevels> levelHash
           
 int skipPage
           
(package private)  HashMap<Integer,BSkipSpan> spanHash
           
 
Fields inherited from class net.metanotion.util.skiplist.SkipList
first, P, rng, size, stack
 
Constructor Summary
BSkipList(int spanSize, BlockFile bf, int skipPage, Serializer key, Serializer val)
           
BSkipList(int spanSize, BlockFile bf, int skipPage, Serializer key, Serializer val, boolean fileOnly)
           
 
Method Summary
 void bslck(boolean isMeta, boolean fix)
           
 void close()
           
 void delete()
          must be open (do not call close() first)
 SkipIterator find(Comparable key)
           
 void flush()
           
static void init(BlockFile bf, int page, int spanSize)
           
 SkipIterator iterator()
           
 SkipIterator max()
           
 int maxLevels()
           
 SkipIterator min()
           
 String toString()
           
 
Methods inherited from class net.metanotion.util.skiplist.SkipList
addItem, balance, delItem, generateColHeight, get, print, printSL, put, remove, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

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
Method Detail

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 void bslck(boolean isMeta,
                  boolean fix)

toString

public String toString()
Overrides:
toString in class Object