Sha256: 1041692f52baa81d7f99160b8d6e71790df9693f7179974b4d52147c07ef9344
Contents?: true
Size: 1.2 KB
Versions: 16
Compression:
Stored size: 1.2 KB
Contents
module EY module Backup class Database def initialize(engine, base_path, keep, backend, environment, name) if name.nil? || name.empty? raise ArgumentError, "database name is blank" end @engine = engine @base_path = base_path @keep = keep @backend = backend @environment = environment @name = name end attr_reader :name, :engine, :environment, :keep, :base_path def bucket_minder @backend.bucket_minder end def backups s3_objects = bucket_minder.list("#{@environment}.#{@name}").select { |o| o[:name] =~ @engine.suffix } s3_objects.map {|o| BackupSet.new(self, o[:name], nil, o[:keys]) }.sort end def dump FileUtils.mkdir_p(@base_path) basename = generate_basename file = @engine.dump(@name, basename) BackupSet.from(self, basename, file) end def start_upload(filenames) @backend.start_upload(filenames, @environment, @name) end def generate_basename "#{@base_path}/#{@name}.#{timestamp}" end def timestamp Time.now.strftime("%Y-%m-%dT%H-%M-%S") end end end end
Version data entries
16 entries across 16 versions & 1 rubygems