Module: MapReduce::ActiveRecord::Base

Defined in:
lib/map_reduce/active_record.rb

Defined Under Namespace

Classes: Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#empty_queue_waitObject

Returns the value of attribute empty_queue_wait.



7
8
9
# File 'lib/map_reduce/active_record.rb', line 7

def empty_queue_wait
  @empty_queue_wait
end

#locked_queue_waitObject

Returns the value of attribute locked_queue_wait.



7
8
9
# File 'lib/map_reduce/active_record.rb', line 7

def locked_queue_wait
  @locked_queue_wait
end

#queue_sizeObject

Returns the value of attribute queue_size.



7
8
9
# File 'lib/map_reduce/active_record.rb', line 7

def queue_size
  @queue_size
end

#rescan_when_completeObject

Returns the value of attribute rescan_when_complete.



7
8
9
# File 'lib/map_reduce/active_record.rb', line 7

def rescan_when_complete
  @rescan_when_complete
end

#vigilantObject

Returns the value of attribute vigilant.



7
8
9
# File 'lib/map_reduce/active_record.rb', line 7

def vigilant
  @vigilant
end

Instance Method Details

#get_idObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/map_reduce/active_record.rb', line 45

def get_id
  t = Time.now

  if @lock
    return :locked_queue_wait
  else
    unless object_id = queue.shift
      return :empty_queue_wait
    end
  end

  @time_spent_grabbing_objects += (Time.now - t)
  @num_objects_grabbed += 1

  return object_id
end