nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

schema_table.c (570B)


      1  /* Note: only one hash table can be implemented a single file. */
      2 #include "../symbols.h"
      3 #include "hash/hash_table_def.h"
      4 DEFINE_HASH_TABLE(fb_schema_table)
      5 
      6 #include "hash/hash_table_impl.h"
      7 
      8 static inline int ht_match(const void *key, size_t len, fb_schema_t *schema)
      9 {
     10     return len == (size_t)schema->name.name.s.len && memcmp(key, schema->name.name.s.s, len) == 0;
     11 }
     12 
     13 static inline const void *ht_key(fb_schema_t *schema)
     14 {
     15     return schema->name.name.s.s;
     16 }
     17 
     18 static inline size_t ht_key_len(fb_schema_t *schema)
     19 {
     20     return (size_t)schema->name.name.s.len;
     21 }