summaryrefslogtreecommitdiffstats
path: root/g10/tofu.h
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@g10code.com>2015-10-23 17:23:17 +0200
committerNeal H. Walfield <neal@g10code.com>2015-10-23 17:38:17 +0200
commit7f65e84ac035e8f7a25639a6b09eb6000115e337 (patch)
tree2986a57b6f447a2657d80b04d4dc8c59a1477b2c /g10/tofu.h
parentgpg: Cache prepared SQL queries and open DB connections. (diff)
downloadgnupg2-7f65e84ac035e8f7a25639a6b09eb6000115e337.tar.xz
gnupg2-7f65e84ac035e8f7a25639a6b09eb6000115e337.zip
gpg: Provide an interface to patch TOFU updates.
* g10/tofu.c (struct db): Rename begin_transaction to savepoint_batch. Rename end_transaction to savepoint_batch_commit. Update users. Remove field rollback. Add fields savepoint_inner and savepoint_inner_commit. Add field batch_update. (dump_cache): New function. (batch_update): New variable. (begin_transaction). New function. (end_transaction): New function. (rollback_transaction): New function. (tofu_begin_batch_update): New function. (tofu_end_batch_update): New function. (closedb): End any pending batch transaction. (closedbs): Assert that none of the DBs have a started batch transaction if we not in batch mode. (record_binding): Use the begin_transaction, end_transaction and rollback_transaction functions instead of including the SQL inline. Also start a batch mode transaction if we are using the flat format. (tofu_register): Use the begin_transaction, end_transaction and rollback_transaction functions instead of including the SQL inline. * g10/gpgv.c (tofu_begin_batch_update): New function. (tofu_end_batch_update): New function. * g10/test-stubs.c (tofu_begin_batch_update): New function. (tofu_end_batch_update): New function. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
Diffstat (limited to 'g10/tofu.h')
-rw-r--r--g10/tofu.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/g10/tofu.h b/g10/tofu.h
index adf87abe6..2d23e86bc 100644
--- a/g10/tofu.h
+++ b/g10/tofu.h
@@ -106,4 +106,10 @@ gpg_error_t tofu_set_policy_by_keyid (u32 *keyid, enum tofu_policy policy);
gpg_error_t tofu_get_policy (PKT_public_key *pk, PKT_user_id *user_id,
enum tofu_policy *policy);
+/* When doing a lot of DB activities (in particular, when listing
+ keys), this causes the DB to enter batch mode, which can
+ significantly speed up operations. */
+void tofu_begin_batch_update (void);
+void tofu_end_batch_update (void);
+
#endif /*G10_TOFU_H*/