Class: CouchRest::Upgrade
Instance Attribute Summary collapse
-
#dbname ⇒ Object
Returns the value of attribute dbname.
-
#newdb ⇒ Object
Returns the value of attribute newdb.
-
#olddb ⇒ Object
Returns the value of attribute olddb.
Instance Method Summary collapse
- #clone! ⇒ Object
-
#initialize(dbname, old_couch, new_couch) ⇒ Upgrade
constructor
A new instance of Upgrade.
Constructor Details
#initialize(dbname, old_couch, new_couch) ⇒ Upgrade
Returns a new instance of Upgrade.
4 5 6 7 8 9 |
# File 'lib/couchrest/helper/upgrade.rb', line 4 def initialize dbname, old_couch, new_couch @dbname = dbname @olddb = old_couch.database dbname @newdb = new_couch.database!(dbname) @bulk_docs = [] end |
Instance Attribute Details
#dbname ⇒ Object
Returns the value of attribute dbname.
3 4 5 |
# File 'lib/couchrest/helper/upgrade.rb', line 3 def dbname @dbname end |
#newdb ⇒ Object
Returns the value of attribute newdb.
3 4 5 |
# File 'lib/couchrest/helper/upgrade.rb', line 3 def newdb @newdb end |
#olddb ⇒ Object
Returns the value of attribute olddb.
3 4 5 |
# File 'lib/couchrest/helper/upgrade.rb', line 3 def olddb @olddb end |
Instance Method Details
#clone! ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/couchrest/helper/upgrade.rb', line 10 def clone! puts "#{dbname} - #{olddb.info['doc_count']} docs" streamer = CouchRest::Streamer.new(olddb) streamer.view("_all_docs_by_seq") do |row| load_row_docs(row) if row maybe_flush_bulks end flush_bulks! end |