Class: CouchRest::Upgrade
- Inherits:
-
Object
- Object
- CouchRest::Upgrade
- Defined in:
- lib/couchrest/helper/upgrade.rb
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.
5 6 7 8 9 10 |
# File 'lib/couchrest/helper/upgrade.rb', line 5 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.
4 5 6 |
# File 'lib/couchrest/helper/upgrade.rb', line 4 def dbname @dbname end |
#newdb ⇒ Object
Returns the value of attribute newdb.
4 5 6 |
# File 'lib/couchrest/helper/upgrade.rb', line 4 def newdb @newdb end |
#olddb ⇒ Object
Returns the value of attribute olddb.
4 5 6 |
# File 'lib/couchrest/helper/upgrade.rb', line 4 def olddb @olddb end |
Instance Method Details
#clone! ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/couchrest/helper/upgrade.rb', line 11 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 |