nostrdb

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

commit 9ce98a2a733e91facff9dbc03f62d4d0e1fd1de3
parent cc5441febb9b5d99196da3d63c59734e9d182e85
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 15 Jan 2025 10:29:53 -0800

print-search-keys: add size of key information

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Msrc/nostrdb.c | 2+-
Msrc/print_util.h | 19+++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/nostrdb.c b/src/nostrdb.c @@ -6854,7 +6854,7 @@ int ndb_print_search_keys(struct ndb_txn *txn) continue; } - ndb_print_text_search_key(&search_key); + ndb_print_text_search_key(k.mv_size, &search_key); printf("\n"); i++; diff --git a/src/print_util.h b/src/print_util.h @@ -1,14 +1,6 @@ #include "hex.h" #include "lmdb.h" -static void ndb_print_text_search_key(struct ndb_text_search_key *key) -{ - printf("K<'%.*s' %" PRIu64 " %" PRIu64 " note_id:%" PRIu64 ">", (int)key->str_len, key->str, - key->word_index, - key->timestamp, - key->note_id); -} - static void print_hex(unsigned char* data, size_t size) { size_t i; for (i = 0; i < size; i++) { @@ -16,6 +8,17 @@ static void print_hex(unsigned char* data, size_t size) { } } +static void ndb_print_text_search_key(int bytes_size, struct ndb_text_search_key *key) +{ + printf("K<'%.*s' %" PRIu64 " %" PRIu64 " note_id:%" PRIu64 " bytes:%d>", (int)key->str_len, key->str, + key->word_index, + key->timestamp, + key->note_id, + bytes_size + ); + +} + static void print_tag_kv(struct ndb_txn *txn, MDB_val *k, MDB_val *v) { char hex_id[65];