|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exist.storage.btree.Paged
org.exist.storage.btree.BTree
org.exist.storage.index.BFile
Data store for variable size values. This class maps keys to values of variable size. Keys are stored in the b+-tree. B+-tree values are pointers to the logical storage address of the value in the data section. The pointer consists of the page number and a logical tuple identifier. If a value is larger than the internal page size (4K), it is split into overflow pages. Appending data to a overflow page is very fast. Only the first and the last data page are loaded. Data pages are buffered.
| Nested Class Summary | |
static interface |
BFile.PageInputStream
|
| Nested classes inherited from class org.exist.storage.btree.BTree |
BTree.BTreeFileHeader, BTree.BTreeNode, BTree.BTreePageHeader |
| Nested classes inherited from class org.exist.storage.btree.Paged |
Paged.FileHeader, Paged.Page, Paged.PageHeader |
| Field Summary | |
static long |
DATA_SYNC_PERIOD
|
protected Cache |
dataCache
|
static short |
FILE_FORMAT_VERSION_ID
|
protected org.exist.storage.index.BFile.BFileHeader |
fileHeader
|
int |
fixedKeyLen
|
static byte |
FREE_LIST
|
static byte |
LOB
|
protected Lock |
lock
|
static byte |
LOG_CREATE_PAGE
|
static byte |
LOG_OVERFLOW_APPEND
|
static byte |
LOG_OVERFLOW_CREATE
|
static byte |
LOG_OVERFLOW_CREATE_PAGE
|
static byte |
LOG_OVERFLOW_MODIFIED
|
static byte |
LOG_OVERFLOW_REMOVE
|
static byte |
LOG_OVERFLOW_STORE
|
static byte |
LOG_REMOVE_PAGE
|
static byte |
LOG_REMOVE_VALUE
|
static byte |
LOG_STORE_VALUE
|
protected int |
maxValueSize
|
protected int |
minFree
|
static byte |
MULTI_PAGE
|
static int |
PAGE_MIN_FREE
|
static byte |
RECORD
|
static long |
UNKNOWN_ADDRESS
|
| Fields inherited from class org.exist.storage.btree.BTree |
BRANCH, buffers, cache, cacheManager, fileId, growthThreshold, isTransactional, KEY_NOT_FOUND, LEAF, LOG_CREATE_BNODE, LOG_INSERT_VALUE, LOG_SET_PARENT, LOG_UPDATE_PAGE, LOG_UPDATE_VALUE, logManager |
| Fields inherited from class org.exist.storage.btree.Paged |
DELETED, LOG, OVERFLOW, PAGE_SIZE, UNUSED |
| Constructor Summary | |
BFile(BrokerPool pool,
byte fileId,
boolean transactional,
java.io.File file,
CacheManager cacheManager,
double cacheGrowth,
double thresholdBTree,
double thresholdData)
|
|
| Method Summary | |
long |
append(Txn transaction,
Value key,
ByteArray value)
|
long |
append(Value key,
ByteArray value)
Append the given data fragment to the value associated with the key. |
boolean |
close()
Close the BFile. |
void |
closeAndRemove()
Completely close down the instance and all underlying resources and caches. |
boolean |
containsKey(Value key)
Check, if key is contained in BFile. |
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. |
void |
debugFreeList()
|
void |
find(IndexQuery query,
IndexCallback callback)
|
java.util.ArrayList |
findEntries(IndexQuery query)
|
java.util.ArrayList |
findKeys(IndexQuery query)
|
boolean |
flush()
|
protected Value |
get(org.exist.storage.index.BFile.DataPage page,
long p)
Retrieve value at logical address p from page |
Value |
get(long p)
Returns the value located at the specified address. |
Value |
get(Value key)
Get the value data associated with the specified key or null if the key could not be found. |
VariableByteInput |
getAsStream(long pointer)
Get the value located at the specified address as a variable byte encoded input stream. |
VariableByteInput |
getAsStream(Value key)
Get the value data for the given key as a variable byte encoded input stream. |
BufferStats |
getDataBufferStats()
|
protected long |
getDataSyncPeriod()
|
java.util.ArrayList |
getEntries()
|
short |
getFileVersion()
|
java.util.ArrayList |
getKeys()
|
Lock |
getLock()
Returns the Lock object responsible for this BFile. |
java.util.ArrayList |
getValues()
|
boolean |
open()
|
void |
printStatistics()
|
long |
put(Txn transaction,
Value key,
byte[] data,
boolean overwrite)
|
long |
put(Txn transaction,
Value key,
ByteArray value,
boolean overwrite)
|
long |
put(Value key,
byte[] data,
boolean overwrite)
Put data under given key. |
long |
put(Value key,
ByteArray value)
Convinience method for BFile#put(Value, byte[], true). |
long |
put(Value key,
ByteArray value,
boolean overwrite)
Put a value under given key. |
protected void |
redoAppendOverflow(OverflowAppendLoggable loggable)
|
protected void |
redoCreateOverflow(OverflowCreateLoggable loggable)
|
protected void |
redoCreateOverflowPage(OverflowCreatePageLoggable loggable)
|
protected void |
redoCreatePage(CreatePageLoggable loggable)
|
protected void |
redoModifiedOverflow(OverflowModifiedLoggable loggable)
|
protected void |
redoRemoveOverflow(OverflowRemoveLoggable loggable)
|
protected void |
redoRemovePage(RemoveEmptyPageLoggable loggable)
|
protected void |
redoRemoveValue(RemoveValueLoggable loggable)
|
protected void |
redoStoreOverflow(OverflowStoreLoggable loggable)
|
protected void |
redoStoreValue(StoreValueLoggable loggable)
|
void |
remove(long p)
|
void |
remove(Txn transaction,
Value key)
|
void |
remove(Value key)
|
void |
removeAll(IndexQuery query)
Remove all entries matching the given query. |
void |
setLocation(java.lang.String location)
|
long |
storeValue(Txn transaction,
ByteArray value)
|
protected void |
undoAppendOverflow(OverflowAppendLoggable loggable)
|
protected void |
undoCreateOverflow(OverflowCreateLoggable loggable)
|
protected void |
undoCreateOverflowPage(OverflowCreatePageLoggable loggable)
|
protected void |
undoCreatePage(CreatePageLoggable loggable)
|
protected void |
undoModifiedOverflow(OverflowModifiedLoggable loggable)
|
protected void |
undoRemoveOverflow(OverflowRemoveLoggable loggable)
|
protected void |
undoRemovePage(RemoveEmptyPageLoggable loggable)
|
protected void |
undoRemoveValue(RemoveValueLoggable loggable)
|
protected void |
undoStoreValue(StoreValueLoggable loggable)
|
long |
update(long p,
Value key,
ByteArray value)
Update the key/value pair found at the logical address p. |
protected long |
update(Txn transaction,
long p,
org.exist.storage.index.BFile.DataPage page,
Value key,
ByteArray value)
Update the key/value pair with logical address p and stored in page. |
long |
update(Txn transaction,
long p,
Value key,
ByteArray value)
|
long |
update(Value key,
ByteArray value)
Update a key/value pair. |
| Methods inherited from class org.exist.storage.btree.BTree |
addValue, addValue, create, createRootNode, dump, dumpValue, findValue, getIndexBufferStats, getRootNode, open, query, query, redoCreateBTNode, redoInsertValue, redoRemoveValue, redoSetParent, redoUpdatePage, redoUpdateValue, remove, remove, removeValue, removeValue, requiresRedo, setRootNode, undoInsertValue, undoRemoveValue, undoUpdateValue |
| Methods inherited from class org.exist.storage.btree.Paged |
backupToStream, exists, getFile, getFileHeader, getFreePage, getPage, getPageSize, hexDump, isOpened, isReadOnly, printFreeSpaceList, reuseDeleted, setFile, setPageSize, unlinkPages, unlinkPages, writeValue, writeValue, writeValue |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final short FILE_FORMAT_VERSION_ID
public static final long UNKNOWN_ADDRESS
public static final long DATA_SYNC_PERIOD
public static final int PAGE_MIN_FREE
public static final byte RECORD
public static final byte LOB
public static final byte FREE_LIST
public static final byte MULTI_PAGE
public static final byte LOG_CREATE_PAGE
public static final byte LOG_STORE_VALUE
public static final byte LOG_REMOVE_VALUE
public static final byte LOG_REMOVE_PAGE
public static final byte LOG_OVERFLOW_APPEND
public static final byte LOG_OVERFLOW_STORE
public static final byte LOG_OVERFLOW_CREATE
public static final byte LOG_OVERFLOW_MODIFIED
public static final byte LOG_OVERFLOW_CREATE_PAGE
public static final byte LOG_OVERFLOW_REMOVE
protected org.exist.storage.index.BFile.BFileHeader fileHeader
protected int minFree
protected Cache dataCache
protected Lock lock
public int fixedKeyLen
protected int maxValueSize
| Constructor Detail |
public BFile(BrokerPool pool,
byte fileId,
boolean transactional,
java.io.File file,
CacheManager cacheManager,
double cacheGrowth,
double thresholdBTree,
double thresholdData)
throws DBException
| Method Detail |
public short getFileVersion()
getFileVersion in class Pagedpublic Lock getLock()
protected long getDataSyncPeriod()
public long append(Value key,
ByteArray value)
throws ReadOnlyException,
java.io.IOException
key - value -
ReadOnlyException
java.io.IOException
public long append(Txn transaction,
Value key,
ByteArray value)
throws ReadOnlyException,
java.io.IOException
ReadOnlyException
java.io.IOException
public boolean close()
throws DBException
close in class BTreeDBExceptionpublic boolean containsKey(Value key)
key - key to look for
public boolean create()
throws DBException
create in class PagedDBExceptionpublic void closeAndRemove()
Paged
closeAndRemove in class BTreepublic Paged.FileHeader createFileHeader()
Paged
createFileHeader in class BTreePaged.createFileHeader()
public Paged.FileHeader createFileHeader(boolean read)
throws java.io.IOException
Paged
createFileHeader in class BTreejava.io.IOExceptionPaged.createFileHeader(boolean)public Paged.FileHeader createFileHeader(long pageCount)
Paged
createFileHeader in class BTreePaged.createFileHeader(long)
public Paged.FileHeader createFileHeader(long pageCount,
int pageSize)
Paged
createFileHeader in class BTreePaged.createFileHeader(long, int)public Paged.PageHeader createPageHeader()
Paged
createPageHeader in class BTreePaged.createPageHeader()
public void removeAll(IndexQuery query)
throws java.io.IOException,
BTreeException
query -
java.io.IOException
BTreeException
public java.util.ArrayList findEntries(IndexQuery query)
throws java.io.IOException,
BTreeException,
TerminatedException
java.io.IOException
BTreeException
TerminatedException
public java.util.ArrayList findKeys(IndexQuery query)
throws java.io.IOException,
BTreeException,
TerminatedException
java.io.IOException
BTreeException
TerminatedException
public void find(IndexQuery query,
IndexCallback callback)
throws java.io.IOException,
BTreeException,
TerminatedException
java.io.IOException
BTreeException
TerminatedException
public boolean flush()
throws DBException
flush in class BTreeDBExceptionpublic BufferStats getDataBufferStats()
public void printStatistics()
printStatistics in class BTreepublic Value get(Value key)
key -
public VariableByteInput getAsStream(Value key)
throws java.io.IOException
key -
java.io.IOException
public VariableByteInput getAsStream(long pointer)
throws java.io.IOException
pointer -
java.io.IOExceptionpublic Value get(long p)
p -
protected Value get(org.exist.storage.index.BFile.DataPage page,
long p)
throws BTreeException,
java.io.IOException
BTreeException
java.io.IOException
public java.util.ArrayList getEntries()
throws java.io.IOException,
BTreeException,
TerminatedException
java.io.IOException
BTreeException
TerminatedException
public java.util.ArrayList getKeys()
throws java.io.IOException,
BTreeException,
TerminatedException
java.io.IOException
BTreeException
TerminatedException
public java.util.ArrayList getValues()
throws java.io.IOException,
BTreeException,
TerminatedException
java.io.IOException
BTreeException
TerminatedException
public boolean open()
throws DBException
DBException
public long put(Value key,
byte[] data,
boolean overwrite)
throws ReadOnlyException
data - the data (value) to updateoverwrite - overwrite if set to true, value will be overwritten if it already exists
ReadOnlyException{@link BFile#put(Value, ByteArray, boolean)}
public long put(Txn transaction,
Value key,
byte[] data,
boolean overwrite)
throws ReadOnlyException
ReadOnlyException
public long put(Value key,
ByteArray value)
throws ReadOnlyException
BFile#put(Value, byte[], true).
key - with which the data is updatedvalue - value to update
ReadOnlyException
public long put(Value key,
ByteArray value,
boolean overwrite)
throws ReadOnlyException
append(Value, ByteArray) is,
that the value gets updated and not stored.
key - with which the data is updatedvalue - value to updateoverwrite - if set to true, value will be overwritten if it already exists
ReadOnlyException
public long put(Txn transaction,
Value key,
ByteArray value,
boolean overwrite)
throws ReadOnlyException
ReadOnlyException
public void remove(Value key)
throws ReadOnlyException
ReadOnlyException
public void remove(Txn transaction,
Value key)
throws ReadOnlyException
ReadOnlyException
public void remove(long p)
throws ReadOnlyException
ReadOnlyException
public void setLocation(java.lang.String location)
throws DBException
DBException
public long storeValue(Txn transaction,
ByteArray value)
throws java.io.IOException,
ReadOnlyException
java.io.IOException
ReadOnlyException
public long update(Value key,
ByteArray value)
throws ReadOnlyException
key - Description of the Parametervalue - Description of the Parameter
ReadOnlyException
public long update(long p,
Value key,
ByteArray value)
throws ReadOnlyException
p - Description of the Parameterkey - Description of the Parametervalue - Description of the Parameter
ReadOnlyException
public long update(Txn transaction,
long p,
Value key,
ByteArray value)
throws ReadOnlyException
ReadOnlyException
protected long update(Txn transaction,
long p,
org.exist.storage.index.BFile.DataPage page,
Value key,
ByteArray value)
throws BTreeException,
java.io.IOException,
ReadOnlyException
p - Description of the Parameterpage - Description of the Parameterkey - Description of the Parametervalue - Description of the Parameter
BTreeException - Description of the Exception
java.io.IOException - Description of the Exception
ReadOnlyExceptionpublic void debugFreeList()
protected void redoStoreValue(StoreValueLoggable loggable)
protected void undoStoreValue(StoreValueLoggable loggable)
protected void redoCreatePage(CreatePageLoggable loggable)
protected void undoCreatePage(CreatePageLoggable loggable)
protected void redoRemoveValue(RemoveValueLoggable loggable)
protected void undoRemoveValue(RemoveValueLoggable loggable)
protected void redoRemovePage(RemoveEmptyPageLoggable loggable)
protected void undoRemovePage(RemoveEmptyPageLoggable loggable)
protected void redoCreateOverflow(OverflowCreateLoggable loggable)
protected void undoCreateOverflow(OverflowCreateLoggable loggable)
protected void redoCreateOverflowPage(OverflowCreatePageLoggable loggable)
protected void undoCreateOverflowPage(OverflowCreatePageLoggable loggable)
protected void redoAppendOverflow(OverflowAppendLoggable loggable)
protected void undoAppendOverflow(OverflowAppendLoggable loggable)
protected void redoStoreOverflow(OverflowStoreLoggable loggable)
protected void redoModifiedOverflow(OverflowModifiedLoggable loggable)
protected void undoModifiedOverflow(OverflowModifiedLoggable loggable)
protected void redoRemoveOverflow(OverflowRemoveLoggable loggable)
protected void undoRemoveOverflow(OverflowRemoveLoggable loggable)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||