]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/journal.rb
test: fix shadowed test method
[user/henk/code/ruby/rbot.git] / lib / rbot / journal.rb
index 8d8979296bb8518913262cdd60bb83d8ec8cfb4a..981ff6e47eaab41fa496ed929d614615772bd1e8 100644 (file)
@@ -77,6 +77,7 @@ module Journal
     end
 
     def self.create(topic, payload, opt={})
+      # cleanup payload to only contain strings
       JournalMessage.new(
         id: opt[:id] || SecureRandom.uuid,
         timestamp: opt[:timestamp] || Time.now,
@@ -97,7 +98,7 @@ module Journal
       end
 
       # creates/ensures a index exists on the payload specified by key
-      def ensure_index(key)
+      def ensure_payload_index(key)
       end
 
       # returns a array of message instances that match the query
@@ -276,6 +277,7 @@ module Journal
 
 
   class JournalBroker
+    attr_reader :storage
     class Subscription
       attr_reader :topic
       attr_reader :block
@@ -343,6 +345,7 @@ module Journal
     end
 
     def publish(topic, payload)
+      debug 'journal publish message in %s: %s' % [topic, payload.inspect]
       @queue << JournalMessage::create(topic, payload)
       nil
     end
@@ -415,6 +418,10 @@ module Journal
       @storage.remove(query)
     end
 
+    def ensure_payload_index(key)
+      @storage.ensure_payload_index(key)
+    end
+
   end
 
 end # Journal