Module: Deltacloud::Helpers::Database

Includes:
Drivers
Included in:
CIMI::Service::Base
Defined in:
lib/cimi/helpers/database_helper.rb

Constant Summary collapse

DATABASE_COLLECTIONS =
[ "machine_template", "address_template",
"volume_configuration", "volume_template" ]

Instance Method Summary collapse

Methods included from Drivers

#driver, #driver_class, #driver_class_name, #driver_name, #driver_source_name, #driver_symbol, included, #provider_name

Instance Method Details

#current_dbObject

This method allows to store things into database based on current driver and provider.


39
40
41
# File 'lib/cimi/helpers/database_helper.rb', line 39

def current_db
  Deltacloud::Database::Provider.lookup
end

#current_providerObject


31
32
33
# File 'lib/cimi/helpers/database_helper.rb', line 31

def current_provider
  Thread.current[:provider] || ENV['API_PROVIDER'] || 'default'
end

#provides?(entity) ⇒ Boolean

Returns:

  • (Boolean)

27
28
29
# File 'lib/cimi/helpers/database_helper.rb', line 27

def provides?(entity)
  DATABASE_COLLECTIONS.include? entity.to_s
end