Module: Dolphin::DataStore
- Includes:
- Util
- Defined in:
- lib/dolphin.rb,
lib/dolphin/data_store.rb,
lib/dolphin/data_stores/mysql.rb,
lib/dolphin/data_stores/base_rdb.rb,
lib/dolphin/data_stores/cassandra.rb
Defined Under Namespace
Classes: BaseRdb, Cassandra, ConncetionBase, Mysql
Constant Summary collapse
- DATABASE =
'dolphin'.freeze
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Util
Class Method Details
.create(adapter) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dolphin/data_store.rb', line 15 def self.create(adapter) config = {} case adapter when :cassandra klass = Dolphin::DataStore::Cassandra config.merge!({ :keyspace => DATABASE, :hosts => Dolphin.settings['database']['hosts'], :port => Dolphin.settings['database']['port'], :max_retry_count => Dolphin.settings['database']['max_retry_count'].to_i, :retry_interval => Dolphin.settings['database']['retry_interval'].to_i }) when :mysql klass = Dolphin::DataStore::Mysql config.merge!({ :adapter => 'mysql2', :database => DATABASE, :host => Dolphin.settings['database']['host'], :port => Dolphin.settings['database']['port'], :user => Dolphin.settings['database']['user'], :password => Dolphin.settings['database']['password'], }) else raise NotImplementedError end klass.new(config) end |