sishen-hbase-ruby 0.4.6 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'hoe'
3
3
 
4
- Hoe.new('sishen-hbase-ruby', '0.4.6') do |p|
4
+ Hoe.new('sishen-hbase-ruby', '0.5.0') do |p|
5
5
  p.rubyforge_name = 'sishen-hbase-ruby'
6
6
  p.author = 'Ye Dingding'
7
7
  p.email = 'yedingding@gmail.com'
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{hbase-ruby}
3
- s.version = "0.4.6"
3
+ s.version = "0.5.0"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Ye Dingding"]
@@ -4,6 +4,7 @@ module HBase
4
4
  attr_accessor :table_name
5
5
  attr_accessor :name
6
6
  attr_accessor :timestamp
7
+ attr_accessor :total_count
7
8
  attr_accessor :columns
8
9
  end
9
10
  end
@@ -13,10 +13,10 @@ module HBase
13
13
  raise NotImplementedError, "Currently not supported in native hbase client"
14
14
  end
15
15
 
16
- def show_row(table_name, name, timestamp = nil, columns = nil, version = nil)
16
+ def show_row(table_name, name, timestamp = nil, columns = nil, options = { })
17
17
  begin
18
18
  request = Request::RowRequest.new(table_name, name, timestamp)
19
- row = Response::RowResponse.new(get(request.show(columns, version))).parse
19
+ row = Response::RowResponse.new(get(request.show(columns, options))).parse
20
20
  row.table_name = table_name
21
21
  row.name = name
22
22
  row.timestamp = timestamp
@@ -113,6 +113,8 @@ module HBase
113
113
  arg.each do |k,v|
114
114
  if Model::ColumnDescriptor::AVAILABLE_OPTS.include? k
115
115
  xml_data << "<#{Model::ColumnDescriptor::AVAILABLE_OPTS[k]}>#{v}</#{Model::ColumnDescriptor::AVAILABLE_OPTS[k]}>"
116
+ else
117
+ xml_data << "<metadata><name>#{k}</name><value>#{v}</value></metadata>"
116
118
  end
117
119
  end
118
120
  xml_data << "</columnfamily>"
@@ -12,10 +12,12 @@ module HBase
12
12
  super(path)
13
13
  end
14
14
 
15
- def show(columns = nil, version = nil)
15
+ def show(columns = nil, options = { })
16
16
  if columns
17
17
  @path << "?#{pack_params(columns)}"
18
- @path << "&version=#{version}" if version
18
+ @path << "&version=#{options[:version]}" if options[:version]
19
+ @path << "&offset=#{options[:offset]}" if options[:offset]
20
+ @path << "&limit=#{options[:limit]}" if options[:limit]
19
21
  end
20
22
  @path
21
23
  end
@@ -5,6 +5,7 @@ module HBase
5
5
  doc = REXML::Document.new(raw_data)
6
6
  row = doc.elements["row"]
7
7
  columns = []
8
+ count = row.elements["count"].text.strip.to_i rescue 0
8
9
  row.elements.each("column") do |col|
9
10
  name = col.elements["name"].text.strip.unpack("m").first
10
11
  value = col.elements["value"].text.strip.unpack("m").first rescue nil
@@ -13,7 +14,7 @@ module HBase
13
14
  :value => value,
14
15
  :timestamp => timestamp)
15
16
  end
16
- Model::Row.new(:columns => columns)
17
+ Model::Row.new(:total_count => count, :columns => columns)
17
18
  end
18
19
  end
19
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sishen-hbase-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ye Dingding