|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.openrdf.sesame.sailimpl.nativerdf.btree.BTree
Implementation of an on-disk B-Tree using the java.nio classes that are available in JDK 1.4 and newer. Documentation about B-Trees can be found on-line at the following URLs:
TODO: clean up code, reuse discarded nodes
| Constructor Summary | |
BTree(File dataFile,
int blockSize,
int valueSize)
Creates a new BTree that uses an instance of DefaultBTreeValueComparator to compare values. |
|
BTree(File dataFile,
int blockSize,
int valueSize,
BTreeValueComparator comparator)
Creates a new BTree that uses the supplied BTreeValueComparator to compare the values that are or will be stored in the B-Tree. |
|
| Method Summary | |
void |
clear()
Removes all values from the B-Tree. |
void |
close()
Closes any opened files and release any resources used by this B-Tree. |
void |
commitTransaction()
|
byte[] |
get(byte[] key)
Gets the value that matches the specified key. |
byte[] |
insert(byte[] value)
Inserts the supplied value into the B-Tree. |
BTreeIterator |
iterateAll()
Returns an iterator that iterates over all values in this B-Tree. |
BTreeIterator |
iterateRange(byte[] minValue,
byte[] maxValue)
Returns an iterator that iterates over all values between minValue and maxValue, inclusive. |
BTreeIterator |
iterateValues(byte[] searchKey,
byte[] searchMask)
Returns an iterator that iterates over all values and returns the values that match the supplied searchKey after searchMask has been applied to the value. |
BTreeIterator |
iterateValues(byte[] searchKey,
byte[] searchMask,
byte[] minValue,
byte[] maxValue)
Returns an iterator that iterates over all values between minValue and maxValue (inclusive) and returns the values that match the supplied searchKey after searchMask has been applied to the value. |
static void |
main(String[] args)
|
void |
print(PrintStream out)
|
byte[] |
remove(byte[] key)
Removes the value that matches the specified key from the B-Tree. |
static void |
runDebugTest(String[] args)
|
static void |
runPerformanceTest(String[] args)
|
void |
startTransaction()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BTree(File dataFile,
int blockSize,
int valueSize)
throws IOException
dataFile - The file for the B-Tree.blockSize - The size (in bytes) of a file block for a single node.
Ideally, the size specified is the size of a block in the used file
system.valueSize - The size (in bytes) of the fixed-length values that are
or will be stored in the B-Tree.
IOException - In case the initialization of the B-Tree file
failed.DefaultBTreeValueComparator
public BTree(File dataFile,
int blockSize,
int valueSize,
BTreeValueComparator comparator)
throws IOException
dataFile - The file for the B-Tree.blockSize - The size (in bytes) of a file block for a single node.
Ideally, the size specified is the size of a block in the used file
system.valueSize - The size (in bytes) of the fixed-length values that are
or will be stored in the B-Tree.comparator - The BTreeValueComparator to use for
determining whether one value is smaller, larger or equal to another.
IOException - In case the initialization of the B-Tree file
failed.| Method Detail |
public void close()
throws IOException
IOException
public void startTransaction()
throws IOException
IOException
public void commitTransaction()
throws IOException
IOException
public byte[] get(byte[] key)
throws IOException
key - A value that is equal to the value that should be
retrieved, at least as far as the BTreeValueComparator of this
BTree is concerned.
IOExceptionpublic BTreeIterator iterateAll()
public BTreeIterator iterateRange(byte[] minValue,
byte[] maxValue)
public BTreeIterator iterateValues(byte[] searchKey,
byte[] searchMask)
public BTreeIterator iterateValues(byte[] searchKey,
byte[] searchMask,
byte[] minValue,
byte[] maxValue)
public byte[] insert(byte[] value)
throws IOException
value - The value to insert into the B-Tree.
IOException - If an I/O error occurred.
public byte[] remove(byte[] key)
throws IOException
key - A key that matches the value that should be removed from the B-Tree.
IOException - If an I/O error occurred.
public void clear()
throws IOException
IOException - If an I/O error occurred.
public static void main(String[] args)
throws Exception
Exception
public static void runPerformanceTest(String[] args)
throws Exception
Exception
public static void runDebugTest(String[] args)
throws Exception
Exception
public void print(PrintStream out)
throws IOException
IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||