sishen-hbase-ruby 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.txt CHANGED
@@ -1,15 +1,26 @@
1
- hbase-ruby is a pure ruby client for HBase using REST interface
1
+ hbase-ruby is a pure ruby client for HBase (http://hadoop.apache.org/hbase). It works with the most recent version of HBase REST interface.
2
2
 
3
- == USAGE
3
+ == INSTALLTION
4
4
 
5
- First launch HBase:
5
+ $gem sources -a http://gems.github.com
6
+ $gem install sishen-hbase-ruby
6
7
 
7
- 1.
8
+ For those who wants to use hbase in their rails application, can add this line to the environment.rb:
8
9
  {{{
9
- bin/start-hbase.sh
10
+ config.gem 'sishen-hbase-ruby', :lib => "hbase", :source => "http://gems.github.com"
10
11
  }}}
11
12
 
12
- 2. ruby code
13
+ To build the gem yourself:
14
+
15
+ $rake gem
16
+
17
+ == USAGE
18
+
19
+ First download the recent version of hbase (svn checkout http://svn.apache.org/repos/asf/hadoop/hbase/trunk hbase), compile it with 'ant', then launch HBase server:
20
+
21
+ $bin/start-hbase.sh
22
+
23
+ Here is the example:
13
24
  {{{
14
25
  require 'hbase'
15
26
 
@@ -27,25 +38,7 @@ row2 = client.create_row('users', 'sishen', Time.now.to_i, {:name => 'habbit:foo
27
38
  client.delete_row('users', 'sishen', nil, 'habbit:football') # delete the row 'sishen' of table 'users' with the optional column 'habbit:football'
28
39
  }}}
29
40
 
30
- 3. rails config
31
-
32
- For those who wants to use hbase in their rails application, can add this line to the environment.rb
33
-
34
- {{{
35
- config.gem 'sishen-hbase-ruby', :lib => "hbase", :source => "http://gems.github.com"
36
- }}}
37
-
38
-
39
- == INSTALLTION
40
- build the gem:
41
-
42
- rake gem
43
-
44
- and install the versioned gem:
45
-
46
- gem install pkg/hbase-ruby-x.x.x.gem
47
-
48
41
  == Copyright
49
42
 
50
- Copyright (c) 2007 Dingding Ye <yedingding@gmail.com>
43
+ Copyright (c) 2008 Dingding Ye <yedingding@gmail.com>
51
44
  Distributed under MIT License
data/hbase-ruby.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{hbase-ruby}
3
- s.version = "0.4.0"
3
+ s.version = "0.4.1"
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"]
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.description = %q{hbase-ruby is a pure ruby client for hbase and enable the ruby app enjoy the power of HBase}
9
9
  s.email = %q{yedingding@gmail.com}
10
10
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
11
- s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "hbase-ruby.gemspec", "lib/hbase.rb", "lib/hbase/client.rb", "lib/hbase/exception.rb", "lib/hbase/model.rb", "lib/hbase/model/column.rb", "lib/hbase/model/column_descriptor.rb", "lib/hbase/model/region_descriptor.rb", "lib/hbase/model/row.rb", "lib/hbase/model/table_descriptor.rb", "lib/hbase/operation/meta_operation.rb", "lib/hbase/operation/row_operation.rb", "lib/hbase/operation/scanner_operation.rb", "lib/hbase/operation/table_operation.rb", "lib/hbase/request.rb", "lib/hbase/request/basic_request.rb", "lib/hbase/request/meta_request.rb", "lib/hbase/request/row_request.rb", "lib/hbase/request/scanner_request.rb", "lib/hbase/request/table_request.rb", "lib/hbase/response.rb", "lib/hbase/response/basic_response.rb", "lib/hbase/response/meta_response.rb", "lib/hbase/response/row_response.rb", "lib/hbase/response/table_response.rb"]
11
+ s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "hbase-ruby.gemspec", "lib/hbase.rb", "lib/hbase/client.rb", "lib/hbase/exception.rb", "lib/hbase/model.rb", "lib/hbase/model/column.rb", "lib/hbase/model/column_descriptor.rb", "lib/hbase/model/region_descriptor.rb", "lib/hbase/model/row.rb", "lib/hbase/model/table_descriptor.rb", "lib/hbase/model/scanner.rb", "lib/hbase/operation/meta_operation.rb", "lib/hbase/operation/row_operation.rb", "lib/hbase/operation/scanner_operation.rb", "lib/hbase/operation/table_operation.rb", "lib/hbase/request.rb", "lib/hbase/request/basic_request.rb", "lib/hbase/request/meta_request.rb", "lib/hbase/request/row_request.rb", "lib/hbase/request/scanner_request.rb", "lib/hbase/request/table_request.rb", "lib/hbase/response.rb", "lib/hbase/response/basic_response.rb", "lib/hbase/response/meta_response.rb", "lib/hbase/response/row_response.rb", "lib/hbase/response/table_response.rb", "lib/hbase/response/scanner_response.rb"]
12
12
  s.has_rdoc = true
13
13
  s.homepage = %q{http://sishen.lifegoo.com}
14
14
  s.rdoc_options = ["--main", "README.txt"]
@@ -0,0 +1,8 @@
1
+ module HBase
2
+ module Model
3
+ class Scanner < Record
4
+ attr_accessor :table_name
5
+ attr_accessor :scanner_id
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,30 @@
1
+ module HBase
2
+ module Response
3
+ class ScannerResponse < BasicResponse
4
+ def parse_content(raw_data)
5
+ doc = REXML::Document.new(raw_data)
6
+ rows = []
7
+ doc.elements.each("row") do |row|
8
+ row_name = row.elements["name"].text.strip.unpack("m").first
9
+ columns = []
10
+ row.elements.each("column") do |col|
11
+ name = col.elements["name"].text.strip.unpack("m").first
12
+ value = col.elements["value"].text.strip.unpack("m").first
13
+ timestamp = col.elements["timestamp"].text.strip.to_i
14
+ columns << Model::Column.new(:name => name,
15
+ :value => value,
16
+ :timestamp => timestamp)
17
+ end
18
+ rows << Model::Row.new(:name => row_name, :columns => columns)
19
+ end
20
+ rows
21
+ end
22
+
23
+ def get_scanner_id
24
+ location = @raw_data['location']
25
+ paths = location.split('/')
26
+ Model::Scanner.new(:table_name => paths[2], :scanner_id => paths[4])
27
+ end
28
+ end
29
+ end
30
+ 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.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ye Dingding
@@ -47,6 +47,7 @@ files:
47
47
  - lib/hbase/model/region_descriptor.rb
48
48
  - lib/hbase/model/row.rb
49
49
  - lib/hbase/model/table_descriptor.rb
50
+ - lib/hbase/model/scanner.rb
50
51
  - lib/hbase/operation/meta_operation.rb
51
52
  - lib/hbase/operation/row_operation.rb
52
53
  - lib/hbase/operation/scanner_operation.rb
@@ -62,6 +63,7 @@ files:
62
63
  - lib/hbase/response/meta_response.rb
63
64
  - lib/hbase/response/row_response.rb
64
65
  - lib/hbase/response/table_response.rb
66
+ - lib/hbase/response/scanner_response.rb
65
67
  has_rdoc: true
66
68
  homepage: http://sishen.lifegoo.com
67
69
  post_install_message: