Skip to content

Commit

Permalink
print-search-keys: add size of key information
Browse files Browse the repository at this point in the history
Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Jan 15, 2025
1 parent cc5441f commit 9ce98a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/nostrdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
19 changes: 11 additions & 8 deletions src/print_util.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
#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++) {
printf("%02x", data[i]);
}
}

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];
Expand Down

0 comments on commit 9ce98a2

Please sign in to comment.