diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 11:19:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:53:24 +0000 |
commit | b5f8ee61a7f7e9bd291dd26b0585d03eb686c941 (patch) | |
tree | d4d31289c39fc00da064a825df13a0b98ce95b10 /src/database/sqlite/sqlite_metadata.h | |
parent | Adding upstream version 1.44.3. (diff) | |
download | netdata-upstream.tar.xz netdata-upstream.zip |
Adding upstream version 1.46.3.upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/database/sqlite/sqlite_metadata.h')
-rw-r--r-- | src/database/sqlite/sqlite_metadata.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/database/sqlite/sqlite_metadata.h b/src/database/sqlite/sqlite_metadata.h new file mode 100644 index 000000000..9e76e2a50 --- /dev/null +++ b/src/database/sqlite/sqlite_metadata.h @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_SQLITE_METADATA_H +#define NETDATA_SQLITE_METADATA_H + +#include "sqlite3.h" +#include "sqlite_functions.h" + +// return a node list +struct node_instance_list { + nd_uuid_t node_id; + nd_uuid_t host_id; + char *hostname; + int live; + int queryable; + int hops; +}; + +typedef enum db_check_action_type { + DB_CHECK_NONE = (1 << 0), + DB_CHECK_RECLAIM_SPACE = (1 << 1), + DB_CHECK_ANALYZE = (1 << 2), + DB_CHECK_CONT = (1 << 3), + DB_CHECK_RECOVER = (1 << 4), +} db_check_action_type_t; + +// To initialize and shutdown +void metadata_sync_init(void); +void metadata_sync_shutdown(void); +void metadata_sync_shutdown_prepare(void); + +void metaqueue_delete_dimension_uuid(nd_uuid_t *uuid); +void metaqueue_store_claim_id(nd_uuid_t *host_uuid, nd_uuid_t *claim_uuid); +void metaqueue_host_update_info(RRDHOST *host); +void metaqueue_ml_load_models(RRDDIM *rd); +void detect_machine_guid_change(nd_uuid_t *host_uuid); +void metadata_queue_load_host_context(RRDHOST *host); +void metadata_delete_host_chart_labels(char *machine_guid); +void vacuum_database(sqlite3 *database, const char *db_alias, int threshold, int vacuum_pc); + +int sql_metadata_cache_stats(int op); + +int get_node_id(nd_uuid_t *host_id, nd_uuid_t *node_id); +int update_node_id(nd_uuid_t *host_id, nd_uuid_t *node_id); +struct node_instance_list *get_node_list(void); +void sql_load_node_id(RRDHOST *host); + +// Help build archived hosts in memory when agent starts +void sql_build_host_system_info(nd_uuid_t *host_id, struct rrdhost_system_info *system_info); +void invalidate_node_instances(nd_uuid_t *host_id, nd_uuid_t *claim_id); +RRDLABELS *sql_load_host_labels(nd_uuid_t *host_id); +bool sql_set_host_label(nd_uuid_t *host_id, const char *label_key, const char *label_value); + +uint64_t sqlite_get_meta_space(void); +int sql_init_meta_database(db_check_action_type_t rebuild, int memory); + +// UNIT TEST +int metadata_unittest(void); +#endif //NETDATA_SQLITE_METADATA_H |