|
Xindice API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xindice.core.filer.Paged | +--org.apache.xindice.core.filer.BTree
BTree represents a Variable Magnitude Simple-Prefix B+Tree File.
A BTree is a bit flexible in that it can be used for set or
map-based indexing. HashFiler uses the BTree as a set for
producing RecordSet entries. The Indexers use BTree as a map for
indexing entity and attribute values in Documents.
For those who don't know how a Simple-Prefix B+Tree works, the primary
distinction is that instead of promoting actual keys to branch pages,
when leaves are split, a shortest-possible separator is generated at
the pivot. That separator is what is promoted to the parent branch
(and continuing up the list). As a result, actual keys and pointers
can only be found at the leaf level. This also affords the index the
ability to ignore costly merging and redistribution of pages when
deletions occur. Deletions only affect leaf pages in this
implementation, and so it is entirely possible for a leaf page to be
completely empty after all of its keys have been removed.
Also, the Variable Magnitude attribute means that the btree attempts
to store as many values and pointers on one page as is possible.
This implementation supports the notion of nested roots. This means
that you can create a btree where the pointers actually point to the
root of a separate btree being managed in the same file.
Inner Class Summary | |
class |
BTree.BTreeRootInfo
BTreeRootInfo |
Inner classes inherited from class org.apache.xindice.core.filer.Paged |
Paged.FileHeader, Paged.Page, Paged.PageHeader |
Constructor Summary | |
BTree()
|
|
BTree(java.io.File file)
|
Method Summary | |
long |
addValue(BTree.BTreeRootInfo root,
Value value,
long pointer)
addValue adds a Value to the BTree and associates a pointer with it. |
long |
addValue(Value value,
long pointer)
addValue adds a Value to the BTree and associates a pointer with it. |
boolean |
create()
|
Paged.FileHeader |
createFileHeader()
createFileHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a FileHeader. |
Paged.FileHeader |
createFileHeader(boolean read)
createFileHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a FileHeader. |
Paged.FileHeader |
createFileHeader(long pageCount)
createFileHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a FileHeader. |
Paged.FileHeader |
createFileHeader(long pageCount,
int pageSize)
createFileHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a FileHeader. |
Paged.PageHeader |
createPageHeader()
createPageHeader must be implemented by a Paged implementation in order to create an appropriate subclass instance of a PageHeader. |
long |
findValue(BTree.BTreeRootInfo root,
Value value)
findValue finds a Value in the BTree and returns the associated pointer for it. |
long |
findValue(Value value)
findValue finds a Value in the BTree and returns the associated pointer for it. |
boolean |
open()
|
void |
query(BTree.BTreeRootInfo root,
IndexQuery query,
BTreeCallback callback)
query performs a query against the BTree and performs callback operations to report the search results. |
void |
query(IndexQuery query,
BTreeCallback callback)
query performs a query against the BTree and performs callback operations to report the search results. |
long |
removeValue(BTree.BTreeRootInfo root,
Value value)
removeValue removes a Value from the BTree and returns the associated pointer for it. |
long |
removeValue(Value value)
removeValue removes a Value from the BTree and returns the associated pointer for it. |
Methods inherited from class org.apache.xindice.core.filer.Paged |
close, deleteArrayInt, deleteArrayLong, deleteArrayShort, deleteArrayValue, drop, exists, flush, getFileHeader, insertArrayInt, insertArrayLong, insertArrayShort, insertArrayValue, isOpened |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BTree()
public BTree(java.io.File file)
Method Detail |
public boolean open() throws DBException
open
in class Paged
public boolean create() throws DBException
create
in class Paged
public long addValue(Value value, long pointer) throws java.io.IOException, BTreeException
value
- The Value to addpointer
- The pointer to associate with itpublic long addValue(BTree.BTreeRootInfo root, Value value, long pointer) throws java.io.IOException, BTreeException
root
- The BTree's root information (for nested trees)value
- The Value to addpointer
- The pointer to associate with itpublic long removeValue(Value value) throws java.io.IOException, BTreeException
value
- The Value to removepublic long removeValue(BTree.BTreeRootInfo root, Value value) throws java.io.IOException, BTreeException
root
- The BTree's root information (for nested trees)value
- The Value to removepublic long findValue(Value value) throws java.io.IOException, BTreeException
value
- The Value to findpublic long findValue(BTree.BTreeRootInfo root, Value value) throws java.io.IOException, BTreeException
root
- The BTree's root information (for nested trees)value
- The Value to findpublic void query(IndexQuery query, BTreeCallback callback) throws java.io.IOException, BTreeException
query
- The IndexQuery to use (or null for everything)callback
- The callback instancepublic void query(BTree.BTreeRootInfo root, IndexQuery query, BTreeCallback callback) throws java.io.IOException, BTreeException
root
- The BTree's root information (for nested trees)query
- The IndexQuery to use (or null for everything)callback
- The callback instancepublic Paged.FileHeader createFileHeader()
Paged
createFileHeader
in class Paged
org.apache.xindice.core.filer.Paged
public Paged.FileHeader createFileHeader(boolean read) throws java.io.IOException
Paged
createFileHeader
in class Paged
org.apache.xindice.core.filer.Paged
read
- If true, reads the FileHeader from diskjava.io.IOException
- if an exception occurspublic Paged.FileHeader createFileHeader(long pageCount)
Paged
createFileHeader
in class Paged
org.apache.xindice.core.filer.Paged
pageCount
- The number of pages to allocate for primary storagepublic Paged.FileHeader createFileHeader(long pageCount, int pageSize)
Paged
createFileHeader
in class Paged
org.apache.xindice.core.filer.Paged
pageCount
- The number of pages to allocate for primary storagepageSize
- The size of a Page (should be a multiple of a FS block)public Paged.PageHeader createPageHeader()
Paged
createPageHeader
in class Paged
org.apache.xindice.core.filer.Paged
|
Xindice API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |