Class: NoSE::Loader::RandomLoader
- Inherits:
-
LoaderBase
- Object
- LoaderBase
- NoSE::Loader::RandomLoader
- Defined in:
- lib/nose/loader/random.rb
Overview
Load some random data (mostly useful for testing)
Instance Method Summary collapse
-
#initialize(workload = nil, backend = nil) ⇒ RandomLoader
constructor
A new instance of RandomLoader.
-
#load(indexes, config, show_progress = false, limit = nil, skip_existing = true) ⇒ void
Load a generated set of indexes with data from MySQL.
Methods inherited from LoaderBase
Constructor Details
#initialize(workload = nil, backend = nil) ⇒ RandomLoader
Returns a new instance of RandomLoader.
7 8 9 10 11 12 |
# File 'lib/nose/loader/random.rb', line 7 def initialize(workload = nil, backend = nil) @logger = Logging.logger['nose::loader::randomloader'] @workload = workload @backend = backend end |
Instance Method Details
#load(indexes, config, show_progress = false, limit = nil, skip_existing = true) ⇒ void
This method returns an undefined value.
Load a generated set of indexes with data from MySQL
16 17 18 19 20 21 22 23 24 |
# File 'lib/nose/loader/random.rb', line 16 def load(indexes, config, show_progress = false, limit = nil, skip_existing = true) limit = 1 if limit.nil? indexes.map!(&:to_id_graph).uniq! if @backend.by_id_graph indexes.uniq.each do |index| load_index index, config, show_progress, limit, skip_existing end end |