nostrdb: ndb_filter_is_subset_of

subset testing for filters. Can be used to see if one subset is
redundant in the presence of a another in the local relay model

Changelog-Added: Add ndb_filter_is_subset_of
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-11-03 11:11:32 -08:00
committed by Daniel D’Aquino
parent 44ab702792
commit 573de6b881
2 changed files with 44 additions and 0 deletions

View File

@@ -499,6 +499,9 @@ int ndb_filter_add_int_element(struct ndb_filter *, uint64_t integer);
int ndb_filter_add_str_element(struct ndb_filter *, const char *str);
int ndb_filter_eq(struct ndb_filter *, struct ndb_filter *);
/// is `a` a subset of `b`
int ndb_filter_is_subset_of(struct ndb_filter *a, struct ndb_filter *b);
// filters from json
int ndb_filter_from_json(const char *, int len, struct ndb_filter *filter, unsigned char *buf, int bufsize);