Class: GoImport::ShardHelper
- Inherits:
-
Object
- Object
- GoImport::ShardHelper
- Defined in:
- lib/go_import/shard_helper.rb
Instance Attribute Summary collapse
-
#current_shard ⇒ Object
Returns the value of attribute current_shard.
-
#current_shard_count ⇒ Object
Returns the value of attribute current_shard_count.
-
#shards ⇒ Object
Returns the value of attribute shards.
Instance Method Summary collapse
-
#initialize(shard_size = nil) ⇒ ShardHelper
constructor
A new instance of ShardHelper.
- #shard_model(model) ⇒ Object
Constructor Details
#initialize(shard_size = nil) ⇒ ShardHelper
Returns a new instance of ShardHelper.
6 7 8 9 |
# File 'lib/go_import/shard_helper.rb', line 6 def initialize(shard_size = nil) @shard_size = shard_size || 25000 setup() end |
Instance Attribute Details
#current_shard ⇒ Object
Returns the value of attribute current_shard.
4 5 6 |
# File 'lib/go_import/shard_helper.rb', line 4 def current_shard @current_shard end |
#current_shard_count ⇒ Object
Returns the value of attribute current_shard_count.
4 5 6 |
# File 'lib/go_import/shard_helper.rb', line 4 def current_shard_count @current_shard_count end |
#shards ⇒ Object
Returns the value of attribute shards.
4 5 6 |
# File 'lib/go_import/shard_helper.rb', line 4 def shards @shards end |
Instance Method Details
#shard_model(model) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/go_import/shard_helper.rb', line 11 def shard_model(model) @current_shard.configuration = model.configuration model.coworkers.each{ |key, coworker| if coworker.integration_id != "import" add_coworker(coworker) end } model.organizations.each{|key, org| add_organization(org)} model.deals.each{|key, deal| add_deal(deal)} model.notes.each{|key, note| add_note(note)} add_documents(model.documents) return_value = @shards setup() return return_value end |