Class: Redis
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#local_path ⇒ Object
Returns the value of attribute local_path.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#remote_path ⇒ Object
Returns the value of attribute remote_path.
-
#tmp_path ⇒ Object
Returns the value of attribute tmp_path.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#get_backup ⇒ Object
get a copy of the db from remote host.
-
#get_gzipped_backup ⇒ Object
get a zipped copy of the db from remote host.
-
#initialize(opts = {}) ⇒ Redis
constructor
A new instance of Redis.
Methods included from Utils
#delete_file, #get_age_from_key_name, #get_tempfile, #get_timstamped_key_name, #get_utc_time, #get_utc_time_from_key_name, #get_utc_timestamp, #gzip_file, #need_to_archive?, #safe_run, #ungzip_file, #verify_system_dependency
Constructor Details
#initialize(opts = {}) ⇒ Redis
Returns a new instance of Redis.
5 6 7 8 9 10 11 12 13 |
# File 'lib/cryo/database/redis.rb', line 5 def initialize(opts={}) raise "you need to specify a remote host" unless opts[:host] self.host = opts[:host] self.user = opts[:user] || 'ubuntu' raise "you need to specify a tmp path" unless opts[:tmp_path] self.tmp_path = opts[:tmp_path] self.remote_path = opts[:path] || '/mnt/redis/dump.rdb' self.local_path = opts[:local_path] || get_tempfile end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'lib/cryo/database/redis.rb', line 3 def host @host end |
#local_path ⇒ Object
Returns the value of attribute local_path.
3 4 5 |
# File 'lib/cryo/database/redis.rb', line 3 def local_path @local_path end |
#opts ⇒ Object
Returns the value of attribute opts.
3 4 5 |
# File 'lib/cryo/database/redis.rb', line 3 def opts @opts end |
#remote_path ⇒ Object
Returns the value of attribute remote_path.
3 4 5 |
# File 'lib/cryo/database/redis.rb', line 3 def remote_path @remote_path end |
#tmp_path ⇒ Object
Returns the value of attribute tmp_path.
3 4 5 |
# File 'lib/cryo/database/redis.rb', line 3 def tmp_path @tmp_path end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/cryo/database/redis.rb', line 3 def user @user end |
Instance Method Details
#get_backup ⇒ Object
get a copy of the db from remote host
17 18 19 |
# File 'lib/cryo/database/redis.rb', line 17 def get_backup() take_dump end |
#get_gzipped_backup ⇒ Object
get a zipped copy of the db from remote host
23 24 25 |
# File 'lib/cryo/database/redis.rb', line 23 def get_gzipped_backup take_dump_and_gzip end |