[Groonga-commit] droonga/droonga-engine at 3a9a366 [master] Move "messages_per_second" from the base class to Dump's private class

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Apr 17 16:58:26 JST 2015


YUKI Hiroshi	2015-04-17 16:58:26 +0900 (Fri, 17 Apr 2015)

  New Revision: 3a9a366843ee1cec8117a12d431d272e067c3339
  https://github.com/droonga/droonga-engine/commit/3a9a366843ee1cec8117a12d431d272e067c3339

  Message:
    Move "messages_per_second" from the base class to Dump's private class

  Modified files:
    lib/droonga/plugin/async_command.rb
    lib/droonga/plugins/dump.rb

  Modified: lib/droonga/plugin/async_command.rb (+5 -11)
===================================================================
--- lib/droonga/plugin/async_command.rb    2015-04-17 16:35:05 +0900 (422935e)
+++ lib/droonga/plugin/async_command.rb    2015-04-17 16:58:26 +0900 (9bc35b6)
@@ -47,17 +47,6 @@ module Droonga
         def request
           @message.request
         end
-
-        DEFAULT_MESSAGES_PER_SECOND = 10000
-
-        def messages_per_seconds
-          request = (@message.request || {})
-          minimum_messages_per_seconds = 10
-          [
-            minimum_messages_per_seconds,
-            (request["messagesPerSecond"] || DEFAULT_MESSAGES_PER_SECOND).to_i,
-          ].max
-        end
       end
 
       class Handler < Droonga::Handler
@@ -76,6 +65,11 @@ module Droonga
         end
 
         private
+        def request_class
+          #XXX override me!
+          Request
+        end
+
         def start(request)
           #XXX override me!
           # handler = MyAsyncHandler.new(loop, messenger, request)

  Modified: lib/droonga/plugins/dump.rb (+17 -0)
===================================================================
--- lib/droonga/plugins/dump.rb    2015-04-17 16:35:05 +0900 (25d1283)
+++ lib/droonga/plugins/dump.rb    2015-04-17 16:58:26 +0900 (3853859)
@@ -36,8 +36,25 @@ module Droonga
       extend Plugin
       register("dump")
 
+      class Request < AsyncCommand::Request
+        DEFAULT_MESSAGES_PER_SECOND = 10000
+
+        def messages_per_seconds
+          request = (@message.request || {})
+          minimum_messages_per_seconds = 10
+          [
+            minimum_messages_per_seconds,
+            (request["messagesPerSecond"] || DEFAULT_MESSAGES_PER_SECOND).to_i,
+          ].max
+        end
+      end
+
       class Handler < AsyncCommand::Handler
         private
+        def request_class
+          Request
+        end
+
         def start(request)
           dumper = Dumper.new(@context, loop, messenger, request)
           dumper.start
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index