]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add methods to get LRU hash sizes
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 5 Apr 2019 15:13:41 +0000 (16:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 5 Apr 2019 15:13:41 +0000 (16:13 +0100)
src/libutil/hash.c
src/libutil/hash.h

index b42dc6c51e894b236279c07b172a565b99d23639..d4fdfea468f9dc228f0ccb03a4113c47203dbf73 100644 (file)
@@ -697,4 +697,21 @@ rspamd_lru_hash_foreach (rspamd_lru_hash_t *h, int it, gpointer *k,
        }
 
        return i;
+}
+
+
+guint
+rspamd_lru_hash_size (rspamd_lru_hash_t *hash)
+{
+       return kh_size (hash);
+}
+
+/**
+ * Returns hash capacity
+ * @param hash hash object
+ */
+guint
+rspamd_lru_hash_capacity (rspamd_lru_hash_t *hash)
+{
+       return hash->n_buckets;
 }
\ No newline at end of file
index f983a0be88135ac7e5d34860c804e0968018fe02..bae3cacfaa974667d82e81eea7483bdf11ba61da 100644 (file)
@@ -89,4 +89,16 @@ void rspamd_lru_hash_destroy (rspamd_lru_hash_t *hash);
  */
 int rspamd_lru_hash_foreach (rspamd_lru_hash_t *hash, int it, gpointer *k,
                gpointer *v);
+
+/**
+ * Returns number of elements in a hash
+ * @param hash hash object
+ */
+guint rspamd_lru_hash_size (rspamd_lru_hash_t *hash);
+
+/**
+ * Returns hash capacity
+ * @param hash hash object
+ */
+guint rspamd_lru_hash_capacity (rspamd_lru_hash_t *hash);
 #endif