Kouhei Sutou
null+****@clear*****
Fri Dec 20 16:23:50 JST 2013
Kouhei Sutou 2013-12-20 16:23:50 +0900 (Fri, 20 Dec 2013) New Revision: 5f880fde4e4532f5e9522e0d58b03c24877ac12e https://github.com/droonga/fluent-plugin-droonga/commit/5f880fde4e4532f5e9522e0d58b03c24877ac12e Message: Use "message" instead of "envelope" Modified files: lib/droonga/dispatcher.rb lib/droonga/input_message.rb Modified: lib/droonga/dispatcher.rb (+8 -8) =================================================================== --- lib/droonga/dispatcher.rb 2013-12-20 16:15:05 +0900 (d15a6d2) +++ lib/droonga/dispatcher.rb 2013-12-20 16:23:50 +0900 (cac609e) @@ -173,23 +173,23 @@ module Droonga route.is_a?(String) || route.is_a?(Hash) end - def apply_input_adapters(envelope) - adapted_envelope = envelope + def apply_input_adapters(message) + adapted_message = message loop do - input_message = InputMessage.new(adapted_envelope) + input_message = InputMessage.new(adapted_message) command = input_message.command break unless @input_adapter.processable?(command) @input_adapter.process(command, input_message) new_command = input_message.command - adapted_envelope = input_message.adapted_envelope + adapted_message = input_message.adapted_message break if command == new_command end - adapted_envelope + adapted_message end - def process_input_message(envelope) - adapted_envelope = apply_input_adapters(envelope) - @distributor.process(adapted_envelope["type"], adapted_envelope) + def process_input_message(message) + adapted_message = apply_input_adapters(message) + @distributor.process(adapted_message["type"], adapted_message) end def log_tag Modified: lib/droonga/input_message.rb (+11 -11) =================================================================== --- lib/droonga/input_message.rb 2013-12-20 16:15:05 +0900 (cd6acfc) +++ lib/droonga/input_message.rb 2013-12-20 16:23:50 +0900 (9893b3e) @@ -17,35 +17,35 @@ module Droonga class InputMessage - def initialize(envelope) - @envelope = envelope + def initialize(raw_message) + @raw_message = raw_message end - def adapted_envelope - # TODO: We can create adapted envelope non-destructively. + def adapted_message + # TODO: We can create adapted message non-destructively. # If it is not performance issue, it is better that we don't - # change envelope destructively. Consider about it later. - @envelope + # change message destructively. Consider about it later. + @raw_message end def add_route(route) - @envelope["via"].push(route) + @raw_message["via"].push(route) end def body - @envelope["body"] + @raw_message["body"] end def body=(body) - @envelope["body"] = body + @raw_message["body"] = body end def command - @envelope["type"] + @raw_message["type"] end def command=(command) - @envelope["type"] = command + @raw_message["type"] = command end end end -------------- next part -------------- HTML����������������������������... 下载