Module: ActiveColumn::Configuration

Included in:
ActiveColumn
Defined in:
lib/active_column/configuration.rb

Instance Method Summary collapse

Instance Method Details

#column_family_tasksObject



30
31
32
# File 'lib/active_column/configuration.rb', line 30

def column_family_tasks
  ActiveColumn::Tasks::ColumnFamily.new(@@keyspace)
end

#connect(config) ⇒ Object



5
6
7
8
9
10
# File 'lib/active_column/configuration.rb', line 5

def connect(config)
  default_thrift_options = { :timeout => 3, :retries => 2, :server_retry_period => nil }
  override_thrift_options = (config['thrift'] || {}).inject({}){|h, (k, v)| h[k.to_sym] = v; h} # symbolize keys
  thrift_options = default_thrift_options.merge(override_thrift_options)
  self.connection = Cassandra.new(config['keyspace'], config['servers'], thrift_options)
end

#connected?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/active_column/configuration.rb', line 12

def connected?
  defined? @@connection
end

#connectionObject



16
17
18
# File 'lib/active_column/configuration.rb', line 16

def connection
  @@connection
end

#connection=(connection) ⇒ Object



20
21
22
23
24
# File 'lib/active_column/configuration.rb', line 20

def connection=(connection)
  @@connection = connection
  @@keyspace_tasks = ActiveColumn::Tasks::Keyspace.new
  @@keyspace = connection.keyspace
end

#keyspace_tasksObject



26
27
28
# File 'lib/active_column/configuration.rb', line 26

def keyspace_tasks
  @@keyspace_tasks
end