nostrdb

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

commit 2bd167406b72212d9ba13aa046bdd20934182ff4
parent 59fe0d73ef54f70f05a7ada7ba11db7a36283a89
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  7 Aug 2023 10:03:57 -0700

make: add lmdb to build

Diffstat:
MMakefile | 31++++++++++++++++++++++++-------
MTODO | 5++++-
2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,9 +1,9 @@ -INCLUDES = deps/secp256k1/include -CFLAGS = -Wall -Wno-unused-function -Werror -O2 -g -I$(INCLUDES) +CFLAGS = -Wall -Wno-unused-function -Werror -O2 -g -Ideps/secp256k1/include -Ideps/lmdb HEADERS = sha256.h nostrdb.h cursor.h hex.h jsmn.h config.h sha256.h random.h SRCS = nostrdb.c sha256.c LDS = $(SRCS) $(ARS) -ARS = libsecp256k1.a +ARS = deps/lmdb/liblmdb.a deps/secp256k1/.libs/libsecp256k1.a +LMDB_VER=0.9.31 DEPS = $(SRCS) $(HEADERS) $(ARS) PREFIX ?= /usr/local SUBMODULES = deps/secp256k1 @@ -22,6 +22,9 @@ check: test clean: rm -rf test bench bindings +distclean: + rm -rf deps + tags: ctags *.c *.h @@ -61,7 +64,21 @@ bindings/swift/NdbProfile.swift: schemas/profile.fbs bindings/swift flatc --swift $< @mv profile_generated.swift $@ -deps/secp256k1/.git: +deps/.dir: + @mkdir -p deps + touch deps/.dir + +deps/LMDB_$(LMDB_VER).tar.gz: deps/.dir + curl -L https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_$(LMDB_VER).tar.gz -o $@ + +deps/lmdb/lmdb.h: deps/LMDB_$(LMDB_VER).tar.gz deps/.dir + tar xf $< + rm -rf deps/lmdb + mv lmdb-LMDB_$(LMDB_VER)/libraries/liblmdb deps/lmdb + rm -rf lmdb-LMDB_$(LMDB_VER) + touch $@ + +deps/secp256k1/.git: deps/.dir @devtools/refresh-submodules.sh $(SUBMODULES) deps/secp256k1/include/secp256k1.h: deps/secp256k1/.git @@ -78,8 +95,8 @@ deps/secp256k1/config.log: deps/secp256k1/configure cd deps/secp256k1; \ ./configure --disable-shared --enable-module-ecdh --enable-module-schnorrsig --enable-module-extrakeys -libsecp256k1.a: deps/secp256k1/.libs/libsecp256k1.a - cp $< $@ +deps/lmdb/liblmdb.a: deps/lmdb/lmdb.h + $(MAKE) -C deps/lmdb liblmdb.a bench: bench.c $(DEPS) $(CC) $(CFLAGS) bench.c $(LDS) -o $@ @@ -90,4 +107,4 @@ test: test.c $(DEPS) %.o: %.c $(CC) $(CFLAGS) -.PHONY: tags clean +.PHONY: tags clean distclean diff --git a/TODO b/TODO @@ -1,5 +1,8 @@ (A) ndb_process_event (B) setup lmdb environment -(C) insert and retrieve test +(B) insert and retrieve test +(B) injester thread with lots of data +(C) flatbuffer profile parsing +(C) store profiles in lmdb setup dup_sort clustered created_at keys