Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hyper_record.rb,
lib/active_record/connection_adapters/hypertable_adapter.rb

Direct Known Subclasses

HyperBase

Class Method Summary collapse

Class Method Details

.hypertable_connection(config) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/active_record/connection_adapters/hypertable_adapter.rb', line 20

def self.hypertable_connection(config)
  config = config.symbolize_keys
  require_hypertable_thrift_client

  raise "Hypertable config missing :host in database.yml" if !config[:host]

  config[:host] ||= 'localhost'
  config[:port] ||= 38088
  config[:timeout] ||= 20000

  connection = Hypertable::ThriftClient.new(config[:host], config[:port], 
    config[:timeout])

  ConnectionAdapters::HypertableAdapter.new(connection, logger, config)
end

.inherited(child) ⇒ Object

:nodoc:



8
9
10
11
12
13
14
# File 'lib/hyper_record.rb', line 8

def self.inherited(child) #:nodoc:
  return if child == ActiveRecord::HyperBase

  @@subclasses[self] ||= []
  @@subclasses[self] << child
  super
end

.require_hypertable_thrift_clientObject



12
13
14
15
16
17
18
# File 'lib/active_record/connection_adapters/hypertable_adapter.rb', line 12

def self.require_hypertable_thrift_client
  # Include the thrift driver if one hasn't already been loaded
  unless defined? Hypertable::ThriftClient
    gem 'hypertable-thrift-client'
    require_dependency 'thrift_client'
  end
end