This class provides a high performance key/value storage mechanism that stores data to file. A B-tree is a self-balancing tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic time.
Tags
Since | 2.3.17 |
Methods | Properties | Constants |
---|---|---|
Parameters
$file | No description |
Returns
\Hazaar\bool | true if everything went well; false otherwise |
Parameters
$to | \Hazaar\File | No description |
$node_type | string | No description |
$node | array | No description |
Returns
int | new pointer to copied node; |
Parameters
$key | string | The key to return data for |
Returns
mixed |
Parameters
$key | mixed | The key to check |
Returns
boolean |
Warning: Unlike a search this will hit almost every part of the database file and can be a bit slow.
Returns
array | An array of available keys |
Parameters
$p | int | pointer to node |
Returns
array | pairs of (leaf, pointer); null on failure |
Returns
array | pointers to leaves; null on failure |
Parameters
$key | string | The key to lookup |
$node_type | string | No description |
$node | array | No description |
Returns
array | traversed nodes |
Tags
Retrun | array 0 => node type, 1 => node; array(null, null) on failure |
Parameters
$p | int | Pointer to node (offset in file) |
Tags
Throws | \Exception |
To get all data, use:
$values = $btree->range("\x00", "\xff");
Parameters
$startkey | string | No description |
$endkey | string | No description |
Returns
array |
Parameters
$key | No description |
Returns
boolean |
Returns
array | 0 => node type, 1 => node; array(null, null) on failure |
Returns
int | pointer to root; null on failure |
Parameters
$type | string | node type |
$node | array | No description |
Returns
string |
Parameters
$key | string | The key to store the value under. |
$value | mixed | The value to store. A NULL value deletes given key. |
Returns
boolean |
Parameters
$str | string | serialized node |
Returns
array |