X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fjournal.rb;h=981ff6e47eaab41fa496ed929d614615772bd1e8;hb=a19f7bfb97e5f36e6b282fcc0982584838e86a0a;hp=8d8979296bb8518913262cdd60bb83d8ec8cfb4a;hpb=732f8df5966f4b85ffe19e045e9aeccc35206fab;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/journal.rb b/lib/rbot/journal.rb index 8d897929..981ff6e4 100644 --- a/lib/rbot/journal.rb +++ b/lib/rbot/journal.rb @@ -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