Class: Backups::Adapter::Mysql

Inherits:
Base
  • Object
show all
Includes:
Stats::Mysql
Defined in:
lib/backups/adapter/mysql.rb

Constant Summary

Constants inherited from Base

Base::ALL_DATABASES

Constants included from Loader

Loader::CONFIG_ENV, Loader::CONFIG_SYSTEM, Loader::CONFIG_USER

Instance Method Summary collapse

Methods included from Stats::Mysql

#get_database_names, #get_database_stats, #get_database_tables, #get_excluded_schemas, #get_server_tables, #get_table_stats

Methods included from Driver::Mysql

#connect, #exec_query, #get_result, #get_results

Methods inherited from Base

#compress, #get_date_path, #get_prefix, #get_timestamp, #initialize, #send_to_s3, #tag_s3_object

Methods included from Loader

#load_configs

Methods included from System

#delete, #delete_dir, #exec, #mkdir, #nuke_dir, #write

Constructor Details

This class inherits a constructor from Backups::Base

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/backups/adapter/mysql.rb', line 9

def run
  setup
  create_dump
  compress @job_dir, @job_zip, @secret

  @job_size = File.size(@job_zip) if not $DRY_RUN
  $LOGGER.info "File #{@job_zip} created with #{@job_size} bytes"

  send_to_s3 @s3_bucket, @s3_prefix, @job_zip, @config if @s3_active
  clean_up if @cleanup
  report

  return @report
end

#verifyObject



24
25
26
27
28
29
30
31
32
# File 'lib/backups/adapter/mysql.rb', line 24

def verify
  s3     = @config.fetch("s3", {})
  @name  = @config.fetch('_name')
  bucket = s3.fetch("bucket", "")
  path   = s3.fetch("path", "")
  date   = get_date_path()
  folder = "s3://#{bucket}/#{path}/#{@name}/#{date}/"
  $LOGGER.warn "Latest s3 path is: " + get_latest_s3(folder)
end