| Class | Innodb::List |
| In: |
lib/innodb/list.rb
|
| Parent: | Object |
An abstract InnoDB "free list" or FLST (renamed to just "list" here as it frequently is used for structures that aren‘t free lists). This class must be sub-classed to provide an appropriate object_from_address method.
| ADDRESS_SIZE | = | 4 + 2 | An "address", which consists of a page number and byte offset within the page. This points to the list "node" pointers (prev and next) of the node, not necessarily the node object. | |
| NODE_SIZE | = | 2 * ADDRESS_SIZE | A list node consists of two addresses: the "previous" node address, and the "next" node address. | |
| BASE_NODE_SIZE | = | 4 + (2 * ADDRESS_SIZE) | A list base node consists of a list length followed by two addresses: the "first" node address, and the "last" node address. |
| base | [R] | |
| space | [R] |
Read a node address from a cursor. Return nil if the address is an end or "NULL" pointer (the page number is UINT32_MAX), or the address if valid.
Read a base node, consisting of a list length followed by two addresses (:first and :last) from a cursor. Either address may be nil. An empty list has a :length of 0 and :first and :last are nil. A list with only a single item will have a :length of 1 and :first and :last will point to the same address.
Return whether the given item is present in the list. This depends on the item and the items in the list implementing some sufficient == method. This is implemented rather inefficiently by constructing an array and leaning on Array#include? to do the real work.
Abstract object_from_address method which must be implemented by sub-classes in order to return a useful object given an object address.