nostrdb

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

commit 3aac9f7aca59cee7f4c5277f0bc3c1d0b28cc92c
parent cebd545c19ad9079f0d183615c784cd684306f1b
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 25 Jan 2024 17:52:13 -0800

blocks: add word count interface

Diffstat:
Msrc/block.c | 4++++
Msrc/nostrdb.h | 1+
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/block.c b/src/block.c @@ -198,3 +198,7 @@ void ndb_blocks_free(struct ndb_blocks *blocks) { int ndb_blocks_flags(struct ndb_blocks *blocks) { return blocks->flags; } + +int ndb_blocks_word_count(struct ndb_blocks *blocks) { + return blocks->words; +} diff --git a/src/nostrdb.h b/src/nostrdb.h @@ -536,6 +536,7 @@ int ndb_parse_content(unsigned char *buf, int buf_size, enum ndb_block_type ndb_get_block_type(struct ndb_block *block); int ndb_blocks_flags(struct ndb_blocks *block); size_t ndb_blocks_total_size(struct ndb_blocks *blocks); +int ndb_blocks_word_count(struct ndb_blocks *blocks); /// Free blocks if they are owned, safe to call on unowned blocks as well. void ndb_blocks_free(struct ndb_blocks *blocks);