Class: Monsoon::Client
- Inherits:
-
Object
- Object
- Monsoon::Client
- Defined in:
- lib/monsoon/client.rb
Instance Method Summary collapse
-
#backup ⇒ Object
Creates an instance of the Monsoon::Backup class.
-
#compress(backup) ⇒ Object
Creates an instnace of the Monsoon::Compress class.
-
#initialize(bucket = Monsoon.bucket, key = Monsoon.key, secret = Monsoon.secret, mongo_uri = Monsoon.mongo_uri) ⇒ Client
constructor
A new instance of Client.
-
#run ⇒ Object
Run the Monsoon process to backup, save, and clean the work.
-
#store(filename) ⇒ Object
Creates an instance of the Monsoon::Store class.
Constructor Details
#initialize(bucket = Monsoon.bucket, key = Monsoon.key, secret = Monsoon.secret, mongo_uri = Monsoon.mongo_uri) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 9 |
# File 'lib/monsoon/client.rb', line 4 def initialize(bucket = Monsoon.bucket, key = Monsoon.key, secret = Monsoon.secret, mongo_uri = Monsoon.mongo_uri) @bucket = bucket @key = key @secret = secret @mongo_uri = mongo_uri end |
Instance Method Details
#backup ⇒ Object
43 44 45 |
# File 'lib/monsoon/client.rb', line 43 def backup Backup.new(@mongo_uri) end |
#compress(backup) ⇒ Object
Creates an instnace of the Monsoon::Compress class
backup - The Monsoon::Backup instance the preceeded.
Examples
Monsoon::Client.new.compress(#<Monsoon::Backup>)
# => #<Monsoon::Compress>
Returns an instance of the Monsoon::Compress object
57 58 59 |
# File 'lib/monsoon/client.rb', line 57 def compress(backup) Compress.new(backup) end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/monsoon/client.rb', line 19 def run # Backup the MongoDB database to filesystem b = backup.run # Compress the contents of the backup c = compress(b).run # Sent to AWS store(c.filename).save # Remove the compressed file from the filesystem c.clean true end |