[Groonga-commit] droonga/fluent-plugin-droonga at c080786 [master] distributor: use "message" instead of "envelope"

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Dec 20 17:40:45 JST 2013


Kouhei Sutou	2013-12-20 17:40:45 +0900 (Fri, 20 Dec 2013)

  New Revision: c0807860cb226b37a9b92148871dca9057291590
  https://github.com/droonga/fluent-plugin-droonga/commit/c0807860cb226b37a9b92148871dca9057291590

  Message:
    distributor: use "message" instead of "envelope"

  Modified files:
    lib/droonga/plugin/distributor/crud.rb
    lib/droonga/plugin/distributor/distributed_search_planner.rb
    lib/droonga/plugin/distributor/groonga.rb
    lib/droonga/plugin/distributor/search.rb
    lib/droonga/plugin/distributor/watch.rb

  Modified: lib/droonga/plugin/distributor/crud.rb (+9 -9)
===================================================================
--- lib/droonga/plugin/distributor/crud.rb    2013-12-20 17:39:00 +0900 (c44039d)
+++ lib/droonga/plugin/distributor/crud.rb    2013-12-20 17:40:45 +0900 (704030c)
@@ -22,22 +22,22 @@ module Droonga
     repository.register("crud", self)
 
     command :add
-    def add(envelope)
-      key = envelope["body"]["key"] || rand.to_s
-      scatter_all(envelope, key)
+    def add(message)
+      key = message["body"]["key"] || rand.to_s
+      scatter_all(message, key)
     end
 
     command :update
-    def update(envelope)
-      key = envelope["body"]["key"] || rand.to_s
-      scatter_all(envelope, key)
+    def update(message)
+      key = message["body"]["key"] || rand.to_s
+      scatter_all(message, key)
     end
 
     # TODO: What is this?
     command :reset
-    def reset(envelope)
-      key = envelope["body"]["key"] || rand.to_s
-      scatter_all(envelope, key)
+    def reset(message)
+      key = message["body"]["key"] || rand.to_s
+      scatter_all(message, key)
     end
   end
 end

  Modified: lib/droonga/plugin/distributor/distributed_search_planner.rb (+4 -4)
===================================================================
--- lib/droonga/plugin/distributor/distributed_search_planner.rb    2013-12-20 17:39:00 +0900 (7933ef9)
+++ lib/droonga/plugin/distributor/distributed_search_planner.rb    2013-12-20 17:40:45 +0900 (b371d83)
@@ -19,9 +19,9 @@ module Droonga
   class DistributedSearchPlanner
     attr_reader :messages
 
-    def initialize(search_request_envelope)
-      @source_envelope = search_request_envelope
-      @request = @source_envelope["body"]
+    def initialize(search_request_message)
+      @source_message = search_request_message
+      @request = @source_message["body"]
       @queries = @request["queries"]
 
       @input_names = []
@@ -52,7 +52,7 @@ module Droonga
       searcher = {
         "type" => "broadcast",
         "command" => "search", # XXX should be placed in the "body"?
-        "dataset" => @source_envelope["dataset"] || @request["dataset"],
+        "dataset" => @source_message["dataset"] || @request["dataset"],
         "body" => @request,
         "outputs" => @input_names, # XXX should be placed in the "body"?
         "replica" => "random", # XXX should be placed in the "body"?

  Modified: lib/droonga/plugin/distributor/groonga.rb (+5 -5)
===================================================================
--- lib/droonga/plugin/distributor/groonga.rb    2013-12-20 17:39:00 +0900 (54d54cb)
+++ lib/droonga/plugin/distributor/groonga.rb    2013-12-20 17:40:45 +0900 (ad30ce9)
@@ -22,16 +22,16 @@ module Droonga
     repository.register("groonga", self)
 
     command :table_create
-    def table_create(envelope)
-      unless envelope["dataset"]
+    def table_create(message)
+      unless message["dataset"]
         raise "dataset must be set. FIXME: This error should return client."
       end
-      broadcast_all(envelope)
+      broadcast_all(message)
     end
 
     command :column_create
-    def column_create(envelope)
-      broadcast_all(envelope)
+    def column_create(message)
+      broadcast_all(message)
     end
   end
 end

  Modified: lib/droonga/plugin/distributor/search.rb (+2 -2)
===================================================================
--- lib/droonga/plugin/distributor/search.rb    2013-12-20 17:39:00 +0900 (2fae701)
+++ lib/droonga/plugin/distributor/search.rb    2013-12-20 17:40:45 +0900 (dadb982)
@@ -23,8 +23,8 @@ module Droonga
     repository.register("search", self)
 
     command :search
-    def search(envelope)
-      planner = DistributedSearchPlanner.new(envelope)
+    def search(message)
+      planner = DistributedSearchPlanner.new(message)
       distribute(planner.messages)
     end
   end

  Modified: lib/droonga/plugin/distributor/watch.rb (+8 -8)
===================================================================
--- lib/droonga/plugin/distributor/watch.rb    2013-12-20 17:39:00 +0900 (d2dc5a0)
+++ lib/droonga/plugin/distributor/watch.rb    2013-12-20 17:40:45 +0900 (fc37aef)
@@ -22,23 +22,23 @@ module Droonga
     repository.register("watch", self)
 
     command "watch.feed" => :feed
-    def feed(envelope)
-      broadcast_all(envelope)
+    def feed(message)
+      broadcast_all(message)
     end
 
     command "watch.subscribe" => :subscribe
-    def subscribe(envelope)
-      broadcast_all(envelope)
+    def subscribe(message)
+      broadcast_all(message)
     end
 
     command "watch.unsubscribe" => :unsubscribe
-    def unsubscribe(envelope)
-      broadcast_all(envelope)
+    def unsubscribe(message)
+      broadcast_all(message)
     end
 
     command "watch.sweep" => :sweep
-    def sweep(envelope)
-      broadcast_all(envelope)
+    def sweep(message)
+      broadcast_all(message)
     end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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