Class: SDBTools::Dump

Inherits:
Task
  • Object
show all
Defined in:
lib/sdbtools.rb

Instance Method Summary collapse

Methods inherited from Task

#failed_items, #finish_items!, #incomplete_count, #release_working_items!, #report, #reserve_items!, #session

Constructor Details

#initialize(domain, filename, logger) ⇒ Dump

Returns a new instance of Dump.



111
112
113
114
115
116
117
# File 'lib/sdbtools.rb', line 111

def initialize(domain, filename, logger)
  @domain                   = domain
  @dump_filename            = Pathname(filename)
  super(status_filename, logger) {
    @domain.item_names
  }
end

Instance Method Details

#start!Object



125
126
127
128
129
130
131
132
133
134
# File 'lib/sdbtools.rb', line 125

def start!
  session do
    until (chunk = reserve_items!(chunk_size)).empty?
      items = @domain.items(chunk)
      dump_items(items)
      finish_items!(chunk)
      items.each do |item| callback.call(item) end
    end
  end
end

#status_filenameObject



119
120
121
122
123
# File 'lib/sdbtools.rb', line 119

def status_filename
  Pathname(
    @dump_filename.basename(@dump_filename.extname).to_s + 
    ".simpledb_op_status")
end