9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/active_record/connection_adapters/cassandra_adapter.rb', line 9
def self.cassandra_connection(config)
config.symbolize_keys!
host = config[:host] || '127.0.0.1'
port = config[:port] || 9160
unless (keyspace = config[:keyspace] || config[:database])
raise ArgumentError, "No database file specified. Missing argument: keyspace"
end
thrift_client_options = config.dup
[:adapter, :host, :port, :keyspace, :database].each {|i| thrift_client_options.delete(i) }
client = Cassandra.new(keyspace, "#{host}:#{port}", thrift_client_options)
ConnectionAdapters::CassandraAdapter.new(client, logger, config)
end
|