[Groonga-commit] ranguba/rroonga at d3bc106 [master] Support grn_get_lock_timeout() and grn_set_lock_timeout()

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Thu Jan 30 00:26:56 JST 2014


Kouhei Sutou	2014-01-30 00:26:56 +0900 (Thu, 30 Jan 2014)

  New Revision: d3bc10621df510546c02ce9f5f75ce2404c7619d
  https://github.com/ranguba/rroonga/commit/d3bc10621df510546c02ce9f5f75ce2404c7619d

  Message:
    Support grn_get_lock_timeout() and grn_set_lock_timeout()
    
    This change requires Groonga 3.1.2.

  Added files:
    test/test-lock-timeout.rb
  Modified files:
    ext/groonga/rb-groonga.c
    rroonga-build.rb

  Modified: ext/groonga/rb-groonga.c (+42 -0)
===================================================================
--- ext/groonga/rb-groonga.c    2014-01-29 23:56:19 +0900 (87ef78e)
+++ ext/groonga/rb-groonga.c    2014-01-30 00:26:56 +0900 (6deabc5)
@@ -107,6 +107,47 @@ rb_grn_init_version (VALUE mGrn)
     rb_define_const(mGrn, "BINDINGS_VERSION", bindings_version);
 }
 
+/*
+ * Returns the current lock timeout.
+ *
+ * See
+ * http://groonga.org/docs/reference/api/global_configurations.html
+ * about lock timeout.
+ *
+ * @overload lock_timeout
+ *    @return [Integer] The current lock timeout.
+ */
+static VALUE
+rb_grn_s_get_lock_timeout (VALUE klass)
+{
+    return INT2NUM(grn_get_lock_timeout());
+}
+
+/*
+ * Sets the current lock timeout.
+ *
+ * @overload lock_timeout=(timeout)
+ *    @param [Integer] timeout The new lock timeout.
+ *
+ * @see {#lock_timeout}
+ * @since 3.1.2
+ */
+static VALUE
+rb_grn_s_set_lock_timeout (VALUE klass, VALUE timeout)
+{
+    grn_set_lock_timeout(NUM2INT(timeout));
+    return Qnil;
+}
+
+static void
+rb_grn_init_lock_timeout (VALUE mGrn)
+{
+    rb_define_singleton_method(mGrn, "lock_timeout",
+                               rb_grn_s_get_lock_timeout, 0);
+    rb_define_singleton_method(mGrn, "lock_timeout=",
+                               rb_grn_s_set_lock_timeout, 1);
+}
+
 void
 Init_groonga (void)
 {
@@ -120,6 +161,7 @@ Init_groonga (void)
     rb_set_end_proc(finish_groonga, Qnil);
 
     rb_grn_init_version(mGrn);
+    rb_grn_init_lock_timeout(mGrn);
 
     rb_grn_init_utils(mGrn);
     rb_grn_init_encoding(mGrn);

  Modified: rroonga-build.rb (+5 -5)
===================================================================
--- rroonga-build.rb    2014-01-29 23:56:19 +0900 (c7fe729)
+++ rroonga-build.rb    2014-01-30 00:26:56 +0900 (cab4285)
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 #
-# Copyright (C) 2009-2013  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2009-2014  Kouhei Sutou <kou �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -18,16 +18,16 @@
 module RroongaBuild
   module RequiredGroongaVersion
     MAJOR = 3
-    MINOR = 0
-    MICRO = 8
+    MINOR = 1
+    MICRO = 2
     VERSION = [MAJOR, MINOR, MICRO]
-    RELEASED_DATE = Time.utc(2013, 9, 29)
+    RELEASED_DATE = Time.utc(2014, 1, 29)
   end
 
   module LatestGroongaVersion
     MAJOR = 3
     MINOR = 1
-    MICRO = 1
+    MICRO = 2
     VERSION = [MAJOR, MINOR, MICRO]
   end
 

  Added: test/test-lock-timeout.rb (+29 -0) 100644
===================================================================
--- /dev/null
+++ test/test-lock-timeout.rb    2014-01-30 00:26:56 +0900 (661818e)
@@ -0,0 +1,29 @@
+# Copyright (C) 2014  Kouhei Sutou <kou �� clear-code.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+class LockTimeoutTest < Test::Unit::TestCase
+  def setup
+    @original_lock_timeout = Groonga.lock_timeout
+  end
+
+  def teardown
+    Groonga.lock_timeout = @original_lock_timeout
+  end
+
+  def test_accessor
+    Groonga.lock_timeout = 10
+    assert_equal(10, Groonga.lock_timeout)
+  end
+end
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る