hbase-client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.9.1)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require_relative './hbase_types'
9
+
10
+ module HbaseClient
11
+ module Thrift
12
+ end
13
+ end
@@ -0,0 +1,330 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.9.1)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+
9
+ module HbaseClient
10
+ module Thrift
11
+ # TCell - Used to transport a cell value (byte[]) and the timestamp it was
12
+ # stored with together as a result for get and getRow methods. This promotes
13
+ # the timestamp of a cell to a first-class value, making it easy to take
14
+ # note of temporal data. Cell is used all the way from HStore up to HTable.
15
+ class TCell
16
+ include ::Thrift::Struct, ::Thrift::Struct_Union
17
+ VALUE = 1
18
+ TIMESTAMP = 2
19
+
20
+ FIELDS = {
21
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true},
22
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp'}
23
+ }
24
+
25
+ def struct_fields; FIELDS; end
26
+
27
+ def validate
28
+ end
29
+
30
+ ::Thrift::Struct.generate_accessors self
31
+ end
32
+
33
+ # An HColumnDescriptor contains information about a column family
34
+ # such as the number of versions, compression settings, etc. It is
35
+ # used as input when creating a table or adding a column.
36
+ class ColumnDescriptor
37
+ include ::Thrift::Struct, ::Thrift::Struct_Union
38
+ NAME = 1
39
+ MAXVERSIONS = 2
40
+ COMPRESSION = 3
41
+ INMEMORY = 4
42
+ BLOOMFILTERTYPE = 5
43
+ BLOOMFILTERVECTORSIZE = 6
44
+ BLOOMFILTERNBHASHES = 7
45
+ BLOCKCACHEENABLED = 8
46
+ TIMETOLIVE = 9
47
+
48
+ FIELDS = {
49
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
50
+ MAXVERSIONS => {:type => ::Thrift::Types::I32, :name => 'maxVersions', :default => 3},
51
+ COMPRESSION => {:type => ::Thrift::Types::STRING, :name => 'compression', :default => %q"NONE"},
52
+ INMEMORY => {:type => ::Thrift::Types::BOOL, :name => 'inMemory', :default => false},
53
+ BLOOMFILTERTYPE => {:type => ::Thrift::Types::STRING, :name => 'bloomFilterType', :default => %q"NONE"},
54
+ BLOOMFILTERVECTORSIZE => {:type => ::Thrift::Types::I32, :name => 'bloomFilterVectorSize', :default => 0},
55
+ BLOOMFILTERNBHASHES => {:type => ::Thrift::Types::I32, :name => 'bloomFilterNbHashes', :default => 0},
56
+ BLOCKCACHEENABLED => {:type => ::Thrift::Types::BOOL, :name => 'blockCacheEnabled', :default => false},
57
+ TIMETOLIVE => {:type => ::Thrift::Types::I32, :name => 'timeToLive', :default => 2147483647}
58
+ }
59
+
60
+ def struct_fields; FIELDS; end
61
+
62
+ def validate
63
+ end
64
+
65
+ ::Thrift::Struct.generate_accessors self
66
+ end
67
+
68
+ # A TRegionInfo contains information about an HTable region.
69
+ class TRegionInfo
70
+ include ::Thrift::Struct, ::Thrift::Struct_Union
71
+ STARTKEY = 1
72
+ ENDKEY = 2
73
+ ID = 3
74
+ NAME = 4
75
+ VERSION = 5
76
+ SERVERNAME = 6
77
+ PORT = 7
78
+
79
+ FIELDS = {
80
+ STARTKEY => {:type => ::Thrift::Types::STRING, :name => 'startKey', :binary => true},
81
+ ENDKEY => {:type => ::Thrift::Types::STRING, :name => 'endKey', :binary => true},
82
+ ID => {:type => ::Thrift::Types::I64, :name => 'id'},
83
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name', :binary => true},
84
+ VERSION => {:type => ::Thrift::Types::BYTE, :name => 'version'},
85
+ SERVERNAME => {:type => ::Thrift::Types::STRING, :name => 'serverName', :binary => true},
86
+ PORT => {:type => ::Thrift::Types::I32, :name => 'port'}
87
+ }
88
+
89
+ def struct_fields; FIELDS; end
90
+
91
+ def validate
92
+ end
93
+
94
+ ::Thrift::Struct.generate_accessors self
95
+ end
96
+
97
+ # A Mutation object is used to either update or delete a column-value.
98
+ class Mutation
99
+ include ::Thrift::Struct, ::Thrift::Struct_Union
100
+ ISDELETE = 1
101
+ COLUMN = 2
102
+ VALUE = 3
103
+ WRITETOWAL = 4
104
+
105
+ FIELDS = {
106
+ ISDELETE => {:type => ::Thrift::Types::BOOL, :name => 'isDelete', :default => false},
107
+ COLUMN => {:type => ::Thrift::Types::STRING, :name => 'column', :binary => true},
108
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :binary => true},
109
+ WRITETOWAL => {:type => ::Thrift::Types::BOOL, :name => 'writeToWAL', :default => true}
110
+ }
111
+
112
+ def struct_fields; FIELDS; end
113
+
114
+ def validate
115
+ end
116
+
117
+ ::Thrift::Struct.generate_accessors self
118
+ end
119
+
120
+ # A BatchMutation object is used to apply a number of Mutations to a single row.
121
+ class BatchMutation
122
+ include ::Thrift::Struct, ::Thrift::Struct_Union
123
+ ROW = 1
124
+ MUTATIONS = 2
125
+
126
+ FIELDS = {
127
+ ROW => {:type => ::Thrift::Types::STRING, :name => 'row', :binary => true},
128
+ MUTATIONS => {:type => ::Thrift::Types::LIST, :name => 'mutations', :element => {:type => ::Thrift::Types::STRUCT, :class => ::HbaseClient::Thrift::Mutation}}
129
+ }
130
+
131
+ def struct_fields; FIELDS; end
132
+
133
+ def validate
134
+ end
135
+
136
+ ::Thrift::Struct.generate_accessors self
137
+ end
138
+
139
+ # For increments that are not incrementColumnValue
140
+ # equivalents.
141
+ class TIncrement
142
+ include ::Thrift::Struct, ::Thrift::Struct_Union
143
+ TABLE = 1
144
+ ROW = 2
145
+ COLUMN = 3
146
+ AMMOUNT = 4
147
+
148
+ FIELDS = {
149
+ TABLE => {:type => ::Thrift::Types::STRING, :name => 'table', :binary => true},
150
+ ROW => {:type => ::Thrift::Types::STRING, :name => 'row', :binary => true},
151
+ COLUMN => {:type => ::Thrift::Types::STRING, :name => 'column', :binary => true},
152
+ AMMOUNT => {:type => ::Thrift::Types::I64, :name => 'ammount'}
153
+ }
154
+
155
+ def struct_fields; FIELDS; end
156
+
157
+ def validate
158
+ end
159
+
160
+ ::Thrift::Struct.generate_accessors self
161
+ end
162
+
163
+ # Holds column name and the cell.
164
+ class TColumn
165
+ include ::Thrift::Struct, ::Thrift::Struct_Union
166
+ COLUMNNAME = 1
167
+ CELL = 2
168
+
169
+ FIELDS = {
170
+ COLUMNNAME => {:type => ::Thrift::Types::STRING, :name => 'columnName', :binary => true},
171
+ CELL => {:type => ::Thrift::Types::STRUCT, :name => 'cell', :class => ::HbaseClient::Thrift::TCell}
172
+ }
173
+
174
+ def struct_fields; FIELDS; end
175
+
176
+ def validate
177
+ end
178
+
179
+ ::Thrift::Struct.generate_accessors self
180
+ end
181
+
182
+ # Holds row name and then a map of columns to cells.
183
+ class TRowResult
184
+ include ::Thrift::Struct, ::Thrift::Struct_Union
185
+ ROW = 1
186
+ COLUMNS = 2
187
+ SORTEDCOLUMNS = 3
188
+
189
+ FIELDS = {
190
+ ROW => {:type => ::Thrift::Types::STRING, :name => 'row', :binary => true},
191
+ COLUMNS => {:type => ::Thrift::Types::MAP, :name => 'columns', :key => {:type => ::Thrift::Types::STRING, :binary => true}, :value => {:type => ::Thrift::Types::STRUCT, :class => ::HbaseClient::Thrift::TCell}, :optional => true},
192
+ SORTEDCOLUMNS => {:type => ::Thrift::Types::LIST, :name => 'sortedColumns', :element => {:type => ::Thrift::Types::STRUCT, :class => ::HbaseClient::Thrift::TColumn}, :optional => true}
193
+ }
194
+
195
+ def struct_fields; FIELDS; end
196
+
197
+ def validate
198
+ end
199
+
200
+ ::Thrift::Struct.generate_accessors self
201
+ end
202
+
203
+ # A Scan object is used to specify scanner parameters when opening a scanner.
204
+ class TScan
205
+ include ::Thrift::Struct, ::Thrift::Struct_Union
206
+ STARTROW = 1
207
+ STOPROW = 2
208
+ TIMESTAMP = 3
209
+ COLUMNS = 4
210
+ CACHING = 5
211
+ FILTERSTRING = 6
212
+ BATCHSIZE = 7
213
+ SORTCOLUMNS = 8
214
+ REVERSED = 9
215
+
216
+ FIELDS = {
217
+ STARTROW => {:type => ::Thrift::Types::STRING, :name => 'startRow', :binary => true, :optional => true},
218
+ STOPROW => {:type => ::Thrift::Types::STRING, :name => 'stopRow', :binary => true, :optional => true},
219
+ TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp', :optional => true},
220
+ COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRING, :binary => true}, :optional => true},
221
+ CACHING => {:type => ::Thrift::Types::I32, :name => 'caching', :optional => true},
222
+ FILTERSTRING => {:type => ::Thrift::Types::STRING, :name => 'filterString', :binary => true, :optional => true},
223
+ BATCHSIZE => {:type => ::Thrift::Types::I32, :name => 'batchSize', :optional => true},
224
+ SORTCOLUMNS => {:type => ::Thrift::Types::BOOL, :name => 'sortColumns', :optional => true},
225
+ REVERSED => {:type => ::Thrift::Types::BOOL, :name => 'reversed', :optional => true}
226
+ }
227
+
228
+ def struct_fields; FIELDS; end
229
+
230
+ def validate
231
+ end
232
+
233
+ ::Thrift::Struct.generate_accessors self
234
+ end
235
+
236
+ # An Append object is used to specify the parameters for performing the append operation.
237
+ class TAppend
238
+ include ::Thrift::Struct, ::Thrift::Struct_Union
239
+ TABLE = 1
240
+ ROW = 2
241
+ COLUMNS = 3
242
+ VALUES = 4
243
+
244
+ FIELDS = {
245
+ TABLE => {:type => ::Thrift::Types::STRING, :name => 'table', :binary => true},
246
+ ROW => {:type => ::Thrift::Types::STRING, :name => 'row', :binary => true},
247
+ COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRING, :binary => true}},
248
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::STRING, :binary => true}}
249
+ }
250
+
251
+ def struct_fields; FIELDS; end
252
+
253
+ def validate
254
+ end
255
+
256
+ ::Thrift::Struct.generate_accessors self
257
+ end
258
+
259
+ # An IOError exception signals that an error occurred communicating
260
+ # to the Hbase master or an Hbase region server. Also used to return
261
+ # more general Hbase error conditions.
262
+ class IOError < ::Thrift::Exception
263
+ include ::Thrift::Struct, ::Thrift::Struct_Union
264
+ def initialize(message=nil)
265
+ super()
266
+ self.message = message
267
+ end
268
+
269
+ MESSAGE = 1
270
+
271
+ FIELDS = {
272
+ MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
273
+ }
274
+
275
+ def struct_fields; FIELDS; end
276
+
277
+ def validate
278
+ end
279
+
280
+ ::Thrift::Struct.generate_accessors self
281
+ end
282
+
283
+ # An IllegalArgument exception indicates an illegal or invalid
284
+ # argument was passed into a procedure.
285
+ class IllegalArgument < ::Thrift::Exception
286
+ include ::Thrift::Struct, ::Thrift::Struct_Union
287
+ def initialize(message=nil)
288
+ super()
289
+ self.message = message
290
+ end
291
+
292
+ MESSAGE = 1
293
+
294
+ FIELDS = {
295
+ MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
296
+ }
297
+
298
+ def struct_fields; FIELDS; end
299
+
300
+ def validate
301
+ end
302
+
303
+ ::Thrift::Struct.generate_accessors self
304
+ end
305
+
306
+ # An AlreadyExists exceptions signals that a table with the specified
307
+ # name already exists
308
+ class AlreadyExists < ::Thrift::Exception
309
+ include ::Thrift::Struct, ::Thrift::Struct_Union
310
+ def initialize(message=nil)
311
+ super()
312
+ self.message = message
313
+ end
314
+
315
+ MESSAGE = 1
316
+
317
+ FIELDS = {
318
+ MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
319
+ }
320
+
321
+ def struct_fields; FIELDS; end
322
+
323
+ def validate
324
+ end
325
+
326
+ ::Thrift::Struct.generate_accessors self
327
+ end
328
+
329
+ end
330
+ end
@@ -0,0 +1,3 @@
1
+ module HbaseClient
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,3 @@
1
+ server:
2
+ host: localhost
3
+ port: 9090
@@ -0,0 +1,14 @@
1
+ require 'yaml'
2
+ require 'test/unit'
3
+ require 'bundler/setup'
4
+ Bundler.require
5
+
6
+ ROOT = File.expand_path(File.dirname(__FILE__))
7
+
8
+ require_relative File.join(ROOT, %w{.. lib hbase-client})
9
+
10
+ CONFIG = YAML.load_file(File.join(ROOT, %w{fixtures config.yml}))
11
+
12
+ HbaseClient.configure(
13
+ logger: Logger.new($stdout)
14
+ )
@@ -0,0 +1,24 @@
1
+ require_relative '../../test_helper'
2
+
3
+ class TestTable < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @client = HbaseClient::Client.new(
7
+ host: CONFIG['server']['host'],
8
+ port: CONFIG['server']['port']
9
+ )
10
+ end
11
+
12
+ def test_list_tables
13
+ assert_nothing_raised do
14
+ @client.multi_exec do |conn|
15
+ conn.getTableNames
16
+ end
17
+ end
18
+
19
+ assert_nothing_raised do
20
+ @client.exec(:getTableNames)
21
+ end
22
+ end
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hbase-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Padden
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thrift
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thin
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ description: Hbase API Client
70
+ email:
71
+ - hypernova2002@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Readme.md
79
+ - hbase-client.gemspec
80
+ - lib/hbase-client.rb
81
+ - lib/hbase-client/adapters.rb
82
+ - lib/hbase-client/client.rb
83
+ - lib/hbase-client/config.rb
84
+ - lib/hbase-client/thrift/hbase.rb
85
+ - lib/hbase-client/thrift/hbase_constants.rb
86
+ - lib/hbase-client/thrift/hbase_types.rb
87
+ - lib/version.rb
88
+ - test/fixtures/config.yml.example
89
+ - test/test_helper.rb
90
+ - test/unit/thrift/test_table.rb
91
+ homepage: ''
92
+ licenses: []
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.2.2
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Connect to the hbase api interface
114
+ test_files:
115
+ - test/fixtures/config.yml.example
116
+ - test/test_helper.rb
117
+ - test/unit/thrift/test_table.rb