Package db
Interface RecordNode
public interface RecordNode
Table
record leaf nodes within the BTree structure.-
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
Delete this node and all child nodes.int
int[]
Return all buffer IDs for those buffers which are children of this buffer.int
getKeyField
(int index) Get the key value at a specific index.int
getKeyIndex
(Field key) Perform a binary search to locate the specified key and derive an index into the Buffer ID storage.int
getKeyOffset
(int index) Get the key offset within the node's data bufferint
getRecordOffset
(int index) Get the record offset within the node's data bufferboolean
isConsistent
(String tableName, TaskMonitor monitor) Check the consistency of this node and all of its children.void
setKeyCount
(int cnt) Set the number of keys contained within this node.
-
Method Details
-
getRecordOffset
Get the record offset within the node's data buffer- Parameters:
index
- key/record index- Returns:
- positive record offset within buffer, or a negative bufferID for indirect record storage in a dedicated buffer
- Throws:
IOException
- if IO error occurs
-
getKeyOffset
Get the key offset within the node's data buffer- Parameters:
index
- key/record index- Returns:
- positive record offset within buffer
- Throws:
IOException
- if IO error occurs
-
getParent
InteriorNode getParent()- Returns:
- the parent node or null if this is the root
-
getBufferId
int getBufferId()- Returns:
- the data buffer ID associated with this node.
-
getBuffer
DataBuffer getBuffer()- Returns:
- the data buffer associated with this node.
-
getKeyCount
int getKeyCount()- Returns:
- the number of keys contained within this node.
-
setKeyCount
void setKeyCount(int cnt) Set the number of keys contained within this node.- Parameters:
cnt
- key count
-
getKeyField
Get the key value at a specific index.- Parameters:
index
- key index- Returns:
- key value
- Throws:
IOException
- thrown if an IO error occurs
-
getKeyIndex
Perform a binary search to locate the specified key and derive an index into the Buffer ID storage. This method is intended to find the insertion index or exact match for a child key. A negative value will be returned when an exact match is not found and may be transformed into an insertion index (insetIndex = -returnedIndex-1).- Parameters:
key
- key to search for- Returns:
- int buffer ID index.
- Throws:
IOException
- thrown if an IO error occurs
-
delete
Delete this node and all child nodes.- Throws:
IOException
- thrown if IO error occurs
-
getBufferReferences
int[] getBufferReferences()Return all buffer IDs for those buffers which are children of this buffer.- Returns:
- array of buffer IDs
-
isConsistent
Check the consistency of this node and all of its children.- Parameters:
tableName
- name of table containing this nodemonitor
- task monitor- Returns:
- true if consistency check passed, else false
- Throws:
IOException
- if IO error occurredCancelledException
- if task cancelled
-