]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/ruby/init.c
ruby: New exception Notmuch::UnbalancedAtomicError
[notmuch] / bindings / ruby / init.c
index f5376fda114558f3c994d1c087c602cbfd4bf604..72e1a478cd35b84b2d62cb36f7432db8d6fb8b25 100644 (file)
@@ -166,7 +166,14 @@ Init_notmuch(void)
      */
     notmuch_rb_eUnbalancedFreezeThawError = rb_define_class_under(mod, "UnbalancedFreezeThawError",
             notmuch_rb_eBaseError);
-
+    /*
+     * Document-class: Notmuch::UnbalancedAtomicError
+     *
+     * Raised when notmuch_database_end_atomic has been called more times than
+     * notmuch_database_begin_atomic
+     */
+    notmuch_rb_eUnbalancedAtomicError = rb_define_class_under(mod, "UnbalancedAtomicError",
+            notmuch_rb_eBaseError);
     /*
      * Document-class: Notmuch::Database
      *
@@ -181,6 +188,8 @@ Init_notmuch(void)
     rb_define_method(notmuch_rb_cDatabase, "version", notmuch_rb_database_version, 0); /* in database.c */
     rb_define_method(notmuch_rb_cDatabase, "needs_upgrade?", notmuch_rb_database_needs_upgrade, 0); /* in database.c */
     rb_define_method(notmuch_rb_cDatabase, "upgrade!", notmuch_rb_database_upgrade, 0); /* in database.c */
+    rb_define_method(notmuch_rb_cDatabase, "begin_atomic", notmuch_rb_database_begin_atomic, 0); /* in database.c */
+    rb_define_method(notmuch_rb_cDatabase, "end_atomic", notmuch_rb_database_end_atomic, 0); /* in database.c */
     rb_define_method(notmuch_rb_cDatabase, "get_directory", notmuch_rb_database_get_directory, 1); /* in database.c */
     rb_define_method(notmuch_rb_cDatabase, "add_message", notmuch_rb_database_add_message, 1); /* in database.c */
     rb_define_method(notmuch_rb_cDatabase, "remove_message", notmuch_rb_database_remove_message, 1); /* in database.c */