[Groonga-commit] long-long-float/droonga-engine at 45f1de6 [master] Don't use "create_current_catalog_generator" for not "current" case

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Aug 28 16:19:09 JST 2014


YUKI Hiroshi	2014-08-28 16:19:09 +0900 (Thu, 28 Aug 2014)

  New Revision: 45f1de6856713cb659cfdaf56e7bcb2442a67a14
  https://github.com/long-long-float/droonga-engine/commit/45f1de6856713cb659cfdaf56e7bcb2442a67a14

  Message:
    Don't use "create_current_catalog_generator" for not "current" case

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

  Modified: lib/droonga/command/serf_event_handler.rb (+5 -8)
===================================================================
--- lib/droonga/command/serf_event_handler.rb    2014-08-28 14:55:01 +0900 (8a666c6)
+++ lib/droonga/command/serf_event_handler.rb    2014-08-28 16:19:09 +0900 (8237cfb)
@@ -151,7 +151,8 @@ module Droonga
                                      :receiver_host => joining_host)
         catalog = fetcher.fetch(:dataset => dataset_name)
 
-        generator = create_current_catalog_generator(catalog)
+        generator = CatalogGenerator.new
+        generator.load(catalog)
         dataset = generator.dataset_for_host(source_host) ||
                     generator.dataset_for_host(host)
         return unless dataset
@@ -240,15 +241,11 @@ module Droonga
       end
 
       def modify_catalog
-        generator = create_current_catalog_generator
-        yield(generator)
-        SafeFileWriter.write(Path.catalog, JSON.pretty_generate(generator.generate))
-      end
-
-      def create_current_catalog_generator(current_catalog=nil)
-        current_catalog ||= JSON.parse(Path.catalog.read)
         generator = CatalogGenerator.new
+        current_catalog = JSON.parse(Path.catalog.read)
         generator.load(current_catalog)
+        yield(generator)
+        SafeFileWriter.write(Path.catalog, JSON.pretty_generate(generator.generate))
       end
 
       def absorb_data
-------------- next part --------------
HTML����������������������������...
Download 



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