[Groonga-commit] droonga/fluent-plugin-droonga at a5b18d4 [master] Ensure schema when dispatcher started

Back to archive index

Yoji Shidara null+****@clear*****
Thu Feb 27 11:41:48 JST 2014


Yoji Shidara	2014-02-27 11:41:48 +0900 (Thu, 27 Feb 2014)

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

  Message:
    Ensure schema when dispatcher started

  Modified files:
    lib/droonga/catalog/version2.rb
    lib/droonga/dispatcher.rb

  Modified: lib/droonga/catalog/version2.rb (+4 -0)
===================================================================
--- lib/droonga/catalog/version2.rb    2014-02-27 11:41:05 +0900 (fc5cbe0)
+++ lib/droonga/catalog/version2.rb    2014-02-27 11:41:48 +0900 (f6d0e20)
@@ -72,6 +72,10 @@ module Droonga
         routes
       end
 
+      def get_datasets
+        @data["datasets"]
+      end
+
       private
       def validate
         # TODO: Implement me.

  Modified: lib/droonga/dispatcher.rb (+14 -0)
===================================================================
--- lib/droonga/dispatcher.rb    2014-02-27 11:41:05 +0900 (87fe668)
+++ lib/droonga/dispatcher.rb    2014-02-27 11:41:48 +0900 (f614f0a)
@@ -24,6 +24,7 @@ require "droonga/session"
 require "droonga/replier"
 require "droonga/error_messages"
 require "droonga/distributor"
+require "droonga/catalog/schema"
 
 module Droonga
   class Dispatcher
@@ -69,6 +70,8 @@ module Droonga
       @loop_thread = Thread.new do
         @loop.run
       end
+
+      ensure_schema
     end
 
     def shutdown
@@ -274,6 +277,17 @@ module Droonga
       end
     end
 
+    def ensure_schema
+      @catalog.datasets.each do |name, dataset|
+        schema = Droonga::Catalog::Schema.new(dataset["schema"])
+        messages = schema.to_messages
+        messages.each do |message|
+          message["dataset"] = name
+          process_message(message)
+        end
+      end
+    end
+
     def log_tag
       "[#{Process.ppid}][#{Process.pid}] dispatcher"
     end
-------------- next part --------------
HTML����������������������������...
Download 



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