X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frbot%2Fjournal.rb;h=981ff6e47eaab41fa496ed929d614615772bd1e8;hb=8dc14bf88cbf38496aa21c2c17e42b211e7e1278;hp=0903fc9f67d76d60061be0eb8514723028f643e2;hpb=5d98c9493ba069a0df7345157236caa938f9dcb2;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/journal.rb b/lib/rbot/journal.rb index 0903fc9f..981ff6e4 100644 --- a/lib/rbot/journal.rb +++ b/lib/rbot/journal.rb @@ -78,7 +78,6 @@ module Journal def self.create(topic, payload, opt={}) # cleanup payload to only contain strings - payload = payload.map { |k, v| [k.to_s, v.to_s] }.to_h JournalMessage.new( id: opt[:id] || SecureRandom.uuid, timestamp: opt[:timestamp] || Time.now, @@ -99,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 @@ -278,6 +277,7 @@ module Journal class JournalBroker + attr_reader :storage class Subscription attr_reader :topic attr_reader :block @@ -345,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 @@ -417,6 +418,10 @@ module Journal @storage.remove(query) end + def ensure_payload_index(key) + @storage.ensure_payload_index(key) + end + end end # Journal