Turnstone Operating System
|
b+ tree implementation More...
#include <bplustree.h>
#include <memory.h>
#include <indexer.h>
#include <list.h>
#include <utils.h>
Classes | |
struct | bplustree_node_internal_t |
internal tree node More... | |
struct | bplustree_internal_t |
internal tree struct. used as metadata of index. More... | |
struct | bplustree_iterator_internal_t |
internal iterator struct More... | |
Typedefs | |
typedef struct bplustree_node_internal_t | bplustree_node_internal_t |
short hand for struct | |
typedef struct bplustree_internal_t | bplustree_internal_t |
short hand for struct | |
typedef struct bplustree_iterator_internal_t | bplustree_iterator_internal_t |
short hand for struct | |
Functions | |
MODULE ("turnstone.lib") | |
int8_t | bplustree_insert (index_t *idx, const void *key, const void *data, void **removed_data) |
int8_t | bplustree_delete (index_t *idx, const void *key, void **deleted_data) |
boolean_t | bplustree_contains (index_t *idx, const void *key) |
const void * | bplustree_find (index_t *idx, const void *key) |
iterator_t * | bplustree_search (index_t *idx, const void *key1, const void *key2, const index_key_search_criteria_t criteria) |
uint64_t | bplustree_size (index_t *idx) |
bplustree_node_internal_t * | bplustree_split_node (index_t *idx, bplustree_node_internal_t *node, void **ptr_par_key) |
splits node into two half with min key constraint. More... | |
const void * | bplustree_get_min_key (index_t *idx, const bplustree_node_internal_t *node) |
finds left leaf min key More... | |
int8_t | bplustree_toss_root (index_t *idx) |
toss root, so level of tree become smaller. More... | |
iterator_t * | bplustree_iterator_create (index_t *idx) |
creates b+ tree iterator More... | |
int8_t | bplustree_iterator_destroy (iterator_t *iterator) |
destroys the iterator More... | |
int8_t | bplustree_iterator_end_of_index (iterator_t *iterator) |
returns 0 at and of tree More... | |
iterator_t * | bplustree_iterator_next (iterator_t *iterator) |
fetches next key/value More... | |
const void * | bplustree_iterator_get_key (iterator_t *iterator) |
returns current key at iterator. More... | |
const void * | bplustree_iterator_get_data (iterator_t *iterator) |
returns current data at iterator. More... | |
int8_t | bplustree_set_comparator_for_unique_subpart_for_non_unique_index (index_t *idx, index_key_comparator_f comparator) |
sets a comparator for unique subpart for non unique index More... | |
int8_t | bplustree_set_key_destroyer (index_t *idx, bplustree_key_destroyer_f destroyer) |
sets a key destroyer for index More... | |
int8_t | bplustree_set_key_cloner (index_t *idx, bplustree_key_cloner_f cloner) |
sets a key cloner for index More... | |
index_t * | bplustree_create_index_with_heap_and_unique (memory_heap_t *heap, uint64_t max_key_count, index_key_comparator_f comparator, boolean_t unique) |
creates b+ tree index implementation More... | |
int8_t | bplustree_destroy_index (index_t *idx) |
destroys index More... | |
b+ tree implementation
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
boolean_t bplustree_contains | ( | index_t * | idx, |
const void * | key | ||
) |
b+ tree contains implementation. see also index_t contains method
index_t * bplustree_create_index_with_heap_and_unique | ( | memory_heap_t * | heap, |
uint64_t | max_key_count, | ||
index_key_comparator_f | comparator, | ||
boolean_t | unique | ||
) |
creates b+ tree index implementation
heap | heap to use |
max_key_count | maximum key count at each tree node |
comparator | key comparator |
unique | if unique flag set remove and insert key,value |
b+ tree delete implementation. see also index_t delete method
destroys index
[in] | idx | index to be destroyed |
destroys only b+tree not data. if data will not be destroyed a memory leak will be happened.
const void * bplustree_find | ( | index_t * | idx, |
const void * | key | ||
) |
b+ tree find implementation. see also index_t find method
const void * bplustree_get_min_key | ( | index_t * | idx, |
const bplustree_node_internal_t * | node | ||
) |
finds left leaf min key
[in] | node | node to start search |
int8_t bplustree_insert | ( | index_t * | idx, |
const void * | key, | ||
const void * | data, | ||
void ** | removed_data | ||
) |
b+ tree insert implementation. see also index_t insert method
iterator_t * bplustree_iterator_create | ( | index_t * | idx | ) |
creates b+ tree iterator
[in] | idx | source of b+ tree |
the iterator travels only leaf nodes.
int8_t bplustree_iterator_destroy | ( | iterator_t * | iterator | ) |
destroys the iterator
[in] | iterator | iterator to destroy |
int8_t bplustree_iterator_end_of_index | ( | iterator_t * | iterator | ) |
returns 0 at and of tree
[in] | iterator | iterator to check |
const void * bplustree_iterator_get_data | ( | iterator_t * | iterator | ) |
returns current data at iterator.
[in] | iterator | iterator to get data |
const void * bplustree_iterator_get_key | ( | iterator_t * | iterator | ) |
returns current key at iterator.
[in] | iterator | iterator to get key |
iterator_t * bplustree_iterator_next | ( | iterator_t * | iterator | ) |
fetches next key/value
[in] | iterator | iterator to travel |
iterator_t * bplustree_search | ( | index_t * | idx, |
const void * | key1, | ||
const void * | key2, | ||
const index_key_search_criteria_t | criteria | ||
) |
b+ tree search implementation. see also index_t search method
int8_t bplustree_set_comparator_for_unique_subpart_for_non_unique_index | ( | index_t * | idx, |
index_key_comparator_f | comparator | ||
) |
sets a comparator for unique subpart for non unique index
[in] | idx | index |
[in] | comparator | comparator |
sets a key cloner for index
[in] | idx | index |
[in] | cloner | cloner |
sets a key destroyer for index
[in] | idx | index |
[in] | destroyer | destroyer |
bplustree_node_internal_t * bplustree_split_node | ( | index_t * | idx, |
bplustree_node_internal_t * | node, | ||
void ** | ptr_par_key | ||
) |
splits node into two half with min key constraint.
[in] | idx | b+ tree index |
[in] | node | source node |
[out] | ptr_par_key | the middle key of partition (right node min key) |