summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fcc75b2)
raw | patch | inline | side by side (parent: fcc75b2)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 20 May 2015 08:34:27 +0000 (10:34 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 20 May 2015 08:34:27 +0000 (10:34 +0200) |
This is a boolean field that specifies whether a timeseries for the metric is
known to SysDB.
known to SysDB.
src/core/store.c | patch | blob | history | |
src/core/store_expr.c | patch | blob | history | |
src/include/core/store.h | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index eb58ad83b1ba2cd36b5fba803e42313758ea3d38..bf12a9378eb228e811a87ea268eb8fa403991672 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
if (! res)
return 0;
return sdb_data_copy(res, &ATTR(obj)->value);
+ case SDB_FIELD_TIMESERIES:
+ if (obj->type != SDB_METRIC)
+ return -1;
+ tmp.type = SDB_TYPE_BOOLEAN;
+ tmp.data.boolean = METRIC(obj)->store.type != NULL;
default:
return -1;
}
diff --git a/src/core/store_expr.c b/src/core/store_expr.c
index 6e39305a89ecd18718ad7984a4e7cc85f407728d..80c1f4ac25c756383d579a1a92042045f5df6cec 100644 (file)
--- a/src/core/store_expr.c
+++ b/src/core/store_expr.c
sdb_data_t value = { SDB_TYPE_INTEGER, { .integer = field } };
sdb_store_expr_t *e;
- if ((field < SDB_FIELD_NAME) || (SDB_FIELD_VALUE < field))
+ if ((field < SDB_FIELD_NAME) || (SDB_FIELD_TIMESERIES < field))
return NULL;
e = SDB_STORE_EXPR(sdb_object_create("store-fieldvalue", expr_type,
FIELD_VALUE, NULL, NULL, &value));
index c051252f771616ad3df65eba06fbf9fe1bd3f447..c52299e806314a951df6fbb670e7b098f7e371cd 100644 (file)
--- a/src/include/core/store.h
+++ b/src/include/core/store.h
SDB_FIELD_INTERVAL, /* type: datetime */
SDB_FIELD_BACKEND, /* type: array of strings */
SDB_FIELD_VALUE, /* attributes only; type: type of the value */
+ SDB_FIELD_TIMESERIES, /* metrics only; type: boolean */
};
#define SDB_STORE_TYPE_TO_NAME(t) \
(((t) == SDB_HOST) ? "host" \
: ((f) == SDB_FIELD_INTERVAL) ? "interval" \
: ((f) == SDB_FIELD_BACKEND) ? "backend" \
: ((f) == SDB_FIELD_VALUE) ? "value" \
+ : ((f) == SDB_FIELD_TIMESERIES) ? "timeseries" \
: "unknown")
#define SDB_FIELD_TYPE(f) \
: ((f) == SDB_FIELD_INTERVAL) ? SDB_TYPE_DATETIME \
: ((f) == SDB_FIELD_BACKEND) ? (SDB_TYPE_ARRAY | SDB_TYPE_STRING) \
: ((f) == SDB_FIELD_VALUE) ? -1 /* unknown */ \
+ : ((f) == SDB_FIELD_TIMESERIES) ? SDB_TYPE_BOOLEAN \
: -1)
/*
* the returned value. If 'res' is NULL, the function will return whether the
* field exists.
*
- * Note: Retrieving the backend this way is not currently supported.
- *
* Returns:
* - 0 on success
* - a negative value else