From: Sebastian Harl Date: Thu, 6 Aug 2015 15:39:45 +0000 (+0200) Subject: store: Add wrapper functions to store an object in an arbitrary store. X-Git-Tag: sysdb-0.8.0~53 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=11824e1af21c11b8f5a99a1247debed4990f0c7d;p=sysdb.git store: Add wrapper functions to store an object in an arbitrary store. --- diff --git a/src/core/store.c b/src/core/store.c index ccb3538..0ab57d9 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -892,6 +892,51 @@ sdb_store_clear(void) sdb_avltree_clear(global_store->hosts); } /* sdb_store_clear */ +int +sdb_store_host(sdb_store_t *store, const char *name, sdb_time_t last_update) +{ + return store_host(name, last_update, SDB_OBJ(store)); +} /* sdb_store_host */ + +int +sdb_store_service(sdb_store_t *store, const char *hostname, const char *name, + sdb_time_t last_update) +{ + return store_service(hostname, name, last_update, SDB_OBJ(store)); +} /* sdb_store_service */ + +int +sdb_store_metric(sdb_store_t *store, const char *hostname, const char *name, + sdb_metric_store_t *metric_store, sdb_time_t last_update) +{ + return store_metric(hostname, name, metric_store, last_update, SDB_OBJ(store)); +} /* sdb_store_metric */ + +int +sdb_store_attribute(sdb_store_t *store, const char *hostname, + const char *key, const sdb_data_t *value, sdb_time_t last_update) +{ + return store_attribute(hostname, key, value, last_update, SDB_OBJ(store)); +} /* sdb_store_attribute */ + +int +sdb_store_service_attr(sdb_store_t *store, const char *hostname, + const char *service, const char *key, const sdb_data_t *value, + sdb_time_t last_update) +{ + return store_service_attr(hostname, service, key, value, + last_update, SDB_OBJ(store)); +} /* sdb_store_service_attr */ + +int +sdb_store_metric_attr(sdb_store_t *store, const char *hostname, + const char *metric, const char *key, const sdb_data_t *value, + sdb_time_t last_update) +{ + return store_metric_attr(hostname, metric, key, value, + last_update, SDB_OBJ(store)); +} /* sdb_store_metric_attr */ + sdb_store_obj_t * sdb_store_get_host(const char *name) { diff --git a/src/include/core/store.h b/src/include/core/store.h index e5e0118..1cb0e5a 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -303,6 +303,31 @@ sdb_store_init(void); void sdb_store_clear(void); +/* + * sdb_store_host, sdb_store_service, sdb_store_metric, sdb_store_attribute, + * sdb_store_metric_attr: + * Store an object in the specified store. + */ +int +sdb_store_host(sdb_store_t *store, const char *name, sdb_time_t last_update); +int +sdb_store_service(sdb_store_t *store, const char *hostname, const char *name, + sdb_time_t last_update); +int +sdb_store_metric(sdb_store_t *store, const char *hostname, const char *name, + sdb_metric_store_t *metric_store, sdb_time_t last_update); +int +sdb_store_attribute(sdb_store_t *store, const char *hostname, + const char *key, const sdb_data_t *value, sdb_time_t last_update); +int +sdb_store_service_attr(sdb_store_t *store, const char *hostname, + const char *service, const char *key, const sdb_data_t *value, + sdb_time_t last_update); +int +sdb_store_metric_attr(sdb_store_t *store, const char *hostname, + const char *metric, const char *key, const sdb_data_t *value, + sdb_time_t last_update); + /* * sdb_store_get_host: * Query the store for a host by its (canonicalized) name.