public class BtreeFileSource extends java.lang.Object implements BtreePageSource, FileCache.NotifyOnCommit
| Constructor and Description |
|---|
BtreeFileSource(int fileId,
FileCache fileCache,
int pageSize,
boolean isNew,
MofidGenerator mGen,
BtreeStorage storage)
Constructor for a BtreeFileSource from a new or existing index file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dirtyPage(BtreePage page)
Notifies the btree that the caller is going to modify this page.
|
java.lang.String |
getMofidPrefix()
Get the prefix for this repository
|
long |
getNextMofid()
get the next unique ID for this repository
|
BtreePage |
getPage(byte[] pageId,
Btree btree)
Get a BtreePage by its pageId.
|
EntryTypeInfo |
getPageIdInfo()
Get an EntryTypeInfo for the datatype of this BtreePageSource's page IDs.
|
int |
getPageIdLength()
Returns the length of a page ID.
|
int |
getPageSize()
Returns the size of a page.
|
BtreePage |
getRootPage(Btree btree)
Return the root page if it already exists, otherwise create it.
|
BtreeStorage |
getStorage() |
boolean |
isNoPage(byte[] pageId)
Test whether the passed-in pageId contains the special value noPageId
|
BigKeyPage |
newBigKeyPage(Btree btree)
Returns a newly allocated BigKeyPage.
|
BtreePage |
newPage(Btree btree)
Returns a newly allocated btree page.
|
void |
prepareToCommit()
Prepares all cached modified pages to be written out.
|
void |
setNoPage(byte[] pageId)
Set the passed-in pageId to contain the special value noPageId
|
void |
unpinPage(BigKeyPage page)
Notify the BtreePageSource that the caller is done using this page.
|
void |
unpinPage(BtreePage page)
Notifies the btree that the caller is done using this page.
|
public BtreeFileSource(int fileId,
FileCache fileCache,
int pageSize,
boolean isNew,
MofidGenerator mGen,
BtreeStorage storage)
throws StorageException
fileId - file ID to use in FileCache requestsfileCache - source of index pagespageSize - size of index pagesisNew - true if this index is being newly createdmGen - Mofid generatorStorageExceptionpublic EntryTypeInfo getPageIdInfo()
BtreePageSourcegetPageIdInfo in interface BtreePageSourcepublic void setNoPage(byte[] pageId)
setNoPage in interface BtreePageSourcepageId - byte array to be filled inpublic boolean isNoPage(byte[] pageId)
isNoPage in interface BtreePageSourcepublic void prepareToCommit()
throws StorageException
prepareToCommit in interface FileCache.NotifyOnCommitStorageExceptionpublic BtreePage getRootPage(Btree btree) throws StorageException
getRootPage in interface BtreePageSourcebtree - BtreeStorageExceptionpublic BtreePage getPage(byte[] pageId, Btree btree) throws StorageException
getPage in interface BtreePageSourcepageId - Byte array containing pageIdbtree - btree to which the page belongsStorageException - If the page is not validpublic BtreePage newPage(Btree btree) throws StorageException
newPage in interface BtreePageSourcebtree - btree to which the page belongsStorageException - If the page is not validpublic BigKeyPage newBigKeyPage(Btree btree) throws StorageException
newBigKeyPage in interface BtreePageSourcebtree - btree to which the page belongsStorageExceptionpublic void unpinPage(BtreePage page)
unpinPage in interface BtreePageSourcepage - BtreePage to be unpinnedpublic void unpinPage(BigKeyPage page) throws StorageException
BtreePageSourceunpinPage in interface BtreePageSourcepage - BigKeyPageStorageExceptionpublic void dirtyPage(BtreePage page) throws StorageException
dirtyPage in interface BtreePageSourcepage - The page being modifiedStorageExceptionpublic int getPageIdLength()
BtreePageSourcegetPageIdLength in interface BtreePageSourcepublic int getPageSize()
BtreePageSourcegetPageSize in interface BtreePageSourcepublic long getNextMofid()
MofidGeneratorgetNextMofid in interface MofidGeneratorpublic java.lang.String getMofidPrefix()
MofidGeneratorgetMofidPrefix in interface MofidGeneratorpublic BtreeStorage getStorage()
getStorage in interface BtreePageSourceCopyright © 2005-2012 Apache Software Foundation. All Rights Reserved.