|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mckoi.database.FixedRecordList
public class FixedRecordList
A structure that provides a fast way to read and write fixed sized nodes in a Store object. Each node in the list is of fixed size.
This structure can locate a node in the list very quickly. However, the structure can not be mutated. For example, deleting node '4' will make the node available for recycling but will not shift any nodes after 4 in the list up by one.
Once a node is allocated from the list its position will not change.
This structure does not provide versioning features.
The structure is composed of two element types - the header and the list block elements. The header is resembled by the following diagram;
LIST BLOCK HEADER +-------------------------------+ | 4 MAGIC | | 4 list block count | | 8 (reserved for delete chain) | | 8 pointer to list block 0 | | 8 pointer to list block 1 | . ... etc ... . | 8 pointer to list block 63 | +-------------------------------+
The first list block element is 32 entries in size, the second list block is 64 entries in size, etc. Each entry of the list block element is of fixed size.
This class is NOT thread safe.
Constructor Summary | |
---|---|
FixedRecordList(Store store,
int element_size)
Constructs the structure. |
Method Summary | |
---|---|
void |
addAllAreasUsed(java.util.ArrayList list)
Adds to the given ArrayList all the areas in the store that are used by this structure (as Long). |
long |
addressableNodeCount()
Returns the total number of nodes that are currently addressable by this list structure. |
long |
create()
Creates the structure in the store, and returns a pointer to the structure. |
void |
decreaseSize()
Decreases the size of the list structure. |
long |
getReservedLong()
Returns the 8 byte long that is reserved for storing the delete chain (if there is one). |
void |
increaseSize()
Increases the size of the list structure so it may accomodate more record entries. |
void |
init(long list_pointer)
Initializes the structure from the store. |
int |
listBlockCount()
Returns the number of block elements in this list structure. |
long |
listBlockFirstPosition(int block_number)
Returns the index of the first node in the given block number. |
long |
listBlockNodeCount(int block_number)
Returns the number of nodes that can be stored in the given block, where block 0 is the first block (32 addressable nodes). |
MutableArea |
positionOnNode(long record_number)
Returns an Area object from the list block area with the position over the record entry requested. |
void |
setReservedLong(long v)
Sets the 8 byte long that is reserved for storing the delete chain (if there is one). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FixedRecordList(Store store, int element_size)
Method Detail |
---|
public long create() throws java.io.IOException
java.io.IOException
public void init(long list_pointer) throws java.io.IOException
java.io.IOException
public void addAllAreasUsed(java.util.ArrayList list) throws java.io.IOException
java.io.IOException
public long getReservedLong() throws java.io.IOException
java.io.IOException
public void setReservedLong(long v) throws java.io.IOException
java.io.IOException
public MutableArea positionOnNode(long record_number) throws java.io.IOException
java.io.IOException
public int listBlockCount()
public long addressableNodeCount()
public long listBlockNodeCount(int block_number)
public long listBlockFirstPosition(int block_number)
public void increaseSize() throws java.io.IOException
java.io.IOException
public void decreaseSize() throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |