Browse Source

db: Unfinished kdb.h

Serj Kalichev 3 years ago
parent
commit
84faccd45b
1 changed files with 49 additions and 0 deletions
  1. 49 0
      klish/kdb.h

+ 49 - 0
klish/kdb.h

@@ -0,0 +1,49 @@
+/** @file kdb.h
+ *
+ * @brief Klish db
+ */
+
+#ifndef _klish_kdb_h
+#define _klish_kdb_h
+
+#include <stdint.h>
+
+// Current API version
+#define KDB_MAJOR 1
+#define KDB_MINOR 0
+
+// Shared object filename template. Insert db ID or db "name" field
+// instead "%s". Consider db ID as an "internal native name". The "name"
+// field can differ from ID and it's just used within scheme to refer db.
+// Consider it as alias of ID.
+#define KDB_SONAME_FMT "kdb_%s.so"
+
+// db's API version symbols
+#define KDB_MAJOR_FMT "kdb_%s_major"
+#define KDB_MINOR_FMT "kdb_%s_minor"
+
+// db's init and fini functions
+#define KDB_INIT_FMT "kdb_%s_init"
+#define KDB_FINI_FMT "kdb_%s_fini"
+
+// db's load and deploy functions
+#define KDB_INIT_FMT "kdb_%s_load_scheme"
+#define KDB_FINI_FMT "kdb_%s_deploy_scheme"
+
+
+typedef struct kdb_s kdb_t;
+
+
+C_DECL_BEGIN
+
+kdb_t *kdb_new(const char *name, const char *sofile);
+void kdb_free(kdb_t *db);
+
+const char *kdb_name(const kdb_t *db);
+const char *kdb_sofile(const kdb_t *db);
+const char *kdb_options(const kdb_t *db);
+bool_t kdb_set_options(kdb_t *db, const char *options);
+
+C_DECL_END
+
+#endif // _klish_kdb_h