Class: Redis

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/cryo/database/redis.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/cryo/database/redis.rb', line 3

def host
  @host
end

#local_pathObject

Returns the value of attribute local_path.



3
4
5
# File 'lib/cryo/database/redis.rb', line 3

def local_path
  @local_path
end

#optsObject

Returns the value of attribute opts.



3
4
5
# File 'lib/cryo/database/redis.rb', line 3

def opts
  @opts
end

#remote_pathObject

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_pathObject

Returns the value of attribute tmp_path.



3
4
5
# File 'lib/cryo/database/redis.rb', line 3

def tmp_path
  @tmp_path
end

#userObject

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_backupObject

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_backupObject

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