summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2024-08-20 18:12:37 +0000
committerLaurent Bercot <ska@appnovation.com>2024-08-20 18:12:37 +0000
commit45c04a53fb9fbefe4dd86514c7563b4af1961dfb (patch)
tree4e90eed434b9292e405245d5394e9a9f3e3a3c46 /src/include
parent1360696c2d6ed7083a71979c8382c9d34df12cf0 (diff)
downloadshibari-45c04a53fb9fbefe4dd86514c7563b4af1961dfb.tar.xz
Add a lot of stuff, disable shibari-cache build for now
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/shibari/dcache.h41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/include/shibari/dcache.h b/src/include/shibari/dcache.h
index 1ec9fb6..1127249 100644
--- a/src/include/shibari/dcache.h
+++ b/src/include/shibari/dcache.h
@@ -12,26 +12,26 @@
#define DCACHE_MAGIC "--DCACHE--\n"
-typedef struct dcache_key_s dcache_key_t, *dcache_key_t_ref ;
-struct dcache_key_s
+typedef struct dcache_string_s dcache_string, *dcache_string_ref ;
+struct dcache_string_s
{
char *s ;
uint16_t len ;
} ;
-typedef struct dcache_node_s dcache_node_t, *dcache_node_t_ref ;
+typedef struct dcache_node_s dcache_node, *dcache_node_ref ;
struct dcache_node_s
{
- dcache_key_t key ;
- uint16_t datalen ;
- tain entry ;
- tain expire ;
+ stralloc sa ;
+ tai entry ;
+ tai expire ;
} ;
+#define DCACHE_NODE_ZERO = { .sa = STRALLOC_ZERO, .entry = TAI_INFINITE, .expire = TAI_INFINITE }
-typedef struct dcache_s dcache_t, *dcache_t_ref ;
+typedef struct dcache_s dcache, *dcache_ref ;
struct dcache_s
{
- gensetdyn storage ; /* dcache_node_t */
+ gensetdyn storage ; /* dcache_node */
avltree by_key ;
avltree by_entry ;
avltree by_expire ;
@@ -41,16 +41,17 @@ struct dcache_s
} ;
#define DCACHE_ZERO { .storage = GENSETDYN_ZERO, .by_key = AVLTREE_ZERO, .by_entry = AVLTREE_ZERO, .by_expire = AVLTREE_ZERO, .max = 0, .size = 0, .motion = 0 }
-extern void dcache_init (dcache_t *, uint64_t) ;
-extern dcache_node_t *dcache_search (dcache_t *, char const *, uint16_t, tain const *) ;
-#define dcache_search_g(d, key, keylen) dcache_search(d, key, (keylen), &STAMP)
-extern int dcache_add (dcache_t *, char const *, uint16_t, char const *, uint16_t, tain const *, tain const *) ;
-#define dcache_add_g(d, key, keylen, data, datalen, expire) dcache_add(d, key, keylen, data, datalen, (expire), &STAMP)
-extern void dcache_clean_expired (dcache_t *, tain const *) ;
-#define dcache_clean_expired_g(d) dcache_clean_expired((d), &STAMP)
-extern void dcache_free (dcache_t *) ;
-
-extern int dcache_save (dcache_t const *, char const *) ;
-extern int dcache_load (dcache_t *, char const *) ;
+extern void dcache_init (dcache *, uint64_t) ;
+
+extern int dcache_searchnode (dcache *, uint32_t *, char const *, uint16_t, uint16_t, tai const *) ;
+#define dcache_searchnode_g(d, idx, q, qlen, qtype) dcache_searchnode(d, idx, q, qlen, (qtype), tain_secp(&STAMP))
+
+extern void dcache_clean_expired (dcache *, tai const *) ;
+#define dcache_clean_expired_g(d) dcache_clean_expired((d), tain_secp(&STAMP))
+
+extern void dcache_free (dcache *) ;
+
+extern int dcache_save (dcache const *, char const *) ;
+extern int dcache_load (dcache *, char const *) ;
#endif