fix(lsm): store data len in db; fix bug

This commit is contained in:
Jef Roosens 2023-11-08 16:04:21 +01:00
parent ef33825b7b
commit 9c03a36aa2
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
5 changed files with 25 additions and 3 deletions

View file

@ -1,4 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "lander.h"
#include "log.h"
@ -20,6 +22,7 @@
int main() {
setvbuf(stdout, NULL, _IONBF, 0);
srand(time(NULL));
ENV(api_key, "LANDER_API_KEY");
ENV_OPT(port_str, "LANDER_PORT", "18080");
@ -47,14 +50,18 @@ int main() {
lander_gctx *c_gctx = lander_gctx_init();
c_gctx->data_dir = data_dir_s;
/* c_gctx->trie = trie; */
lsm_str *data_dir;
lsm_str_init_copy(&data_dir, (char *)data_dir_s);
info("Initializing store from path '%s'", data_dir_s);
if (lsm_store_load(&c_gctx->store, data_dir) != lsm_error_ok) {
critical(2, "Failed to load existing store.");
}
info("Store loaded containing %lu entries.", lsm_store_size(c_gctx->store));
http_loop *hl = http_loop_init(
lander_routes, sizeof(lander_routes) / sizeof(lander_routes[0]), c_gctx,
lander_ctx_init, (void (*)(void *))lander_ctx_reset,