public class FixedRecordList extends Object
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 and Description |
---|
FixedRecordList(Store store,
int element_size)
Constructs the structure.
|
Modifier and Type | Method and Description |
---|---|
void |
addAllAreasUsed(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).
|
public FixedRecordList(Store store, int element_size)
public long create() throws IOException
IOException
public void init(long list_pointer) throws IOException
IOException
public void addAllAreasUsed(ArrayList list) throws IOException
IOException
public long getReservedLong() throws IOException
IOException
public void setReservedLong(long v) throws IOException
IOException
public MutableArea positionOnNode(long record_number) throws IOException
IOException
public int listBlockCount()
public long addressableNodeCount()
public long listBlockNodeCount(int block_number)
public long listBlockFirstPosition(int block_number)
public void increaseSize() throws IOException
IOException
public void decreaseSize() throws IOException
IOException
Copyright © 2015. All rights reserved.