K - the type of keys maintained by this skip level structureV - the type of mapped valuespublic class BSkipLevels<K extends Comparable<? super K>,V> extends SkipLevels<K,V>
Manages hierarchical structure of SkipList levels to provide efficient search paths through data structure.
On-disk format:
Magic number (long)
max height (unsigned short)
non-null height (unsigned short)
span page (unsigned int)
height number of level pages (unsigned ints)
Always fits on one page.
| Modifier and Type | Field and Description |
|---|---|
BlockFile | bfReference to the BlockFile |
(package private) static int | HEADER_LENFixed header length in bytes |
int | levelPagePage number of this level |
int | spanPagePage number of the associated span |
bottom, levels, MAX_SIZE| Constructor and Description |
|---|
BSkipLevels(BlockFile bf,
int levelPage,
BSkipList<K,V> bsl)Create a BSkipLevels and load it from disk. |
| Modifier and Type | Method and Description |
|---|---|
boolean | blvlck(boolean fix)Run an integrity check on this level. |
boolean | blvlck(boolean fix,
int width,
SkipLevels<K,V>[] prevLevels)Run an integrity check on this level with additional parameters. |
void | flush()Flush this level to disk. |
static void | init(BlockFile bf,
int page,
int spanPage,
int maxHeight)Initialize a new BSkipLevels page on disk. |
void | initializeLevels()Non-recursive initializer. |
void | killInstance()Mark this level as killed and free its resources. |
SkipLevels<K,V> | newInstance(int levels,
SkipSpan<K,V> ss,
SkipList<K,V> sl)Create a new instance of this level type. |
String | toString()Get a string representation of this level. |
public final BlockFile bf
static final int HEADER_LEN
public final int levelPage
public final int spanPage
public BSkipLevels(BlockFile bf, int levelPage, BSkipList<K,V> bsl) throws IOException
bf - the BlockFilelevelPage - the page number of this levelbsl - the BSkipListIOException - if an I/O error occurspublic boolean blvlck(boolean fix)
blvlck in class SkipLevels<K extends Comparable<? super K>,V>fix - if true, attempt to fix corruptionpublic boolean blvlck(boolean fix,
int width,
SkipLevels<K,V>[] prevLevels)blvlck in class SkipLevels<K extends Comparable<? super K>,V>fix - if true, attempt to fix corruptionwidth - the current widthprevLevels - previous levels to checkpublic void flush()
flush in interface Flushableflush in class SkipLevels<K extends Comparable<? super K>,V>public static void init(BlockFile bf, int page, int spanPage, int maxHeight) throws IOException
bf - the BlockFilepage - the page numberspanPage - the span page numbermaxHeight - the maximum heightIOException - if an I/O error occurspublic void initializeLevels()
public void killInstance()
killInstance in class SkipLevels<K extends Comparable<? super K>,V>public SkipLevels<K,V> newInstance(int levels, SkipSpan<K,V> ss, SkipList<K,V> sl)
newInstance in class SkipLevels<K extends Comparable<? super K>,V>levels - the number of levelsss - the SkipSpansl - the SkipList