Class: SDBTools::Database
- Inherits:
-
Object
- Object
- SDBTools::Database
- Defined in:
- lib/sdbtools/database.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#sdb ⇒ Object
readonly
Returns the value of attribute sdb.
Instance Method Summary collapse
- #create_domain(domain_name) ⇒ Object
- #delete_domain(domain_name) ⇒ Object
- #domain(domain_name) ⇒ Object
- #domain_exists?(domain_name) ⇒ Boolean
- #domains ⇒ Object
-
#initialize(access_key = nil, secret_key = nil, options = {}) ⇒ Database
constructor
A new instance of Database.
- #make_dump(domain, filename) ⇒ Object
- #make_load(domain, filename) ⇒ Object
Constructor Details
#initialize(access_key = nil, secret_key = nil, options = {}) ⇒ Database
Returns a new instance of Database.
6 7 8 9 10 11 12 |
# File 'lib/sdbtools/database.rb', line 6 def initialize(access_key=nil, secret_key=nil, ={}) @logger = ([:logger] ||= ::Logger.new($stderr)) @sdb = MeasuredSdbInterface.new( .delete(:sdb_interface) { Aws::SdbInterface.new(access_key, secret_key, ) }) end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
4 5 6 |
# File 'lib/sdbtools/database.rb', line 4 def logger @logger end |
#sdb ⇒ Object (readonly)
Returns the value of attribute sdb.
3 4 5 |
# File 'lib/sdbtools/database.rb', line 3 def sdb @sdb end |
Instance Method Details
#create_domain(domain_name) ⇒ Object
30 31 32 33 |
# File 'lib/sdbtools/database.rb', line 30 def create_domain(domain_name) @sdb.create_domain(domain_name) domain(domain_name) end |
#delete_domain(domain_name) ⇒ Object
35 36 37 |
# File 'lib/sdbtools/database.rb', line 35 def delete_domain(domain_name) @sdb.delete_domain(domain_name) end |
#domain(domain_name) ⇒ Object
22 23 24 |
# File 'lib/sdbtools/database.rb', line 22 def domain(domain_name) Domain.new(@sdb, domain_name) end |
#domain_exists?(domain_name) ⇒ Boolean
26 27 28 |
# File 'lib/sdbtools/database.rb', line 26 def domain_exists?(domain_name) domains.include?(domain_name) end |
#domains ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/sdbtools/database.rb', line 14 def domains domains_op = Operation.new(@sdb, :list_domains, nil) domains_op.inject([]) {|domains, (results, operation)| domains.concat(results[:domains]) domains } end |