commit a84749cd077edf72cf65cf7c347ecdf7dc644dc5
parent 099b588be28e87a293f2360c9a20c59cb835c040
Author: William Casarin <jb55@jb55.com>
Date: Fri, 5 Jan 2024 20:40:14 -0800
nostrdb/debug: add print_kind_keys helper
I needed this for debugging kind queries
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c
@@ -5010,6 +5010,28 @@ void ndb_config_set_ingest_filter(struct ndb_config *config,
config->filter_context = filter_ctx;
}
+int ndb_print_kind_keys(struct ndb_txn *txn)
+{
+ MDB_cursor *cur;
+ MDB_val k, v;
+ int i;
+ struct ndb_u64_tsid *tsid;
+
+ if (mdb_cursor_open(txn->mdb_txn, txn->lmdb->dbs[NDB_DB_NOTE_KIND], &cur))
+ return 0;
+
+ i = 1;
+ while (mdb_cursor_get(cur, &k, &v, MDB_NEXT) == 0) {
+ tsid = k.mv_data;
+ printf("%d note_kind %" PRIu64 " %" PRIu64 "\n",
+ i, tsid->u64, tsid->timestamp);
+
+ i++;
+ }
+
+ return 1;
+}
+
// used by ndb.c
int ndb_print_search_keys(struct ndb_txn *txn)
{