Code

store: Renamed sdb_store_get_host() to sdb_store_has_host().
[sysdb.git] / src / include / core / store.h
index b17fb21f78af78fa71a9b5173338567a9ad5626c..aac884a5d104a72cd747c3db83ffa0f8b478a5c7 100644 (file)
@@ -44,7 +44,7 @@ extern const sdb_type_t sdb_attribute_type;
 extern const sdb_type_t sdb_service_type;
 
 typedef struct {
-       sdb_object_t parent;
+       sdb_object_t super;
        sdb_time_t last_update;
 } sdb_store_obj_t;
 #define SDB_STORE_OBJ_INIT(t) { SDB_OBJECT_TYPED_INIT(t), 0 }
@@ -52,7 +52,7 @@ typedef struct {
 #define SDB_CONST_STORE_OBJ(obj) ((const sdb_store_obj_t *)(obj))
 
 typedef struct {
-       sdb_store_obj_t parent;
+       sdb_store_obj_t super;
 
        char *hostname;
 } sdb_service_t;
@@ -61,7 +61,7 @@ typedef struct {
 #define SDB_CONST_SVC(obj) ((const sdb_service_t *)(obj))
 
 typedef struct {
-       sdb_store_obj_t parent;
+       sdb_store_obj_t super;
 
        char *attr_value;
        char *hostname;
@@ -71,7 +71,7 @@ typedef struct {
 #define SDB_CONST_ATTR(obj) ((const sdb_attribute_t *)(obj))
 
 typedef struct {
-       sdb_store_obj_t parent;
+       sdb_store_obj_t super;
 
        sdb_llist_t *attributes;
        sdb_llist_t *services;
@@ -82,18 +82,15 @@ typedef struct {
 
 /* shortcuts for accessing the sdb_store_obj_t attributes of inheriting
  * objects */
-#define _last_update parent.last_update
-
-sdb_host_t *
-sdb_host_create(const char *name);
+#define _last_update super.last_update
 
 /*
  * 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
@@ -102,10 +99,10 @@ sdb_host_create(const char *name);
  *  - 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);
+_Bool
+sdb_store_has_host(const char *name);
 
 sdb_attribute_t *
 sdb_attribute_create(const char *hostname,