Sha256: d865c2d6fe136ffbea63ab03fd318e9c037611bf9fef4ec6bbe5eb0e16285b8b

Contents?: true

Size: 1.3 KB

Versions: 11

Compression:

Stored size: 1.3 KB

Contents

unless defined? $__rq_snapshotter__
  module RQ 
#--{{{
    LIBDIR = File::dirname(File::expand_path(__FILE__)) + File::SEPARATOR unless
      defined? LIBDIR

    require LIBDIR + 'mainhelper'

    #
    # a Snapshotter is responsible for safely making a hot snapshot of a queue's
    # db.  it's very useful to make a snapshot if, for instance, you are working
    # out a complex query over several attempts since each attempt will compete
    # with other processes for the queue's lock.  by making a snapshot you will
    # have your own read only copy to perfect your command before applying it to
    # the actual queue.  the feature can also be used to make a hot backup of a
    # queue - tough the Backer has some features that make this more convenient
    #
    class  Snapshotter < MainHelper
#--{{{
      def snapshot 
#--{{{
        set_q
        qtmp = @argv.shift
        raise "<#{ qtmp }> exists" if qtmp and test(?e, qtmp)
        qss = @q.snapshot qtmp, @options['retries']
        #info{ "created q snapshot <#{ qtmp }>" }

        puts '---'
        puts "q: #{ qss.path }"
        puts "db: #{ qss.db.path }"
        puts "schema: #{ qss.db.schema }"
        puts "lock: #{ qss.db.lockfile }"
#--}}}
      end
#--}}}
    end # class Snapshotter
#--}}}
  end # module RQ
$__rq_snapshotter__ = __FILE__ 
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
rq-3.5.3 lib/rq/snapshotter.rb
rq-3.5.1 lib/rq/snapshotter.rb
rq-3.5.0 lib/rq/snapshotter.rb
rq-ruby1.8-3.4.7 lib/rq/snapshotter.rb
rq-ruby1.8-3.4.6 lib/rq/snapshotter.rb
rq-ruby1.8-3.4.5 lib/rq/snapshotter.rb
rq-ruby1.8-3.4.3 lib/rq/snapshotter.rb
rq-3.0.0 lib/rq-3.0.0/snapshotter.rb
rq-3.1.0 lib/rq-3.1.0/snapshotter.rb
rq-3.3.0 lib/rq/snapshotter.rb
rq-3.4.0 lib/rq/snapshotter.rb