nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit bf5f4237a4a0d4967f443c21d2a43b7ef3de9828
parent 5517c2bb2ca9ef613c3c3423088951cb76e973b0
Author: William Casarin <jb55@jb55.com>
Date:   Fri,  1 Dec 2023 14:26:13 -0800

util/ndb: fix build

Diffstat:
M.github/workflows/c-cpp.yml | 3+++
MMakefile | 2+-
Mndb.c | 9++++++---
3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml @@ -29,5 +29,8 @@ jobs: ./scripts/build.sh sudo cp bin/flatcc /usr/bin + - name: make all + run: make + - name: make check run: make check diff --git a/Makefile b/Makefile @@ -18,7 +18,7 @@ BIN=ndb CHECKDATA=testdata/db/v0/data.mdb -all: $(BIN) lib bindings +all: $(BIN) lib bindings ndb lib: benches test diff --git a/ndb.c b/ndb.c @@ -89,7 +89,6 @@ static void print_stats(struct ndb_stat *stat) int main(int argc, char *argv[]) { struct ndb *ndb; - int threads = 6; int i, flags; struct ndb_stat stat; struct ndb_txn txn; @@ -97,7 +96,9 @@ int main(int argc, char *argv[]) const char *dir; unsigned char *data; size_t data_len; - size_t mapsize = 1024ULL * 1024ULL * 1024ULL * 1024ULL; // 1 TiB + struct ndb_config config; + ndb_default_config(&config); + ndb_config_set_mapsize(&config, 1024ULL * 1024ULL * 1024ULL * 1024ULL /* 1 TiB */); if (argc < 2) { return usage(); @@ -118,9 +119,11 @@ int main(int argc, char *argv[]) } } + ndb_config_set_flags(&config, flags); + fprintf(stderr, "using db '%s'\n", dir); - if (!ndb_init(&ndb, dir, mapsize, threads, flags)) { + if (!ndb_init(&ndb, dir, &config)) { return 2; }