Code

store: Let sdb_store_service() accept const arguments.
[sysdb.git] / src / include / core / store.h
index 22b13157cfb72772501206c698aae949ce00c4c1..af8e23cff6a390ce74a9f354b8f38a672b70d5e1 100644 (file)
@@ -86,11 +86,11 @@ typedef struct {
 
 /*
  * sdb_store_host:
- * Add/update a host in the store. If the host, identified by its name,
- * already exists, it will be updated according to the specified 'host'
- * object. Else, a new entry will be created in the store. Any memory required
- * for storing the entry will be allocated an managed by the store itself. The
- * specified host-object will not be referenced or further accessed.
+ * Add/update a host in the store. If the host, identified by its
+ * canonicalized name, already exists, it will be updated according to the
+ * specified name and timestamp. Else, a new entry will be created in the
+ * store. Any memory required for storing the entry will be allocated an
+ * managed by the store itself.
  *
  * Returns:
  *  - 0 on success
@@ -99,24 +99,19 @@ typedef struct {
  *  - a negative value on error
  */
 int
-sdb_store_host(const sdb_host_t *host);
+sdb_store_host(const char *name, sdb_time_t last_update);
 
-const sdb_host_t *
-sdb_store_get_host(const char *name);
-
-sdb_attribute_t *
-sdb_attribute_create(const char *hostname,
-               const char *name, const char *value);
+_Bool
+sdb_store_has_host(const char *name);
 
 /*
  * sdb_store_attribute:
  * Add/update a host's attribute in the store. If the attribute, identified by
- * its name, already exists for the specified host, it will be updated
- * according to the specified 'attr' object. If the referenced host does not
- * exist, an error will be reported. Else, a new entry will be created in the
- * store. Any memory required for storing the entry will be allocated and
- * managed by the store itself. The specified attribute-object will not be
- * referenced or further accessed.
+ * its key, already exists for the specified host, it will be updated to the
+ * specified values. If the referenced host does not exist, an error will be
+ * reported. Else, a new entry will be created in the store. Any memory
+ * required for storing the entry will be allocated and managed by the store
+ * itself.
  *
  * Returns:
  *  - 0 on success
@@ -125,10 +120,8 @@ sdb_attribute_create(const char *hostname,
  *  - a negative value on error
  */
 int
-sdb_store_attribute(const sdb_attribute_t *attr);
-
-sdb_service_t *
-sdb_service_create(const char *hostname, const char *name);
+sdb_store_attribute(const char *hostname, const char *key, const char *value,
+               sdb_time_t last_update);
 
 /*
  * sdb_store_service:
@@ -147,10 +140,8 @@ sdb_service_create(const char *hostname, const char *name);
  *  - a negative value on error
  */
 int
-sdb_store_service(const sdb_service_t *svc);
-
-const sdb_service_t *
-sdb_store_get_service(const sdb_host_t *host, const char *name);
+sdb_store_service(const char *hostname, const char *name,
+               sdb_time_t last_update);
 
 int
 sdb_store_dump(FILE *fh);