|
|||||||
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
public class 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/interfaces inherited from class org.exist.storage.btree.Paged |
---|
Paged.FileHeader, Paged.Page, Paged.PageHeader |
Field Summary | |
---|---|
static long |
DATA_SYNC_PERIOD
|
static short |
FILE_FORMAT_VERSION_ID
|
int |
fixedKeyLen
|
static byte |
FREE_LIST
|
static int |
LENGTH_NEXT_TID
|
static int |
LENGTH_RECORDS_COUNT
|
static byte |
LOB
|
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
|
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 |
---|
KEY_NOT_FOUND, LOG_CREATE_BNODE, LOG_INSERT_VALUE, LOG_SET_LINK, LOG_SET_PARENT, LOG_UPDATE_PAGE, LOG_UPDATE_VALUE |
Constructor Summary | |
---|---|
BFile(BrokerPool pool,
byte fileId,
boolean transactional,
File file,
DefaultCacheManager 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(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)
|
ArrayList |
findEntries(IndexQuery query)
|
ArrayList |
findKeys(IndexQuery query)
|
boolean |
flush()
|
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()
|
ArrayList |
getEntries()
|
short |
getFileVersion()
|
ArrayList |
getKeys()
|
Lock |
getLock()
Returns the Lock object responsible for this BFile. |
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 put(Value, byte[], boolean) , overwrite is true. |
long |
put(Value key,
ByteArray value,
boolean overwrite)
Put a value under given key. |
void |
remove(Txn transaction,
long p)
|
void |
remove(Txn transaction,
Value key)
|
void |
remove(Value key)
|
void |
removeAll(Txn transaction,
IndexQuery query)
Remove all entries matching the given query. |
void |
setLocation(String location)
|
long |
storeValue(Txn transaction,
ByteArray value)
|
long |
update(long p,
Value key,
ByteArray value)
Update the key/value pair found at the logical address p. |
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, dump, findValue, getIndexBufferStats, open, query, query, remove, remove, removeValue, removeValue, treeStatistics |
Methods inherited from class org.exist.storage.btree.Paged |
---|
backupToStream, exists, getFile, getFileHeader, getPageSize, hexDump, isOpened, isReadOnly, printFreeSpaceList, setPageSize |
Methods inherited from class java.lang.Object |
---|
equals, 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 int LENGTH_RECORDS_COUNT
public static final int LENGTH_NEXT_TID
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
public int fixedKeyLen
Constructor Detail |
---|
public BFile(BrokerPool pool, byte fileId, boolean transactional, File file, DefaultCacheManager cacheManager, double cacheGrowth, double thresholdBTree, double thresholdData) throws DBException
DBException
Method Detail |
---|
public short getFileVersion()
getFileVersion
in class BTree
public Lock getLock()
public long append(Value key, ByteArray value) throws ReadOnlyException, IOException
key
- value
-
ReadOnlyException
IOException
public long append(Txn transaction, Value key, ByteArray value) throws ReadOnlyException, IOException
ReadOnlyException
IOException
public boolean close() throws DBException
close
in class BTree
DBException
public boolean containsKey(Value key)
key
- key to look for
public boolean create() throws DBException
create
in class Paged
DBException
public void closeAndRemove()
Paged
closeAndRemove
in class BTree
public Paged.FileHeader createFileHeader(int pageSize)
Paged
createFileHeader
in class BTree
Paged.createFileHeader(int pageSize)
public Paged.PageHeader createPageHeader()
Paged
createPageHeader
in class BTree
Paged.createPageHeader()
public void removeAll(Txn transaction, IndexQuery query) throws IOException, BTreeException
query
-
IOException
BTreeException
public ArrayList findEntries(IndexQuery query) throws IOException, BTreeException, TerminatedException
IOException
BTreeException
TerminatedException
public ArrayList findKeys(IndexQuery query) throws IOException, BTreeException, TerminatedException
IOException
BTreeException
TerminatedException
public void find(IndexQuery query, IndexCallback callback) throws IOException, BTreeException, TerminatedException
IOException
BTreeException
TerminatedException
public boolean flush() throws DBException
flush
in class BTree
DBException
public BufferStats getDataBufferStats()
public void printStatistics()
printStatistics
in class BTree
public Value get(Value key)
key
- public VariableByteInput getAsStream(Value key) throws IOException
key
-
IOException
public VariableByteInput getAsStream(long pointer) throws IOException
pointer
-
IOException
public Value get(long p)
p
-
public ArrayList getEntries() throws IOException, BTreeException, TerminatedException
IOException
BTreeException
TerminatedException
public ArrayList getKeys() throws IOException, BTreeException, TerminatedException
IOException
BTreeException
TerminatedException
public ArrayList getValues() throws IOException, BTreeException, TerminatedException
IOException
BTreeException
TerminatedException
public boolean open() throws DBException
DBException
public long put(Value key, byte[] data, boolean overwrite) throws ReadOnlyException
key
- data
- the data (value) to updateoverwrite
- overwrite if set to true, value will be overwritten if it already exists
ReadOnlyException
put(Value,byte[],boolean)
public long put(Txn transaction, Value key, byte[] data, boolean overwrite) throws ReadOnlyException
ReadOnlyException
public long put(Value key, ByteArray value) throws ReadOnlyException
put(Value, byte[], boolean)
, overwrite is 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(Txn transaction, long p) throws ReadOnlyException
ReadOnlyException
public void setLocation(String location) throws DBException
DBException
public long storeValue(Txn transaction, ByteArray value) throws IOException, ReadOnlyException
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
public void debugFreeList()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |