feat(lsm): start of on-disk database

This commit is contained in:
Jef Roosens 2023-11-07 17:43:15 +01:00
parent eb9157281b
commit 46f89059e4
Signed by: Jef Roosens
GPG key ID: 02D4C0997E74717B
6 changed files with 199 additions and 23 deletions

View file

@ -31,28 +31,27 @@ int main() {
critical(1, "Invalid TCP port %s", port_str);
}
char file_path[strlen(data_dir) + 12 + 1];
sprintf(file_path, "%s/lander.data", data_dir);
/* char file_path[strlen(data_dir) + 12 + 1]; */
/* sprintf(file_path, "%s/lander.data", data_dir); */
info("Initializing trie from file '%s'", file_path);
/* info("Initializing trie from file '%s'", file_path); */
Trie *trie;
TrieExitCode res = trie_init(&trie, file_path);
/* Trie *trie; */
/* TrieExitCode res = trie_init(&trie, file_path); */
if (res != Ok) {
critical(1, "An error occured while populating the trie.");
}
/* if (res != Ok) { */
/* critical(1, "An error occured while populating the trie."); */
/* } */
info("Trie initialized and populated with %i entries", trie_size(trie));
/* info("Trie initialized and populated with %i entries", trie_size(trie)); */
lander_gctx *c_gctx = lander_gctx_init();
c_gctx->data_dir = data_dir;
c_gctx->trie = trie;
/* c_gctx->trie = trie; */
lsm_str *db_path, *data_dir2;
lsm_str_init_copy(&db_path, "data/store.db");
lsm_str *data_dir2;
lsm_str_init_copy(&data_dir2, "data");
lsm_store_load(&c_gctx->store, db_path, data_dir2);
lsm_store_load(&c_gctx->store, data_dir2);
http_loop *hl = http_loop_init(
lander_routes, sizeof(lander_routes) / sizeof(lander_routes[0]), c_gctx,