Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/hyper_record.rb,
lib/active_record/connection_adapters/hypertable_adapter.rb
Direct Known Subclasses
Class Method Summary collapse
-
.hypertable_connection(config) ⇒ Object
Establishes a connection to the Thrift Broker (which brokers requests to Hypertable itself. The connection details must appear in config/database.yml. e.g., hypertable_dev: host: localhost port: 38088 timeout: 20000.
-
.inherited(child) ⇒ Object
:nodoc:.
-
.require_hypertable_thrift_client ⇒ Object
Include the thrift driver if one hasn’t already been loaded.
Class Method Details
.hypertable_connection(config) ⇒ Object
Establishes a connection to the Thrift Broker (which brokers requests to Hypertable itself. The connection details must appear in config/database.yml. e.g., hypertable_dev:
host: localhost
port: 38088
timeout: 20000
Options:
-
:host
- Defaults to localhost -
:port
- Defaults to 38088 -
:timeout
- Timeout for queries in milliseconds. Defaults to 20000
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/active_record/connection_adapters/hypertable_adapter.rb', line 48 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 config[:namespace] ||= '/' 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_client ⇒ Object
Include the thrift driver if one hasn’t already been loaded
29 30 31 32 33 34 |
# File 'lib/active_record/connection_adapters/hypertable_adapter.rb', line 29 def self.require_hypertable_thrift_client unless defined? Hypertable::ThriftClient gem 'hypertable-thrift-client' require_dependency 'thrift_client' end end |