kdb.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /** @file kdb.h
  2. *
  3. * @brief Klish db
  4. */
  5. #ifndef _klish_kdb_h
  6. #define _klish_kdb_h
  7. #include <stdint.h>
  8. // Current API version
  9. #define KDB_MAJOR 1
  10. #define KDB_MINOR 0
  11. // Shared object filename template. Insert db ID or db "name" field
  12. // instead "%s". Consider db ID as an "internal native name". The "name"
  13. // field can differ from ID and it's just used within scheme to refer db.
  14. // Consider it as alias of ID.
  15. #define KDB_SONAME_FMT "kdb_%s.so"
  16. // db's API version symbols
  17. #define KDB_MAJOR_FMT "kdb_%s_major"
  18. #define KDB_MINOR_FMT "kdb_%s_minor"
  19. // db's init and fini functions
  20. #define KDB_INIT_FMT "kdb_%s_init"
  21. #define KDB_FINI_FMT "kdb_%s_fini"
  22. // db's load and deploy functions
  23. #define KDB_LOAD_FMT "kdb_%s_load_scheme"
  24. #define KDB_DEPLOY_FMT "kdb_%s_deploy_scheme"
  25. typedef struct kdb_s kdb_t;
  26. typedef bool_t (*kdb_init_fn)(void **p_udata);
  27. typedef bool_t (*kdb_fini_fn)(void *udata);
  28. typedef kscheme_t *(*kdb_load_fn)(void *udata, const char *opts);
  29. typedef bool_t (*kdb_deploy_fn)(const kscheme_t *scheme, void *udata,
  30. const char *opts);
  31. C_DECL_BEGIN
  32. kdb_t *kdb_new(const char *name, const char *sofile);
  33. void kdb_free(kdb_t *db);
  34. const char *kdb_name(const kdb_t *db);
  35. const char *kdb_sofile(const kdb_t *db);
  36. C_DECL_END
  37. #endif // _klish_kdb_h