|
@@ -41,6 +41,17 @@ check_backend (LSUP_StoreType be)
|
|
#undef ENTRY
|
|
#undef ENTRY
|
|
|
|
|
|
|
|
|
|
|
|
+#define ENTRY(a, b) case LSUP_STORE_##a: return &b;
|
|
|
|
+static inline const LSUP_StoreInt *
|
|
|
|
+select_interface (LSUP_StoreType be) {
|
|
|
|
+ switch (be) {
|
|
|
|
+ BACKEND_TBL
|
|
|
|
+ default: return NULL;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+#undef ENTRY
|
|
|
|
+
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Graph API.
|
|
* Graph API.
|
|
*/
|
|
*/
|
|
@@ -55,7 +66,8 @@ LSUP_graph_new (
|
|
"Environment is not initialized. Did you call LSUP_init()?");
|
|
"Environment is not initialized. Did you call LSUP_init()?");
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
- if (UNLIKELY (!check_backend (store_type))) {
|
|
|
|
|
|
+ const LSUP_StoreInt *sif = select_interface (store_type);
|
|
|
|
+ if (UNLIKELY (!sif)) {
|
|
log_error ("Not a valid store type: %d", store_type);
|
|
log_error ("Not a valid store type: %d", store_type);
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
@@ -67,6 +79,7 @@ LSUP_graph_new (
|
|
MALLOC_GUARD (gr->store, NULL);
|
|
MALLOC_GUARD (gr->store, NULL);
|
|
|
|
|
|
gr->store->type = store_type;
|
|
gr->store->type = store_type;
|
|
|
|
+ gr->store->sif = sif;
|
|
gr->store->id = store_id ? strdup (store_id) : NULL;
|
|
gr->store->id = store_id ? strdup (store_id) : NULL;
|
|
// TODO implement custom default context.
|
|
// TODO implement custom default context.
|
|
gr->store->data = gr->store->sif->new_fn (store_id, size);
|
|
gr->store->data = gr->store->sif->new_fn (store_id, size);
|