dlite-store#
An in-memory store for instances.
Typedefs
-
typedef struct _DLiteStore DLiteStore#
Store type.
Functions
-
DLiteStore *dlite_store_create()#
Returns a new store.
-
void dlite_store_free(DLiteStore *store)#
Frees a store.
-
DLiteStore *dlite_store_load(DLiteStorage *s)#
Returns a new store populated with all instances in storage
s
.
-
int dlite_store_save(DLiteStorage *s, DLiteStore *store)#
Saves store to storage. Returns non-zero on error.
-
int dlite_store_add(DLiteStore *store, DLiteInstance *inst)#
Adds instance to store. The ownership is retained with the caller. Returns non-zero on error.
-
int dlite_store_add_new(DLiteStore *store, DLiteInstance *inst)#
Adds instance to store, giving away the ownership to the store. Hence, the instance will be free’ed when the store is free’ed. Returns non-zero on error.
-
DLiteInstance *dlite_store_pop(DLiteStore *store, const char *id)#
Removes instance with given id from store and return it. Returns NULL on error.
-
DLiteInstance *dlite_store_pop_all(DLiteStore *store, const char *id)#
Like dlite_store_pop(), but removes all occurences of the instance in
store
. Returns NULL on error.
-
int dlite_store_remove(DLiteStore *store, const char *id)#
Removes instance with given id from store. Returns non-zero on error.
-
DLiteInstance *dlite_store_get(const DLiteStore *store, const char *id)#
Returns a borrowed pointer to instance, or NULL if
id
is not in the store.
-
DLiteStoreIter dlite_store_iter(const DLiteStore *store)#
Returns an initiated iterator for use with dlite_store_next().
-
const char *dlite_store_next(const DLiteStore *store, DLiteStoreIter *iter)#
Returns the next uuid in
store
using iteratoriter
returned by dlite_store_iter(). Returns NULL when there are no more uuid’s.Example:
const char *uuid; DLiteStore *store = dlite_store_load(storage); DLiteStoreIter iter = dlite_store_iter(store); while ((uuid = dlite_store_next(store, &iter))) { printf("uuid=%s\n", uuid); }
-
struct DLiteStoreIter#
- #include <dlite-store.h>
Iteraror type returned by dlite_store_iter().
Public Members
-
map_iter_t iter#
-
map_iter_t iter#