chore(lsm): remove outdated files

lsm
Jef Roosens 2023-10-29 13:47:39 +01:00
parent 8b2117a66c
commit 1c421c1e67
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
5 changed files with 0 additions and 142 deletions

View File

@ -1,23 +0,0 @@
#include <stdlib.h>
#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; */
/* } */

View File

@ -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

View File

@ -1,63 +0,0 @@
#include <stdlib.h>
#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;
}

View File

@ -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

View File

@ -1,4 +1,3 @@
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "lsm.h" #include "lsm.h"