lib/ruote/storage/base.rb in ruote-2.3.0.1 vs lib/ruote/storage/base.rb in ruote-2.3.0.2

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2012, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -53,23 +53,16 @@ def reserve(doc) delete(doc).nil? end - # A helper for the #worker method, it returns that dummy worker - # when there is no reference to the calling worker in the current - # thread's local variables. - # - DUMMY_WORKER = OpenStruct.new( - :name => 'worker', :identity => 'unknown', :state => 'running') - # Warning, this is not equivalent to doing @context.worker, this method # fetches the worker from the local thread variables. # def worker - Thread.current['ruote_worker'] || DUMMY_WORKER + Ruote.current_worker end #-- # configurations #++ @@ -162,11 +155,14 @@ #-- # trackers #++ - def get_trackers + # Some storage implementation might need the wfid information when + # adding or removing trackers. + # + def get_trackers(wfid=nil) get('variables', 'trackers') || { '_id' => 'trackers', 'type' => 'variables', 'trackers' => {} } end @@ -339,11 +335,11 @@ # def prepare_schedule_doc(flavour, owner_fei, s, msg) at = if s.is_a?(Time) # at or every s - elsif Ruote.is_cron_string(s) # cron + elsif Ruote.cron_string?(s) # cron Rufus::CronLine.new(s).next_time(Time.now + 1) else # at or every Ruote.s_to_at(s) end at = at.utc @@ -398,12 +394,10 @@ else # Regexp keys.find { |key| _id.match(key) } end end - # (Only used by ruote-couch 2.2.x) - # - # TODO: remove me at some point + # Used by ruote-couch and ruote-asw # def self.key_match?(keys, doc) _id = doc.is_a?(Hash) ? doc['_id'] : doc