Class: BigRecord::ConnectionAdapters::HbaseRestAdapterTable
- Inherits:
-
Object
- Object
- BigRecord::ConnectionAdapters::HbaseRestAdapterTable
- Defined in:
- lib/big_record/connection_adapters/hbase_rest_adapter.rb
Class Method Summary
-
+ (Object) translate_to_adapter_format(options)
Given an column descriptor’s options hash from Bigrecord, translate it into the format for this adapter’s ColumnDescriptor.
Instance Method Summary
-
- (Object) [](name)
Returns a column family for the column with name name.
- - (Object) column_families_list
- - (Object) column_family(name, options = {}) (also: #family)
-
- (HbaseRestAdapterTable) initialize
constructor
A new instance of HbaseRestAdapterTable.
- - (Object) to_adapter_format
Constructor Details
- (HbaseRestAdapterTable) initialize
A new instance of HbaseRestAdapterTable
396 397 398 |
# File 'lib/big_record/connection_adapters/hbase_rest_adapter.rb', line 396 def initialize @column_families = [] end |
Class Method Details
+ (Object) translate_to_adapter_format(options)
Given an column descriptor’s options hash from Bigrecord, translate it into the format for this adapter’s ColumnDescriptor.
383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/big_record/connection_adapters/hbase_rest_adapter.rb', line 383 def self.translate_to_adapter_format() # Translating to the hbase-ruby column descriptor # TODO: Refactor this hbase_params = {} hbase_params[:name] = [:name].to_s if [:name] hbase_params[:compression] = [:compression] if [:compression] hbase_params[:max_versions] = [:versions] if [:versions] hbase_params[:bloomfilter] = [:bloom_filter] if [:bloom_filter] hbase_params end |
Instance Method Details
- (Object) [](name)
Returns a column family for the column with name name.
401 402 403 |
# File 'lib/big_record/connection_adapters/hbase_rest_adapter.rb', line 401 def [](name) @column_families.find {|column| column[:name].to_s == name.to_s} end |
- (Object) column_families_list
420 421 422 |
# File 'lib/big_record/connection_adapters/hbase_rest_adapter.rb', line 420 def column_families_list @column_families.map{|x| x[:name]}.join(", ") end |
- (Object) column_family(name, options = {}) Also known as: family
405 406 407 408 409 410 411 412 |
# File 'lib/big_record/connection_adapters/hbase_rest_adapter.rb', line 405 def column_family(name, = {}) hbase_params = self.class.translate_to_adapter_format(.merge({:name => name})) column = self[name] || hbase_params @column_families << column unless @column_families.include? column self end |
- (Object) to_adapter_format
416 417 418 |
# File 'lib/big_record/connection_adapters/hbase_rest_adapter.rb', line 416 def to_adapter_format @column_families end |