Class: MoveToGo::ShardHelper
- Inherits:
-
Object
- Object
- MoveToGo::ShardHelper
- Defined in:
- lib/move-to-go/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/move-to-go/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/move-to-go/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/move-to-go/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/move-to-go/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 28 29 |
# File 'lib/move-to-go/shard_helper.rb', line 11 def shard_model(model) @current_shard.settings = model.settings model.coworkers.each{ |key, coworker| if coworker.integration_id != "migrator" add_coworker(coworker) end } model.organizations.each{|key, org| add_organization(org)} model.deals.each{|key, deal| add_deal(deal)} model.histories.each{|key, history| add_history(history)} model.todos.each{|key, todo| add_todo(todo)} model.meetings.each{|key, meeting| add_meeting(meeting)} add_documents(model.documents) return_value = @shards setup() return return_value end |