]> git.notmuchmail.org Git - notmuch/commitdiff
ruby: Wrap notmuch_database_{begin,end}_atomic
authorAli Polatel <alip@exherbo.org>
Sat, 24 Sep 2011 12:43:43 +0000 (15:43 +0300)
committerAli Polatel <alip@exherbo.org>
Sat, 24 Sep 2011 12:43:43 +0000 (15:43 +0300)
Adding ruby wrappers for functions:
- notmuch_database_begin_atomic()
- notmuch_database_end_atomic()
added by 957f1ba3fc1d737887029ff1787fc6bea94de00b

New functions:
Notmuch::Database.begin_atomic()
Notmuch::Database.end_atomic()

bindings/ruby/database.c
bindings/ruby/defs.h
bindings/ruby/init.c

index f4edd77303afb2be7ed64b22d49b789cd43b1472..a4659ca3737a712f77f50fba55cb43ac05cb33c5 100644 (file)
@@ -1,6 +1,6 @@
 /* The Ruby interface to the notmuch mail library
  *
 /* The Ruby interface to the notmuch mail library
  *
- * Copyright © 2010 Ali Polatel
+ * Copyright © 2010, 2011 Ali Polatel
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -204,6 +204,44 @@ notmuch_rb_database_upgrade(VALUE self)
     return Qtrue;
 }
 
     return Qtrue;
 }
 
+/*
+ * call-seq: DB.begin_atomic => nil
+ *
+ * Begin an atomic database operation.
+ */
+VALUE
+notmuch_rb_database_begin_atomic(VALUE self)
+{
+    notmuch_status_t ret;
+    notmuch_database_t *db;
+
+    Data_Get_Notmuch_Database(self, db);
+
+    ret = notmuch_database_begin_atomic(db);
+    notmuch_rb_status_raise(ret);
+
+    return Qtrue;
+}
+
+/*
+ * call-seq: DB.end_atomic => nil
+ *
+ * Indicate the end of an atomic database operation.
+ */
+VALUE
+notmuch_rb_database_end_atomic(VALUE self)
+{
+    notmuch_status_t ret;
+    notmuch_database_t *db;
+
+    Data_Get_Notmuch_Database(self, db);
+
+    ret = notmuch_database_end_atomic(db);
+    notmuch_rb_status_raise(ret);
+
+    return Qtrue;
+}
+
 /*
  * call-seq: DB.get_directory(path) => DIR
  *
 /*
  * call-seq: DB.get_directory(path) => DIR
  *
index f00afeff736dc74be033b3427b54dbcb2dc1c4c5..a03031699b51cb31779dcd3aecae0b2e516fc668 100644 (file)
@@ -150,6 +150,12 @@ notmuch_rb_database_needs_upgrade(VALUE self);
 VALUE
 notmuch_rb_database_upgrade(VALUE self);
 
 VALUE
 notmuch_rb_database_upgrade(VALUE self);
 
+VALUE
+notmuch_rb_database_begin_atomic(VALUE self);
+
+VALUE
+notmuch_rb_database_end_atomic(VALUE self);
+
 VALUE
 notmuch_rb_database_get_directory(VALUE self, VALUE pathv);
 
 VALUE
 notmuch_rb_database_get_directory(VALUE self, VALUE pathv);
 
index f5376fda114558f3c994d1c087c602cbfd4bf604..a516ab9800d6099557660406f2155ee4d95fe8a9 100644 (file)
@@ -181,6 +181,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, "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 */
     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 */