From 2a09bd715669a147d2ad41b21a80798eba13b3c2 Mon Sep 17 00:00:00 2001 From: LDA Date: Sat, 10 Aug 2024 10:40:36 +0200 Subject: [PATCH] [ADD/WIP] Test out LMDB Separate branch because I'm mainly testing reliability. Seek out lda/Cytoplasm's lmdbwerk branch for the base upstream(with mem-moment's Memory.c impl to apply) --- README.MD | 3 ++- src/Parsee/Data.c | 2 +- src/include/Parsee.h | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.MD b/README.MD index 474d399..a251d6b 100644 --- a/README.MD +++ b/README.MD @@ -65,8 +65,9 @@ TODO pulls in *way too many* dependencies, and that lacks a C binding. We may put in the work of either forking off libolm or making a binding to KappaChat. -- Mess with Cytoplasm to make it have support for something like LMDB as an +~ Mess with Cytoplasm to make it have support for something like LMDB as an *optional* dependency. This should increase reliability and speed for anyone. + v Work is going on on the Cytoplasm `lmdbwerk` and this branch to get LMDB. - Nesting might be an issue we'll need to deal with. libdb and Berkley DB seem to lack support for them. If we can shove entries at specific indices, we _might_ just manage to get some system that can at least emulate that, diff --git a/src/Parsee/Data.c b/src/Parsee/Data.c index 74b4be0..771d0ac 100644 --- a/src/Parsee/Data.c +++ b/src/Parsee/Data.c @@ -27,7 +27,7 @@ ParseeInitData(XMPPComponent *comp) data->router = HttpRouterCreate(); data->jabber = comp; data->handler = CommandCreateRouter(); - data->db = DbOpen(data->config->db_path, 0); + data->db = DbOpenLMDB(data->config->db_path, 64 MB); #define X_ROUTE(path, func) do {\ if (!HttpRouterAdd(data->router, path, func))\ diff --git a/src/include/Parsee.h b/src/include/Parsee.h index 38552d9..e8b068e 100644 --- a/src/include/Parsee.h +++ b/src/include/Parsee.h @@ -65,6 +65,12 @@ typedef struct ParseeData { #define MINUTES * 60 SECONDS #define HOURS * 60 MINUTES +/* Size units(using 2^10 as a reference), to be used like the time units */ +#define B * 1 +#define KB * 1024 B +#define MB * 1024 KB +#define GB * 1024 MB + /* Initialises a Parsee config from scratch, and writes to it * as JSON in the CWD. */ extern void ParseeConfigInit(void);