William Casarin
77601e77ee
nostrdb/filter: rename FILTER_GENERIC to FILTER_TAG
...
it's a bit more intuitive
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
206efba58a
nostrdb/cleanup: remove old dbscan stuff
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
a84749cd07
nostrdb/debug: add print_kind_keys helper
...
I needed this for debugging kind queries
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
shuoer86
099b588be2
nostrdb/Fix typos
...
Closes: https://github.com/damus-io/nostrdb/pull/25
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
75c7adddb8
nostrdb/query: implement kind queries
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
9f1b9ab945
nostrdb/Initial nostrdb queries
...
Still a lot more work to do, but this is at least a proof of concept for
querying nostrdb using filters.
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
942e47a720
nostrdb/query: extract ndb_cursor_start
...
This is useful for positioning LMDB cursors at the start of a query. We
will be re-using this in the upcoming query code
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
2b14acd62f
nostrdb/filter: don't allow adding id elements on kinds
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
267a9ac54b
nostrdb/ocd: small cleanup
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
8b03ed6175
nostrdb/filters: remove ndb_filter_group from public API
...
We can just use a list of filters instead when subscribing
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
6cd7b945ca
nostrdb/filter: use binary search for large contact list filters
...
This is much more efficient than linear scans
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:59 -07:00
William Casarin
e5e6735129
nostrdb/filter: sort filter elements
...
If they are sorted we can do binary search when matching filters like
how strfry does it.
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
9c2f7a931c
nostrdb/subs: always fail when calling wait_for_notes on a subid of 0
...
this is an invalid subscription id
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
b1bbf355de
nostrdb/subs: notify on profile notes as well
...
We missed this in the original subscription code
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
d7a2064786
nostrdb/debug: add a few more debug statement
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
4d14ca8d0a
nostrdb/filters: add ndb_filter_group_init function
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
81d65cd5bf
nostrdb/subs: subs and monitor cleanup
...
We need to free these resources when we're done with them.
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
f03d8a5ac9
nostrdb/search: don't enforce sequential tokens
...
This makes it a bit more flexible, but maybe we can add quoting in the
future that re-enables this. Or maybe a search option
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
0df18ae1a4
nostrdb/test: switch reaction test to use subscriptions
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
8c5ec32eaa
nostrdb/Initial nostrdb relay subscriptions
...
This adds some initial code for the nostrdb relay subscription monitor.
When new notes are written to the database, they are checked against
active subscriptions. If any of the subscriptions are matched, the note
primary key is written to the inbox queue for that subscription.
We also add an ndb_wait_for_notes() method that simply waits for notes
to be written by the subscription monitor.
Changelog-Added: Added filter subscriptions
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
432cdb96d9
nostrdb/fix: don't write the owned flag to the DB
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
d063362bd7
nostrdb/blocks: write note blocks on ingest
...
When ingesting notes, parse text/longform contents and store them in nostrdb.
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
e0a2dcf3db
nostrdb/Inital embedded content parser
...
This adds some initial code for nostrdb content parsing.
We still need to write tests for encoding and decoding, so this is
likely not working yet.
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
9ff1f69a82
nostrdb/search: switch to cursor_align function
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
76862776b8
nostrdb/varint: switch to 64 bit varints
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00
William Casarin
1ffbd80c67
nostrdb: move everything to src
...
Signed-off-by: William Casarin <jb55@jb55.com >
2025-08-11 16:39:43 -07:00