hbase2-rb 1.2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +84 -0
- data/bin/console +14 -0
- data/hbase2-rb.gemspec +21 -0
- data/lib/hbase/hbase.thrift +559 -0
- data/lib/hbase/hbase_constants.rb +17 -0
- data/lib/hbase/hbase_types.rb +589 -0
- data/lib/hbase/t_h_base_service.rb +1263 -0
- data/lib/hbase2-rb.rb +13 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef5ce136b7d1e00d07eae4f04b527b4d6433ebb4
|
4
|
+
data.tar.gz: 1596f715f69c4ed394fa2cf7b9ff629eec8e7482
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 43b81c410a10d188d5b9abd3e8f8f47a4d6e5be1a037d5b5892ed3dc788e78252e9fb028f5154f0273e75a2dfde844dcd264dca6d13b1369447f67b1bbea4c53
|
7
|
+
data.tar.gz: 19b3294a94226235b2ee0bf149c2d0e64c56fe6b63a2ac03a09f173a67eb15be071652d74cd6a2b19d0d6f81ce466751589b5576a809ef3205738bee7660c36f
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hbase2-rb (1.2.0)
|
5
|
+
thrift (>= 0.9.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
rake (10.5.0)
|
11
|
+
thrift (0.9.3.0)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
hbase2-rb!
|
18
|
+
rake
|
19
|
+
|
20
|
+
BUNDLED WITH
|
21
|
+
1.10.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Emjay Kim
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Hbase Thrift2 interface for Ruby
|
2
|
+
|
3
|
+
inspired by https://github.com/highgroove/hbase-rb
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
### Bundler
|
8
|
+
|
9
|
+
Add to `Gemfile` and run `bundle install`:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'hbase2-rb'
|
13
|
+
```
|
14
|
+
|
15
|
+
### Without Bundler
|
16
|
+
|
17
|
+
Install the gem:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
gem install hbase2-rb
|
21
|
+
```
|
22
|
+
|
23
|
+
Require it explicitly in your scripts:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require "rubygems"
|
27
|
+
require "hbase2-rb"
|
28
|
+
```
|
29
|
+
|
30
|
+
## Versioning
|
31
|
+
|
32
|
+
The base version of the gem matches the version of HBase the interface was
|
33
|
+
generated against.
|
34
|
+
|
35
|
+
For instance, when using HBase 1.2.0:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
gem 'hbase-rb', '~> 1.2.0'
|
39
|
+
```
|
40
|
+
|
41
|
+
## Usage
|
42
|
+
|
43
|
+
For example:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
socket = Thrift::Socket.new('localhost', 9090)
|
47
|
+
|
48
|
+
transport = Thrift::BufferedTransport.new(socket)
|
49
|
+
transport.open
|
50
|
+
|
51
|
+
protocol = Thrift::BinaryProtocol.new(transport)
|
52
|
+
client = HBase2::Client.new(protocol)
|
53
|
+
```
|
54
|
+
|
55
|
+
## Writing Rows
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
# Assuming a table "mytable" and a column family "c"
|
59
|
+
column_value = HBase2::TColumnValue.new
|
60
|
+
column_value.family = 'c'
|
61
|
+
column_value.qualifier = 'foo'
|
62
|
+
column_value.value = 'bar'
|
63
|
+
put = HBase2::TPut.new row: 'abc123', columnValues: [column_value]
|
64
|
+
client.put('mytable', put)
|
65
|
+
```
|
66
|
+
|
67
|
+
## Reading Rows
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
# Assuming a table "mytable" and a column family "c"
|
71
|
+
get = HBase2::TGet.new row: 'abc123'
|
72
|
+
result = client.get('mytable', get)
|
73
|
+
if result.row
|
74
|
+
result.columnValues.each do |column|
|
75
|
+
puts "#{column.family}:#{column.qualifier} #{column.value}"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
## API Reference
|
81
|
+
|
82
|
+
* [Hbase/ThriftIDL](https://github.com/apache/hbase/blob/rel/1.2.0/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift)
|
83
|
+
* [Hbase/TestThriftService2Handler](https://github.com/apache/hbase/blob/rel/1.2.0/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java)
|
84
|
+
* [Hbase/ThriftService2Handler](https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.html)
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "hbase2-rb"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/hbase2-rb.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "hbase2-rb"
|
5
|
+
s.version = "1.2.0.1"
|
6
|
+
s.authors = ["Myungjun Kim"]
|
7
|
+
s.email = ["niduss@gmail.com"]
|
8
|
+
s.homepage = "http://github.com/mjkim/hbase2-rb"
|
9
|
+
s.summary = %q{Generated HBase Thrift bindings for Ruby packed into a gem}
|
10
|
+
s.description = %q{Everything you need to build a Ruby client for HBase}
|
11
|
+
s.license = "MIT"
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
|
18
|
+
s.add_dependency "thrift", "~> 0.9.3"
|
19
|
+
|
20
|
+
s.add_development_dependency "rake", "~> 10.0"
|
21
|
+
end
|