[PATCH 2/5] lib/config: add NOTMUCH_CONFIG_AUTOCOMMIT

Subject: [PATCH 2/5] lib/config: add NOTMUCH_CONFIG_AUTOCOMMIT

Date: Fri, 21 May 2021 22:20:37 -0300

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


This will be used to control how often atomic transactions are
committed.
---
 lib/config.cc            | 4 ++++
 lib/notmuch.h            | 1 +
 test/T030-config.sh      | 1 +
 test/T055-path-config.sh | 1 +
 test/T590-libconfig.sh   | 4 ++++
 5 files changed, 11 insertions(+)

diff --git a/lib/config.cc b/lib/config.cc
index 0ec66372..13eab5f1 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -593,6 +593,8 @@ _notmuch_config_key_to_string (notmuch_config_key_t key)
 	return "user.other_email";
     case NOTMUCH_CONFIG_USER_NAME:
 	return "user.name";
+    case NOTMUCH_CONFIG_AUTOCOMMIT:
+	return "database.autocommit";
     default:
 	return NULL;
     }
@@ -638,6 +640,8 @@ _notmuch_config_default (notmuch_database_t *notmuch, notmuch_config_key_t key)
 	return email;
     case NOTMUCH_CONFIG_NEW_IGNORE:
 	return "";
+    case NOTMUCH_CONFIG_AUTOCOMMIT:
+	return "8000";
     case NOTMUCH_CONFIG_HOOK_DIR:
     case NOTMUCH_CONFIG_BACKUP_DIR:
     case NOTMUCH_CONFIG_OTHER_EMAIL:
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 4b053932..5c3be342 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -2520,6 +2520,7 @@ typedef enum _notmuch_config_key {
     NOTMUCH_CONFIG_PRIMARY_EMAIL,
     NOTMUCH_CONFIG_OTHER_EMAIL,
     NOTMUCH_CONFIG_USER_NAME,
+    NOTMUCH_CONFIG_AUTOCOMMIT,
     NOTMUCH_CONFIG_LAST
 } notmuch_config_key_t;
 
diff --git a/test/T030-config.sh b/test/T030-config.sh
index 7a1660e9..751feaf3 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -51,6 +51,7 @@ cat <<EOF > EXPECTED
 built_with.compact=something
 built_with.field_processor=something
 built_with.retry_lock=something
+database.autocommit=8000
 database.mail_root=MAIL_DIR
 database.path=MAIL_DIR
 foo.list=this;is another;list value;
diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
index 8ef76aed..bb3bf665 100755
--- a/test/T055-path-config.sh
+++ b/test/T055-path-config.sh
@@ -259,6 +259,7 @@ EOF
 built_with.compact=true
 built_with.field_processor=true
 built_with.retry_lock=true
+database.autocommit=8000
 database.backup_dir
 database.hook_dir
 database.mail_root=MAIL_DIR
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 745e1bb4..d922c3af 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -400,6 +400,7 @@ true
 USERNAME@FQDN
 NULL
 USER_FULL_NAME
+8000
 == stderr ==
 EOF
 unset MAILDIR
@@ -711,6 +712,7 @@ true
 test_suite@notmuchmail.org
 test_suite_other@notmuchmail.org;test_suite@otherdomain.org
 Notmuch Test Suite
+8000
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT
@@ -742,6 +744,7 @@ true
 USERNAME@FQDN
 NULL
 USER_FULL_NAME
+8000
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT.clean
@@ -808,6 +811,7 @@ EOF
 cat <<'EOF' >EXPECTED
 == stdout ==
 aaabefore beforeval
+database.autocommit 8000
 database.backup_dir MAIL_DIR/.notmuch/backups
 database.hook_dir MAIL_DIR/.notmuch/hooks
 database.mail_root MAIL_DIR
-- 
2.30.2
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: