From 1852910ef0fd7393da62b88aee66ee092208748e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 12:41:58 +0200 Subject: Adding upstream version 5.3.1. Signed-off-by: Daniel Baumann --- utils/cache_gc/db.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 utils/cache_gc/db.h (limited to 'utils/cache_gc/db.h') diff --git a/utils/cache_gc/db.h b/utils/cache_gc/db.h new file mode 100644 index 0000000..15d26ca --- /dev/null +++ b/utils/cache_gc/db.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +#pragma once + +#include +#include + +#include "kr_cache_gc.h" + +int kr_gc_cache_open(const char *cache_path, struct kr_cache *kres_db, + knot_db_t ** libknot_db); + +/** A wrapper around kr_cdb_api::check_health that keeps libknot_db up to date. + * \return zero or negative error code. */ +int kr_gc_cache_check_health(struct kr_cache *kres_db, knot_db_t ** libknot_db); + +void kr_gc_cache_close(struct kr_cache *kres_db, knot_db_t * knot_db); + +typedef int (*kr_gc_iter_callback)(const knot_db_val_t * key, + gc_record_info_t * info, void *ctx); + +int kr_gc_cache_iter(knot_db_t * knot_db, const kr_cache_gc_cfg_t *cfg, + kr_gc_iter_callback callback, void *ctx); + +/** Return RR type corresponding to the key or NULL. + * + * NULL is returned on unexpected values (those also trigger assertion) + * and on other kinds of data in cache (e.g. struct rtt_state). + */ +const uint16_t *kr_gc_key_consistent(knot_db_val_t key); + +/** Printf a *binary* string in a human-readable way. */ +void debug_printbin(const char *str, unsigned int len); + -- cgit v1.2.3