nostrdb: add ndb_subscription_filters
Expose a way to get the set of filters for a subscription. On the rust side, we should likely ndb_filter_clone each filter asap, because the result of this function will only be valid up until the subscription ends. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
47b79fc02e
commit
3018200e95
@@ -6467,6 +6467,20 @@ int ndb_unsubscribe(struct ndb *ndb, uint64_t subid)
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct ndb_filter *ndb_subscription_filters(struct ndb *ndb, uint64_t subid, int *filters)
|
||||
{
|
||||
struct ndb_subscription *sub;
|
||||
|
||||
sub = ndb_find_subscription(ndb, subid, NULL);
|
||||
if (sub) {
|
||||
*filters = sub->group.num_filters;
|
||||
return sub->group.filters;
|
||||
}
|
||||
|
||||
*filters = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ndb_num_subscriptions(struct ndb *ndb)
|
||||
{
|
||||
return ndb->monitor.num_subscriptions;
|
||||
|
||||
@@ -521,6 +521,7 @@ int ndb_wait_for_notes(struct ndb *, uint64_t subid, uint64_t *note_ids, int not
|
||||
int ndb_poll_for_notes(struct ndb *, uint64_t subid, uint64_t *note_ids, int note_id_capacity);
|
||||
int ndb_unsubscribe(struct ndb *, uint64_t subid);
|
||||
int ndb_num_subscriptions(struct ndb *);
|
||||
struct ndb_filter *ndb_subscription_filters(struct ndb *, uint64_t subid, int *filters);
|
||||
|
||||
// FULLTEXT SEARCH
|
||||
int ndb_text_search(struct ndb_txn *txn, const char *query, struct ndb_text_search_results *, struct ndb_text_search_config *);
|
||||
|
||||
Reference in New Issue
Block a user