class BigRecord::ConnectionAdapters::HbaseRestAdapterTable

Public Class Methods

new() click to toggle source
# File lib/big_record/connection_adapters/hbase_rest_adapter.rb, line 396
def initialize
  @column_families = []
end
translate_to_adapter_format(options) click to toggle source

Given an column descriptor's options hash from Bigrecord, translate it into the format for this adapter's ColumnDescriptor.

# File lib/big_record/connection_adapters/hbase_rest_adapter.rb, line 383
def self.translate_to_adapter_format(options)
  # Translating to the hbase-ruby column descriptor
  # TODO: Refactor this
  hbase_params = {}

  hbase_params[:name] = options[:name].to_s if options[:name]
  hbase_params[:compression] = options[:compression] if options[:compression]
  hbase_params[:max_versions] = options[:versions] if options[:versions]
  hbase_params[:bloomfilter] = options[:bloom_filter] if options[:bloom_filter]

  hbase_params
end

Public Instance Methods

[](name) click to toggle source

Returns a column family for the column with name name.

# 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
column_families_list() click to toggle source
# File lib/big_record/connection_adapters/hbase_rest_adapter.rb, line 420
def column_families_list
  @column_families.map{|x| x[:name]}.join(", ")
end
column_family(name, options = {}) click to toggle source
# File lib/big_record/connection_adapters/hbase_rest_adapter.rb, line 405
def column_family(name, options = {})
  hbase_params = self.class.translate_to_adapter_format(options.merge({:name => name}))

  column = self[name] || hbase_params

  @column_families << column unless @column_families.include? column
  self
end
Also aliased as: family
family(name, options = {})
Alias for: column_family
to_adapter_format() click to toggle source
# File lib/big_record/connection_adapters/hbase_rest_adapter.rb, line 416
def to_adapter_format
  @column_families
end