[Groonga-commit] droonga/droonga-engine at 028129a [master] Store last processed message timestamp as a serf tag

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Apr 21 10:42:12 JST 2015


YUKI Hiroshi	2015-04-21 10:42:12 +0900 (Tue, 21 Apr 2015)

  New Revision: 028129a1869770f8ef083edfa207f8e766746ef7
  https://github.com/droonga/droonga-engine/commit/028129a1869770f8ef083edfa207f8e766746ef7

  Message:
    Store last processed message timestamp as a serf tag

  Modified files:
    lib/droonga/engine.rb
    lib/droonga/serf.rb

  Modified: lib/droonga/engine.rb (+3 -1)
===================================================================
--- lib/droonga/engine.rb    2015-04-21 10:12:36 +0900 (d345143)
+++ lib/droonga/engine.rb    2015-04-21 10:42:12 +0900 (c27a9fb)
@@ -32,6 +32,7 @@ module Droonga
     include Deferrable
 
     def initialize(loop, name, internal_name)
+      @name = name
       @loop = loop
       @catalog = load_catalog
       @node_metadata = NodeMetadata.new
@@ -117,7 +118,8 @@ module Droonga
     def save_last_processed_message_timestamp
       logger.trace("output_last_processed_message_timestamp: start")
       if @last_processed_message_timestamp
-        @node_metadata.set(:last_processed_message_timestamp, @last_processed_message_timestamp.to_s)
+        serf = Serf.new(@name)
+        serf.last_processed_message_timestamp = @last_processed_message_timestamp
       end
       logger.trace("output_last_processed_message_timestamp: done")
     end

  Modified: lib/droonga/serf.rb (+12 -0)
===================================================================
--- lib/droonga/serf.rb    2015-04-21 10:12:36 +0900 (672f63f)
+++ lib/droonga/serf.rb    2015-04-21 10:42:12 +0900 (00aed90)
@@ -186,6 +186,18 @@ module Droonga
       # after that you must run update_cluster_state to update the cluster information cache
     end
 
+    def last_processed_message_timestamp
+      @node_metadata.reload
+      @node_metadata.get(:last_processed_message_timestamp)
+    end
+
+    def last_processed_message_timestamp=(timestamp)
+      @node_metadata.reload
+      @node_metadata.set(:last_processed_message_timestamp, timestamp.to_s)
+      set_tag("last-processed-message-timestamp", timestamp.to_s)
+      # after that you must run update_cluster_state to update the cluster information cache
+    end
+
     def accept_messages_newer_than_timestamp
       @node_metadata.reload
       @node_metadata.get(:accept_messages_newer_than)
-------------- next part --------------
HTML����������������������������...
Descargar 



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