Module: CassandraObject::AsyncConnection::ClassMethods

Defined in:
lib/cassandra_object/async_connection.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  servers: "127.0.0.1:9160",
}
DEFAULT_THRIFT_OPTIONS =
{
  exception_class_overrides: [],
}

Instance Method Summary collapse

Instance Method Details

#establish_connection(config) ⇒ Object

This doesn’t open a connection. It merely conifgures the connection object.



63
64
65
66
67
68
69
70
# File 'lib/cassandra_object/async_connection.rb', line 63

def establish_connection(config)
  spec = config.reverse_merge(DEFAULT_OPTIONS)

  spec[:thrift] = (spec[:thrift] || {}).reverse_merge(DEFAULT_THRIFT_OPTIONS)
  spec[:thrift][:exception_class_overrides] = spec[:thrift][:exception_class_overrides].map(&:constantize)

  self.connection_spec = spec
end