Class: EY::Backup::Engine

Inherits:
Base
  • Object
show all
Includes:
Spawner
Defined in:
lib/ey_backup/engine.rb

Direct Known Subclasses

MysqlEngine, Postgresql

Constant Summary

Constants included from Spawner

Spawner::CHUNK_SIZE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Spawner

#ioify, #run, #runs?, #spawn

Methods inherited from Base

#logger

Constructor Details

#initialize(username, password, host, key_id, force) ⇒ Engine

Returns a new instance of Engine.



29
30
31
# File 'lib/ey_backup/engine.rb', line 29

def initialize(username, password, host, key_id, force)
  @username, @password, @host, @key_id, @force  = username, password, host, key_id, force
end

Instance Attribute Details

#forceObject (readonly)

Returns the value of attribute force.



6
7
8
# File 'lib/ey_backup/engine.rb', line 6

def force
  @force
end

#hostObject (readonly)

Returns the value of attribute host.



6
7
8
# File 'lib/ey_backup/engine.rb', line 6

def host
  @host
end

#key_idObject (readonly)

Returns the value of attribute key_id.



6
7
8
# File 'lib/ey_backup/engine.rb', line 6

def key_id
  @key_id
end

#passwordObject (readonly)

Returns the value of attribute password.



6
7
8
# File 'lib/ey_backup/engine.rb', line 6

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



6
7
8
# File 'lib/ey_backup/engine.rb', line 6

def username
  @username
end

Class Method Details

.descendantsObject



16
17
18
# File 'lib/ey_backup/engine.rb', line 16

def self.descendants
  @descendants ||= []
end

.inherited(descendant) ⇒ Object



20
21
22
# File 'lib/ey_backup/engine.rb', line 20

def self.inherited(descendant)
  descendants << descendant
end

.labelObject



8
9
10
# File 'lib/ey_backup/engine.rb', line 8

def self.label
  @label
end

.lookup(label) ⇒ Object



24
25
26
27
# File 'lib/ey_backup/engine.rb', line 24

def self.lookup(label)
  descendants.detect {|d| d.label == label } ||
    EY::Backup.logger.fatal("Unknown database engine: #{label}")
end

.register(label) ⇒ Object



12
13
14
# File 'lib/ey_backup/engine.rb', line 12

def self.register(label)
  @label = label
end

Instance Method Details

#gpg?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/ey_backup/engine.rb', line 33

def gpg?
  !key_id.nil? && key_id != ""
end