[Groonga-commit] long-long-float/droonga-engine at 56cdf87 [master] catalog fetcher: split dataset option from client options

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Aug 28 12:14:15 JST 2014


Kouhei Sutou	2014-08-28 12:14:15 +0900 (Thu, 28 Aug 2014)

  New Revision: 56cdf87d14855bdfea8026fd55e57f52282b33a9
  https://github.com/long-long-float/droonga-engine/commit/56cdf87d14855bdfea8026fd55e57f52282b33a9

  Merged 5be18f3: Merge branch 'master' of github.com:droonga/droonga-engine
  Merged 15fc80d: Merge branch 'master' of github.com:droonga/droonga-engine

  Message:
    catalog fetcher: split dataset option from client options
    
    Because it is not client option. It is a parameter in a message.

  Modified files:
    lib/droonga/catalog_fetcher.rb
    lib/droonga/command/serf_event_handler.rb

  Modified: lib/droonga/catalog_fetcher.rb (+6 -10)
===================================================================
--- lib/droonga/catalog_fetcher.rb    2014-08-28 12:07:19 +0900 (260afc8)
+++ lib/droonga/catalog_fetcher.rb    2014-08-28 12:14:15 +0900 (bb082c2)
@@ -18,20 +18,17 @@ require "droonga/client"
 
 module Droonga
   class CatalogFetcher
-    class << self
-      def fetch(client_options)
-        new(client_options).fetch
-      end
-    end
-
     def initialize(client_options)
       @client_options = default_options.merge(client_options)
     end
 
-    def fetch
+    def fetch(options={})
+      message = {
+        :dataset => options[:dataset] || CatalogGenerator::DEFAULT_DATASET,
+        :type    => "catalog.fetch"
+      }
       Droonga::Client.open(@client_options) do |client|
-        response = client.request(:dataset => @client_options[:dataset],
-                                  :type    => "catalog.fetch")
+        response = client.request(message)
         response["body"]
       end
     end
@@ -39,7 +36,6 @@ module Droonga
     private
     def default_options
       {
-        :dataset       => CatalogGenerator::DEFAULT_DATASET,
         :host          => "127.0.0.1",
         :port          => CatalogGenerator::DEFAULT_PORT,
         :tag           => CatalogGenerator::DEFAULT_TAG,

  Modified: lib/droonga/command/serf_event_handler.rb (+5 -5)
===================================================================
--- lib/droonga/command/serf_event_handler.rb    2014-08-28 12:07:19 +0900 (0a54fb4)
+++ lib/droonga/command/serf_event_handler.rb    2014-08-28 12:14:15 +0900 (8a666c6)
@@ -145,11 +145,11 @@ module Droonga
         source_host  = source_node.split(":").first
         joining_host = joining_node.split(":").first
 
-        catalog = CatalogFetcher.fetch(:dataset       => dataset_name,
-                                       :host          => source_host,
-                                       :port          => source_node_port,
-                                       :tag           => tag,
-                                       :receiver_host => joining_host)
+        fetcher = CatalogFetcher.new(:host          => source_host,
+                                     :port          => source_node_port,
+                                     :tag           => tag,
+                                     :receiver_host => joining_host)
+        catalog = fetcher.fetch(:dataset => dataset_name)
 
         generator = create_current_catalog_generator(catalog)
         dataset = generator.dataset_for_host(source_host) ||
-------------- next part --------------
HTML����������������������������...
Download 



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