From 1c421c1e678b06f73892b873011888c49eeea9d2 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Sun, 29 Oct 2023 13:47:39 +0100 Subject: [PATCH] chore(lsm): remove outdated files --- lsm/src/lsm_store.c | 23 --------------- lsm/src/lsm_store.h | 12 -------- lsm/src/lsm_store_node.c | 63 ---------------------------------------- lsm/src/lsm_store_node.h | 43 --------------------------- lsm/src/trie/lsm_trie.c | 1 - 5 files changed, 142 deletions(-) delete mode 100644 lsm/src/lsm_store.c delete mode 100644 lsm/src/lsm_store.h delete mode 100644 lsm/src/lsm_store_node.c delete mode 100644 lsm/src/lsm_store_node.h diff --git a/lsm/src/lsm_store.c b/lsm/src/lsm_store.c deleted file mode 100644 index 1a5a445..0000000 --- a/lsm/src/lsm_store.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "lsm.h" -#include "lsm_store.h" - -/** - * Initialize a new lsm_store struct. - * - * @param lsm_store pointer to where to store the newly allocated object's - * pointer - * @return success of the function - */ -/* lsm_error lsm_store_init(lsm_store **ptr) { */ -/* lsm_store *store = calloc(1, sizeof(lsm_store)); */ - -/* if (store == NULL) { */ -/* return lsm_error_failed_alloc; */ -/* } */ - -/* *ptr = store; */ - -/* return lsm_error_ok; */ -/* } */ diff --git a/lsm/src/lsm_store.h b/lsm/src/lsm_store.h deleted file mode 100644 index c73b2e9..0000000 --- a/lsm/src/lsm_store.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef LSM_STORE_INTERNAL -#define LSM_STORE_INTERNAL - -#include "lsm.h" -#include "lsm_store_node.h" - -struct lsm_store { - lsm_store_node *root; - uint64_t size; -}; - -#endif diff --git a/lsm/src/lsm_store_node.c b/lsm/src/lsm_store_node.c deleted file mode 100644 index b50f15e..0000000 --- a/lsm/src/lsm_store_node.c +++ /dev/null @@ -1,63 +0,0 @@ -#include - -#include "lsm.h" -#include "lsm_store_node.h" - -lsm_error lsm_store_inode_init(lsm_store_inode **ptr, const char c) { - lsm_store_inode *node = calloc(1, sizeof(lsm_store_inode)); - - if (node == NULL) { - return lsm_error_failed_alloc; - } - - node->key = c; - *ptr = node; - - return lsm_error_ok; -} - -lsm_error lsm_store_node_init(lsm_store_node **ptr) { - lsm_store_node *node = calloc(1, sizeof(lsm_store_node)); - - if (node == NULL) { - return lsm_error_failed_alloc; - } - - *ptr = node; - - return lsm_error_ok; -} - -lsm_error lsm_store_node_search(lsm_store_node **out_ptr, lsm_store_node *node, - const char c) { - if (node->size == 0) { - return lsm_error_not_found; - } - - lsm_store_inode *parent = node->root; - lsm_store_inode *child; - lsm_store_node *out = NULL; - - while (1) { - if (parent->key == c) { - out = parent->next; - break; - } - - child = (c < parent->key) ? parent->left : parent->right; - - if (child == NULL) { - break; - } - - parent = child; - }; - - if (out == NULL) { - return lsm_error_not_found; - } - - *out_ptr = out; - - return lsm_error_ok; -} diff --git a/lsm/src/lsm_store_node.h b/lsm/src/lsm_store_node.h deleted file mode 100644 index 826b312..0000000 --- a/lsm/src/lsm_store_node.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef LSM_STORE_NODE_INTERNAL -#define LSM_STORE_NODE_INTERNAL - -#include "lsm.h" - -/** - * A node inside a store node's internal binary tree. - */ -typedef struct lsm_store_inode { - struct lsm_store_inode *left; - struct lsm_store_inode *right; - struct lsm_store_node *next; - char key; -} lsm_store_inode; - -/** - * Initialize a new lsm_store_inode. - */ -lsm_error lsm_store_inode_init(lsm_store_inode **ptr, const char c); - -/** - * A node inside the store's trie structure. Internally, each node manages a - * binary tree. - */ -typedef struct lsm_store_node { - /* lsm_entry *entry; */ - lsm_store_inode *root; - uint8_t size; - /* lsm_string skip; */ -} lsm_store_node; - -/** - * Initialize a new lsm_store_node. - */ -lsm_error lsm_store_node_init(lsm_store_node **out); - -/** - * Search for the next node following the given character, if present. - */ -lsm_error lsm_store_node_search(lsm_store_node **out, lsm_store_node *node, - const char c); - -#endif diff --git a/lsm/src/trie/lsm_trie.c b/lsm/src/trie/lsm_trie.c index b6e190a..8744b4e 100644 --- a/lsm/src/trie/lsm_trie.c +++ b/lsm/src/trie/lsm_trie.c @@ -1,4 +1,3 @@ -#include #include #include "lsm.h"