aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings/ruby
diff options
context:
space:
mode:
authorGravatar Ali Polatel <alip@exherbo.org>2011-09-24 15:43:43 +0300
committerGravatar Ali Polatel <alip@exherbo.org>2011-09-24 15:43:43 +0300
commitbbb41081d797c3301e4d202e30c4111207fe7693 (patch)
tree6d88945dbc9c1ecc5746200fbdfb872d01a9e1bb /bindings/ruby
parenta08aa32b44b28f50f00cbd69e1a39023158f1847 (diff)
ruby: Wrap notmuch_database_{begin,end}_atomic
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()
Diffstat (limited to 'bindings/ruby')
-rw-r--r--bindings/ruby/database.c40
-rw-r--r--bindings/ruby/defs.h6
-rw-r--r--bindings/ruby/init.c2
3 files changed, 47 insertions, 1 deletions
diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index f4edd773..a4659ca3 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -1,6 +1,6 @@
/* 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
@@ -205,6 +205,44 @@ notmuch_rb_database_upgrade(VALUE self)
}
/*
+ * 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
*
* Retrieve a directory object from the database for 'path'
diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index f00afeff..a0303169 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -151,6 +151,12 @@ 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
diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
index f5376fda..a516ab98 100644
--- a/bindings/ruby/init.c
+++ b/bindings/ruby/init.c
@@ -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, "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 */