-bool starttrans()
-{
- struct dynamic_backend *backend;
- backend = get_backend();
-
- if (!backend_loaded()) {
- load_backend();
- }
-
- if (backend->loaded) {
- if (backend->starttrans != NULL) {
- return backend->starttrans();
- }
- }
-
- return false;
-}
-
-void endtrans()
-{
- struct dynamic_backend *backend;
- backend = get_backend();
-
- if (!backend_loaded()) {
- load_backend();
- }
-
- if (backend->loaded) {
- if (backend->endtrans != NULL) {
- backend->endtrans();
- }
- }
-}
-
-int fetch_key(uint64_t keyid, struct openpgp_publickey **publickey,
- bool intrans)
-{
- struct dynamic_backend *backend;
- backend = get_backend();
-
- if (!backend_loaded()) {
- load_backend();
- }
-
- if (backend->loaded) {
- if (backend->fetch_key != NULL) {
- return backend->fetch_key(keyid,publickey,intrans);
- }
- }
-
- return -1;
-}
-
-int store_key(struct openpgp_publickey *publickey, bool intrans, bool update)
-{
- struct dynamic_backend *backend;
- backend = get_backend();
-
- if (!backend_loaded()) {
- load_backend();
- }
-
- if (backend->loaded) {
- if (backend->store_key != NULL) {
- return backend->store_key(publickey,intrans,update);
- }
- }
-
- return -1;
-}
-
-int delete_key(uint64_t keyid, bool intrans)
-{
- struct dynamic_backend *backend;
- backend = get_backend();
-
- if (!backend_loaded()) {
- load_backend();
- }
-
- if (backend->loaded) {
- if (backend->delete_key != NULL) {
- return backend->delete_key(keyid, intrans);
- }
- }
-
- return -1;
-}
-
-int fetch_key_text(const char *search, struct openpgp_publickey **publickey)
-{
- struct dynamic_backend *backend;
- backend = get_backend();
-
- if (!backend_loaded()) {
- load_backend();
- }
-
- if (backend->loaded) {
- if (backend->fetch_key_text != NULL) {
- return backend->fetch_key_text(search, publickey);
- }
- }
-
- return -1;
-}
-
-int iterate_keys(void (*iterfunc)(void *ctx, struct openpgp_publickey *key),
- void *ctx)
-{
- struct dynamic_backend *backend;
- backend = get_backend();
-
- if (!backend_loaded()) {
- load_backend();
- }
-
- if (backend->loaded) {
- if (backend->iterate_keys != NULL) {
- return backend->iterate_keys(iterfunc, ctx);
- }
- }
-
- return -1;
-}
+struct dbfuncs keydb_dynamic_funcs = {
+ .initdb = dynamic_initdb,
+ .cleanupdb = dynamic_cleanupdb,
+ .starttrans = dynamic_starttrans,
+ .endtrans = dynamic_endtrans,
+ .fetch_key = dynamic_fetch_key,
+ .fetch_key_text = dynamic_fetch_key_text,
+ .store_key = dynamic_store_key,
+ .update_keys = dynamic_update_keys,
+ .delete_key = dynamic_delete_key,
+ .getkeysigs = dynamic_getkeysigs,
+ .cached_getkeysigs = dynamic_cached_getkeysigs,
+ .keyid2uid = dynamic_keyid2uid,
+ .getfullkeyid = dynamic_getfullkeyid,
+ .iterate_keys = dynamic_iterate_keys,
+};