X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Finclude%2Fcore%2Fstore.h;h=30ad0ab386b81517128c47fbe0995d8dcf030c86;hp=a8208bf7d9a0a849e16c6316616af092e4b1e9b5;hb=f05f6dfc4e48309c916c0dcb158df66c80de6c71;hpb=ea309d986a6c7a30eb7995d6ad9549a1e62c5a2f diff --git a/src/include/core/store.h b/src/include/core/store.h index a8208bf..30ad0ab 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -94,6 +94,14 @@ enum { struct sdb_store_obj; typedef struct sdb_store_obj sdb_store_obj_t; +/* + * A metric store describes how to access a metric's data. + */ +typedef struct { + const char *type; + const char *id; +} sdb_metric_store_t; + /* * Expressions represent arithmetic expressions based on stored objects and * their various attributes. @@ -125,6 +133,28 @@ typedef struct sdb_store_matcher sdb_store_matcher_t; struct sdb_store_json_formatter; typedef struct sdb_store_json_formatter sdb_store_json_formatter_t; +/* + * A store writer describes the interface for plugins implementing a store. + */ +typedef struct { + int (*store_host)(const char *name, sdb_time_t last_update, + sdb_object_t *user_data); + int (*store_service)(const char *hostname, const char *name, + sdb_time_t last_update, sdb_object_t *user_data); + int (*store_metric)(const char *hostname, const char *name, + sdb_metric_store_t *store, sdb_time_t last_update, + sdb_object_t *user_data); + int (*store_attribute)(const char *hostname, + const char *key, const sdb_data_t *value, sdb_time_t last_update, + sdb_object_t *user_data); + int (*store_service_attr)(const char *hostname, const char *service, + const char *key, const sdb_data_t *value, sdb_time_t last_update, + sdb_object_t *user_data); + int (*store_metric_attr)(const char *hostname, const char *metric, + const char *key, const sdb_data_t *value, sdb_time_t last_update, + sdb_object_t *user_data); +} sdb_store_writer_t; + /* * sdb_store_clear: * Clear the entire store and remove all stored objects. @@ -220,14 +250,6 @@ int sdb_store_service_attr(const char *hostname, const char *service, const char *key, const sdb_data_t *value, sdb_time_t last_update); -/* - * A metric store describes how to access a metric's data. - */ -typedef struct { - const char *type; - const char *id; -} sdb_metric_store_t; - /* * sdb_store_metric: * Add/update a metric in the store. If the metric, identified by its name,