diff options
Diffstat (limited to 'source/b_tree.h')
| -rw-r--r-- | source/b_tree.h | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/source/b_tree.h b/source/b_tree.h deleted file mode 100644 index 0fc4d3c..0000000 --- a/source/b_tree.h +++ /dev/null | |||
| @@ -1,44 +0,0 @@ | |||
| 1 | #ifndef BTREE_H | ||
| 2 | #define BTREE_H | ||
| 3 | |||
| 4 | // maximum height of the tree the lower the lower the lower amount | ||
| 5 | // of disk reads which translates into faster? | ||
| 6 | #define B_TREE_ORDER 4 | ||
| 7 | |||
| 8 | typedef struct b_tree_node b_tree_node; | ||
| 9 | struct b_tree_node | ||
| 10 | { | ||
| 11 | |||
| 12 | // store the values | ||
| 13 | string8 keys[B_TREE_ORDER - 1]; | ||
| 14 | csv_row *rows[B_TREE_ORDER - 1]; | ||
| 15 | |||
| 16 | b_tree_node *parent; | ||
| 17 | // handle to store children faster than linked list | ||
| 18 | // because now we can iteratate over the nodes instead of having cache misses | ||
| 19 | // when jumping through linked nodes | ||
| 20 | b_tree_node *children[B_TREE_ORDER]; | ||
| 21 | |||
| 22 | // NOTE(nasr): reference count ::: check how many leaves are using this node | ||
| 23 | // also not needed for now because we don't free individual node because of arena allocator | ||
| 24 | // s32 *refc; | ||
| 25 | |||
| 26 | s32 key_count; | ||
| 27 | |||
| 28 | b32 leaf; | ||
| 29 | |||
| 30 | }; | ||
| 31 | |||
| 32 | typedef struct b_tree b_tree; | ||
| 33 | struct b_tree | ||
| 34 | { | ||
| 35 | // NOTE(nasr): make sure this always stays in memory | ||
| 36 | // so that initial fetch never requires a disk read | ||
| 37 | b_tree_node *root; | ||
| 38 | |||
| 39 | }; | ||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | #endif /* BTREE_H */ | ||
