summaryrefslogtreecommitdiffstats
path: root/database/rrd.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--database/rrd.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/database/rrd.c b/database/rrd.c
index 321d35615..f91039ea5 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];