Turnstone Operating System
Loading...
Searching...
No Matches
bplustree.h File Reference

b+ tree indexer interface More...

#include <types.h>
#include <memory.h>
#include <indexer.h>
#include <list.h>
#include <iterator.h>

Macros

#define ___BPLUSTREE_H   0
 
#define bplustree_create_index(mkc, c)
 creates b+ tree index with default heap
 
#define bplustree_create_index_with_unique(mkc, c, u)
 creates b+ tree index with default heap
 
#define bplustree_create_index_with_heap(h, mkc, c)
 creates b+ tree index with default heap
 

Typedefs

typedef int8_t(* bplustree_key_destroyer_f) (memory_heap_t *heap, void *key)
 
typedef int8_t(* bplustree_key_cloner_f) (memory_heap_t *heap, const void *key, void **cloned_key)
 

Functions

index_tbplustree_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
 
int8_t bplustree_destroy_index (index_t *idx)
 destroys index
 
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
 
int8_t bplustree_set_key_destroyer (index_t *idx, bplustree_key_destroyer_f destroyer)
 sets a key destroyer for index
 
int8_t bplustree_set_key_cloner (index_t *idx, bplustree_key_cloner_f cloner)
 sets a key cloner for index
 

Detailed Description

b+ tree indexer interface

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Macro Definition Documentation

◆ ___BPLUSTREE_H

#define ___BPLUSTREE_H   0

prevent duplicate header error macro

◆ bplustree_create_index

#define bplustree_create_index ( mkc,
c )
Value:
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
Definition bplustree.64.c:180

creates b+ tree index with default heap

Parameters
[in]mkcmax key count
[in]ccomparator
Returns
b+ tree index

◆ bplustree_create_index_with_heap

#define bplustree_create_index_with_heap ( h,
mkc,
c )
Value:

creates b+ tree index with default heap

Parameters
[in]hheap to use
[in]mkcmax key count
[in]ccomparator
Returns
b+ tree index

◆ bplustree_create_index_with_unique

#define bplustree_create_index_with_unique ( mkc,
c,
u )
Value:

creates b+ tree index with default heap

Parameters
[in]mkcmax key count
[in]ccomparator
[in]uunique flag
Returns
b+ tree index

Function Documentation

◆ bplustree_create_index_with_heap_and_unique()

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

Parameters
heapheap to use
max_key_countmaximum key count at each tree node
comparatorkey comparator
uniqueif unique flag set remove and insert key,value
Returns
index interface

◆ bplustree_destroy_index()

int8_t bplustree_destroy_index ( index_t * idx)

destroys index

Parameters
[in]idxindex to be destroyed
Returns
0 if successed.

destroys only b+tree not data. if data will not be destroyed a memory leak will be happened.

◆ bplustree_set_comparator_for_unique_subpart_for_non_unique_index()

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

Parameters
[in]idxindex
[in]comparatorcomparator
Returns
0 if successed.

◆ bplustree_set_key_cloner()

int8_t bplustree_set_key_cloner ( index_t * idx,
bplustree_key_cloner_f cloner )

sets a key cloner for index

Parameters
[in]idxindex
[in]clonercloner
Returns
0 if successed.

◆ bplustree_set_key_destroyer()

int8_t bplustree_set_key_destroyer ( index_t * idx,
bplustree_key_destroyer_f destroyer )

sets a key destroyer for index

Parameters
[in]idxindex
[in]destroyerdestroyer
Returns
0 if successed.