index 5558e77154f32f00e9d59edf75ea3d1f0a014119..ab11a21776a193a460da5e3a8e100b4d1f25cff7 100644 (file)
--- a/src/include/core/store.h
+++ b/src/include/core/store.h
int
sdb_store_host(const char *name, sdb_time_t last_update);
+/*
+ * sdb_store_has_host:
+ * sdb_store_get_host:
+ * Query the store for a host by its (canonicalized) name.
+ *
+ * sdb_store_get_host increments the ref count of the host object. The caller
+ * needs to deref it when no longer using it.
+ */
_Bool
sdb_store_has_host(const char *name);
+sdb_store_base_t *
+sdb_store_get_host(const char *name);
+
/*
* sdb_store_attribute:
* Add/update a host's attribute in the store. If the attribute, identified by
sdb_store_service(const char *hostname, const char *name,
sdb_time_t last_update);
+/*
+ * Flags for serialization functions.
+ *
+ * By default, the full object will be included in the serialized output. When
+ * specifying any of the flags, the respective information will be left out.
+ */
+enum {
+ SDB_SKIP_ATTRIBUTES = 1 << 0,
+ SDB_SKIP_SERVICES = 1 << 1,
+ SDB_SKIP_SERVICE_ATTRIBUTES = 1 << 2,
+};
+
/*
* sdb_store_tojson:
* Serialize the entire store to JSON and append the result to the specified
* - a negative value on error
*/
int
-sdb_store_tojson(sdb_strbuf_t *buf);
+sdb_store_tojson(sdb_strbuf_t *buf, int flags);
+
+/*
+ * sdb_store_host_tojson:
+ * Serialize a host object to JSON and append the result to the specified
+ * buffer.
+ *
+ * Returns:
+ * - 0 on success
+ * - a negative value on error
+ */
+int
+sdb_store_host_tojson(sdb_store_base_t *host, sdb_strbuf_t *buf, int flags);
#ifdef __cplusplus
} /* extern "C" */