Class: HBase

Inherits:
Object
  • Object
show all
Defined in:
lib/hbase/cell.rb,
lib/hbase/hbase.rb,
lib/hbase/table.rb,
lib/hbase/record.rb

Defined Under Namespace

Classes: Cell, Record, Table

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ HBase

Returns a new instance of HBase.



4
5
6
# File 'lib/hbase/hbase.rb', line 4

def initialize *args
  @stargate = Stargate::Client.new *args
end

Instance Attribute Details

#stargateObject (readonly)

Returns the value of attribute stargate.



2
3
4
# File 'lib/hbase/hbase.rb', line 2

def stargate
  @stargate
end

Instance Method Details

#allObject Also known as: list



21
22
23
# File 'lib/hbase/hbase.rb', line 21

def all      
  stargate.list_tables
end

#create(*args) ⇒ Object



31
32
33
# File 'lib/hbase/hbase.rb', line 31

def create *args
  stargate.create_table *args
end

#delete(table_name) ⇒ Object



13
14
15
# File 'lib/hbase/hbase.rb', line 13

def delete table_name
  stargate.delete_table table_name
end

#disable(*args) ⇒ Object



35
36
37
# File 'lib/hbase/hbase.rb', line 35

def disable *args
  stargate.disable_table *args
end

#enable(*args) ⇒ Object



39
40
41
# File 'lib/hbase/hbase.rb', line 39

def enable *args
  stargate.enable_table *args
end

#get(table_name) ⇒ Object Also known as: []



8
9
10
# File 'lib/hbase/hbase.rb', line 8

def get table_name
  HBase::Table.new stargate, table_name
end

#include?(table_name) ⇒ Boolean Also known as: exist?

Returns:

  • (Boolean)


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

def include? table_name
  all.any?{|meta| meta.name == table_name}
end

#truncate(table_name) ⇒ Object



17
18
19
# File 'lib/hbase/hbase.rb', line 17

def truncate table_name
  stargate.truncate table_name
end