[Groonga-commit] droonga/drndump at 03c30e5 [master] Export number of forecasted and received messages

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Apr 17 16:39:54 JST 2015


YUKI Hiroshi	2015-04-17 16:39:54 +0900 (Fri, 17 Apr 2015)

  New Revision: 03c30e55319004c8f140ff5799bb9d6dd14ff031
  https://github.com/droonga/drndump/commit/03c30e55319004c8f140ff5799bb9d6dd14ff031

  Message:
    Export number of forecasted and received messages

  Modified files:
    lib/drndump/dump_client.rb

  Modified: lib/drndump/dump_client.rb (+9 -0)
===================================================================
--- lib/drndump/dump_client.rb    2015-04-17 10:12:14 +0900 (7f836de)
+++ lib/drndump/dump_client.rb    2015-04-17 16:39:54 +0900 (4273223)
@@ -19,6 +19,7 @@ require "droonga/client"
 
 module Drndump
   class DumpClient
+    attr_reader :n_forecasted_messages, :n_received_messages
     attr_reader :error_message
     attr_writer :on_finish, :on_progress, :on_error
 
@@ -43,6 +44,9 @@ module Drndump
       @receiver_host = params[:receiver_host]
       @receiver_port = params[:receiver_port]
 
+      @n_forecasted_messages = 0
+      @n_received_messages = 0
+
       @error_message = nil
 
       @on_finish = nil
@@ -88,12 +92,15 @@ module Drndump
               @error_message = "#{error['name']}: #{error['message']}"
             end
           when "dump.table"
+            @n_received_messages += 1
             table_create_message = convert_to_table_create_message(message)
             yield(table_create_message)
           when "dump.column"
+            @n_received_messages += 1
             column_create_message = convert_to_column_create_message(message)
             yield(column_create_message)
           when "dump.record"
+            @n_received_messages += 1
             add_message = message.dup
             add_message.delete("inReplyTo")
             add_message["type"] = "add"
@@ -106,6 +113,8 @@ module Drndump
               client.close
               on_finish
             end
+          when "dump.forecast"
+            @n_forecasted_messages += message["body"]["nMessages"]
           end
         when NilClass
           client.close
-------------- next part --------------
HTML����������������������������...
Download 



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