Class: Store

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

Direct Known Subclasses

S3

Instance Attribute Summary collapse

Class Method 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 = {}) ⇒ Store

Returns a new instance of Store.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cryo/store.rb', line 9

def initialize(opts={})
  self.logger = Logger.new(STDERR)
  logger.level = Logger::DEBUG

  @snapshot_frequency = opts[:snapshot_frequency]
  @archive_frequency = opts[:archive_frequency]
  @snapshot_period = opts[:snapshot_period]
  @snapshot_prefix = opts[:snapshot_prefix]
  @archive_prefix = opts[:archive_prefix]
  @time = opts[:time]
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/cryo/store.rb', line 7

def logger
  @logger
end

Class Method Details

.create(options = {}) ⇒ Object



38
39
40
# File 'lib/cryo/store.rb', line 38

def create(options={})
  const_get(options[:type].to_s.capitalize).new(options)
end

Instance Method Details

#archive_and_purgeObject



43
44
45
46
47
# File 'lib/cryo/store.rb', line 43

def archive_and_purge
  snapshot_list = get_snapshot_list
  newest_archive = get_newest_archive
  recursive_archive_and_purge(snapshot_list: snapshot_list, newest_archive: newest_archive)
end

#getObject



21
22
23
# File 'lib/cryo/store.rb', line 21

def get()
  raise "implement me"
end

#get_archive_listObject



33
34
35
# File 'lib/cryo/store.rb', line 33

def get_archive_list()
  raise "implement me"
end

#get_snapshot_listObject



29
30
31
# File 'lib/cryo/store.rb', line 29

def get_snapshot_list()
  raise "implement me"
end

#putObject



25
26
27
# File 'lib/cryo/store.rb', line 25

def put()
  raise "implement me"
end