diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-06-09 04:52:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-06-09 04:52:39 +0000 |
commit | 89f3604407aff8f4cb2ed958252c61e23c767e24 (patch) | |
tree | 7fbf408102cab051557d38193524d8c6e991d070 /database/rrd.c | |
parent | Adding upstream version 1.34.1. (diff) | |
download | netdata-89f3604407aff8f4cb2ed958252c61e23c767e24.tar.xz netdata-89f3604407aff8f4cb2ed958252c61e23c767e24.zip |
Adding upstream version 1.35.0.upstream/1.35.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'database/rrd.c')
-rw-r--r-- | database/rrd.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/database/rrd.c b/database/rrd.c index 321d3561..f91039ea 100644 --- a/database/rrd.c +++ b/database/rrd.c @@ -2,6 +2,7 @@ #define NETDATA_RRD_INTERNALS 1 #include "rrd.h" +#include "storage_engine.h" // ---------------------------------------------------------------------------- // globals @@ -47,24 +48,19 @@ inline const char *rrd_memory_mode_name(RRD_MEMORY_MODE id) { return RRD_MEMORY_MODE_DBENGINE_NAME; } + STORAGE_ENGINE* eng = storage_engine_get(id); + if (eng) { + return eng->name; + } + return RRD_MEMORY_MODE_SAVE_NAME; } RRD_MEMORY_MODE rrd_memory_mode_id(const char *name) { - if(unlikely(!strcmp(name, RRD_MEMORY_MODE_RAM_NAME))) - return RRD_MEMORY_MODE_RAM; - - else if(unlikely(!strcmp(name, RRD_MEMORY_MODE_MAP_NAME))) - return RRD_MEMORY_MODE_MAP; - - else if(unlikely(!strcmp(name, RRD_MEMORY_MODE_NONE_NAME))) - return RRD_MEMORY_MODE_NONE; - - else if(unlikely(!strcmp(name, RRD_MEMORY_MODE_ALLOC_NAME))) - return RRD_MEMORY_MODE_ALLOC; - - else if(unlikely(!strcmp(name, RRD_MEMORY_MODE_DBENGINE_NAME))) - return RRD_MEMORY_MODE_DBENGINE; + STORAGE_ENGINE* eng = storage_engine_find(name); + if (eng) { + return eng->id; + } return RRD_MEMORY_MODE_SAVE; } @@ -139,8 +135,7 @@ const char *rrdset_type_name(RRDSET_TYPE chart_type) { // ---------------------------------------------------------------------------- // RRD - cache directory -char *rrdset_cache_dir(RRDHOST *host, const char *id, const char *config_section) { - UNUSED(config_section); +char *rrdset_cache_dir(RRDHOST *host, const char *id) { char *ret = NULL; char b[FILENAME_MAX + 1]; |