Module: CassandraObject::Connection::ClassMethods
- Defined in:
- lib/cassandra_object/connection.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ servers: "127.0.0.1:9160", }
- DEFAULT_THRIFT_OPTIONS =
{ exception_class_overrides: [], }
Instance Method Summary collapse
-
#establish_connection(config) ⇒ Object
This doesn’t open a connection.
Instance Method Details
#establish_connection(config) ⇒ Object
This doesn’t open a connection. It merely conifgures the connection object.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cassandra_object/connection.rb', line 18 def establish_connection(config) spec = config.reverse_merge(DEFAULT_OPTIONS) spec[:thrift] = (spec[:thrift].try(:symbolize_keys) || {}).reverse_merge(DEFAULT_THRIFT_OPTIONS) spec[:thrift][:exception_class_overrides] = spec[:thrift][:exception_class_overrides].map(&:constantize) self.connection = Cassandra.new(spec[:keyspace], spec[:servers], spec[:thrift]) self.connection.disable_node_auto_discovery! if spec[:disable_node_auto_discovery] self.connection end |