hbase_thrift_ruby 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +4 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +20 -0
- data/README.md +35 -0
- data/Rakefile +30 -0
- data/VERSION +1 -0
- data/hbase_thrift_ruby.gemspec +47 -0
- data/lib/Hbase.thrift +914 -0
- data/lib/hbase/hbase.rb +2966 -0
- data/lib/hbase/hbase_constants.rb +14 -0
- data/lib/hbase/hbase_types.rb +282 -0
- data/lib/hbase_thrift_ruby.rb +59 -0
- data/spec/hbase_thrift_ruby_spec.rb +12 -0
- data/spec/spec_helper.rb +3 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bd4766094b7bfaf5f25c4657d81cc5b89ed8e9cd
|
4
|
+
data.tar.gz: d2b2d5f4b6e5d66cc095c0b7ed4b9c36774e787e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 36613d8bc62cfe640244e8c68133c195bae952165708720b9f567d37d8c20fd1ca6145ea5bfb808fdc903ec835bf63abca79405034779441bb7a46fb37cf5dbe
|
7
|
+
data.tar.gz: 65779346d14f444e227826c8ec5845752597dd061219b092a778a5096922012a6c2dff1d527a2ba8b38c916b700804d94bf85ebbb36135fcab194ba1fffd899f
|
data/.document
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Jean Lescure
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# HBase Thrift Ruby
|
2
|
+
|
3
|
+
A gemified Ruby wrapper for Thrift's implementation of HBase.
|
4
|
+
|
5
|
+
Made specifically to be used with Thrift 1.0.0
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
`gem install hbase_thrift_ruby`
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Create a table:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'rubygems'
|
17
|
+
require 'hbase_thrift_ruby'
|
18
|
+
|
19
|
+
host = 'my.hadoop-master-node.com'
|
20
|
+
port = 9090
|
21
|
+
|
22
|
+
socket = Thrift::Socket.new(host, port)
|
23
|
+
transport = Thrift::BufferedTransport.new(socket)
|
24
|
+
transport.open
|
25
|
+
protocol = Thrift::BinaryProtocol.new(transport)
|
26
|
+
|
27
|
+
client = HBase::Client.new(protocol)
|
28
|
+
|
29
|
+
columns = []
|
30
|
+
col_descriptor = Hbase::ColumnDescriptor.new
|
31
|
+
col_descriptor.name = 'test'
|
32
|
+
columns << col_descriptor
|
33
|
+
|
34
|
+
client.createTable('test_table',columns)
|
35
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rake'
|
13
|
+
require 'rspec/core/rake_task'
|
14
|
+
|
15
|
+
task :default => [:spec]
|
16
|
+
desc "Run the specs."
|
17
|
+
RSpec::Core::RakeTask.new do |t|
|
18
|
+
t.pattern = "spec/**/*_spec.rb"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rdoc/task'
|
22
|
+
Rake::RDocTask.new do |rdoc|
|
23
|
+
require 'jfish'
|
24
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
25
|
+
|
26
|
+
rdoc.rdoc_dir = 'rdoc'
|
27
|
+
rdoc.generator = 'jfish'
|
28
|
+
rdoc.title = "hbase_thrift_ruby #{version}"
|
29
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
30
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.0
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "hbase_thrift_ruby"
|
5
|
+
s.version = "0.9.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jean Lescure"]
|
9
|
+
s.date = "2014-03-13"
|
10
|
+
s.description = "This is an updated HBase wrapper based on Thrift 1.0.0, gemified and ready to be used with Ruby."
|
11
|
+
s.email = "jeanmlescure@gmail.com"
|
12
|
+
s.extra_rdoc_files = [
|
13
|
+
"LICENSE.txt",
|
14
|
+
"README.md"
|
15
|
+
]
|
16
|
+
s.files = Dir.glob("{lib,spec}/**/*") + %w(.document Gemfile LICENSE.txt README.md Rakefile VERSION hbase_thrift_ruby.gemspec)
|
17
|
+
s.homepage = "http://github.com/jeanlescure/hbase_thrift_ruby"
|
18
|
+
s.licenses = ["MIT"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.rubygems_version = "2.0.3"
|
21
|
+
s.summary = "Simplified HBase Thrift API wrapper for Ruby."
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
s.specification_version = 4
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
+
s.add_runtime_dependency(%q<jml_thrift>, [">= 0"])
|
28
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
29
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
30
|
+
s.add_development_dependency(%q<rdoc>, ["~> 4.0.0"])
|
31
|
+
s.add_development_dependency(%q<jfish>, [">= 0.1.1"])
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<jml_thrift>, [">= 0"])
|
34
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
35
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
36
|
+
s.add_dependency(%q<rdoc>, ["~> 4.0.0"])
|
37
|
+
s.add_dependency(%q<jfish>, [">= 0.1.1"])
|
38
|
+
end
|
39
|
+
else
|
40
|
+
s.add_dependency(%q<jml_thrift>, [">= 0"])
|
41
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
42
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
43
|
+
s.add_dependency(%q<rdoc>, ["~> 4.0.0"])
|
44
|
+
s.add_dependency(%q<jfish>, [">= 0.1.1"])
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
data/lib/Hbase.thrift
ADDED
@@ -0,0 +1,914 @@
|
|
1
|
+
/*
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
4
|
+
* distributed with this work for additional information
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
7
|
+
* "License"); you may not use this file except in compliance
|
8
|
+
* with the License. You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
* See the License for the specific language governing permissions and
|
16
|
+
* limitations under the License.
|
17
|
+
*/
|
18
|
+
|
19
|
+
// ----------------------------------------------------------------
|
20
|
+
// Hbase.thrift
|
21
|
+
//
|
22
|
+
// This is a Thrift interface definition file for the Hbase service.
|
23
|
+
// Target language libraries for C++, Java, Ruby, PHP, (and more) are
|
24
|
+
// generated by running this file through the Thrift compiler with the
|
25
|
+
// appropriate flags. The Thrift compiler binary and runtime
|
26
|
+
// libraries for various languages are available
|
27
|
+
// from the Apache Incubator (http://incubator.apache.org/thrift/)
|
28
|
+
//
|
29
|
+
// See the package.html file for information on the version of Thrift
|
30
|
+
// used to generate the *.java files checked into the Hbase project.
|
31
|
+
// ----------------------------------------------------------------
|
32
|
+
|
33
|
+
namespace java org.apache.hadoop.hbase.thrift.generated
|
34
|
+
namespace cpp apache.hadoop.hbase.thrift
|
35
|
+
namespace rb Apache.Hadoop.Hbase.Thrift
|
36
|
+
namespace py hbase
|
37
|
+
namespace perl Hbase
|
38
|
+
|
39
|
+
//
|
40
|
+
// Types
|
41
|
+
//
|
42
|
+
|
43
|
+
// NOTE: all variables with the Text type are assumed to be correctly
|
44
|
+
// formatted UTF-8 strings. This is a programming language and locale
|
45
|
+
// dependent property that the client application is repsonsible for
|
46
|
+
// maintaining. If strings with an invalid encoding are sent, an
|
47
|
+
// IOError will be thrown.
|
48
|
+
|
49
|
+
typedef binary Text
|
50
|
+
typedef binary Bytes
|
51
|
+
typedef i32 ScannerID
|
52
|
+
|
53
|
+
/**
|
54
|
+
* TCell - Used to transport a cell value (byte[]) and the timestamp it was
|
55
|
+
* stored with together as a result for get and getRow methods. This promotes
|
56
|
+
* the timestamp of a cell to a first-class value, making it easy to take
|
57
|
+
* note of temporal data. Cell is used all the way from HStore up to HTable.
|
58
|
+
*/
|
59
|
+
struct TCell{
|
60
|
+
1:Bytes value,
|
61
|
+
2:i64 timestamp
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* An HColumnDescriptor contains information about a column family
|
66
|
+
* such as the number of versions, compression settings, etc. It is
|
67
|
+
* used as input when creating a table or adding a column.
|
68
|
+
*/
|
69
|
+
struct ColumnDescriptor {
|
70
|
+
1:Text name,
|
71
|
+
2:i32 maxVersions = 3,
|
72
|
+
3:string compression = "NONE",
|
73
|
+
4:bool inMemory = 0,
|
74
|
+
5:string bloomFilterType = "NONE",
|
75
|
+
6:i32 bloomFilterVectorSize = 0,
|
76
|
+
7:i32 bloomFilterNbHashes = 0,
|
77
|
+
8:bool blockCacheEnabled = 0,
|
78
|
+
9:i32 timeToLive = -1
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* A TRegionInfo contains information about an HTable region.
|
83
|
+
*/
|
84
|
+
struct TRegionInfo {
|
85
|
+
1:Text startKey,
|
86
|
+
2:Text endKey,
|
87
|
+
3:i64 id,
|
88
|
+
4:Text name,
|
89
|
+
5:byte version,
|
90
|
+
6:Text serverName,
|
91
|
+
7:i32 port
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* A Mutation object is used to either update or delete a column-value.
|
96
|
+
*/
|
97
|
+
struct Mutation {
|
98
|
+
1:bool isDelete = 0,
|
99
|
+
2:Text column,
|
100
|
+
3:Text value,
|
101
|
+
4:bool writeToWAL = 1
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
/**
|
106
|
+
* A BatchMutation object is used to apply a number of Mutations to a single row.
|
107
|
+
*/
|
108
|
+
struct BatchMutation {
|
109
|
+
1:Text row,
|
110
|
+
2:list<Mutation> mutations
|
111
|
+
}
|
112
|
+
|
113
|
+
/**
|
114
|
+
* For increments that are not incrementColumnValue
|
115
|
+
* equivalents.
|
116
|
+
*/
|
117
|
+
struct TIncrement {
|
118
|
+
1:Text table,
|
119
|
+
2:Text row,
|
120
|
+
3:Text column,
|
121
|
+
4:i64 ammount
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Holds row name and then a map of columns to cells.
|
126
|
+
*/
|
127
|
+
struct TRowResult {
|
128
|
+
1:Text row,
|
129
|
+
2:map<Text, TCell> columns
|
130
|
+
}
|
131
|
+
|
132
|
+
/**
|
133
|
+
* A Scan object is used to specify scanner parameters when opening a scanner.
|
134
|
+
*/
|
135
|
+
struct TScan {
|
136
|
+
1:optional Text startRow,
|
137
|
+
2:optional Text stopRow,
|
138
|
+
3:optional i64 timestamp,
|
139
|
+
4:optional list<Text> columns,
|
140
|
+
5:optional i32 caching,
|
141
|
+
6:optional Text filterString
|
142
|
+
}
|
143
|
+
|
144
|
+
//
|
145
|
+
// Exceptions
|
146
|
+
//
|
147
|
+
/**
|
148
|
+
* An IOError exception signals that an error occurred communicating
|
149
|
+
* to the Hbase master or an Hbase region server. Also used to return
|
150
|
+
* more general Hbase error conditions.
|
151
|
+
*/
|
152
|
+
exception IOError {
|
153
|
+
1:string message
|
154
|
+
}
|
155
|
+
|
156
|
+
/**
|
157
|
+
* An IllegalArgument exception indicates an illegal or invalid
|
158
|
+
* argument was passed into a procedure.
|
159
|
+
*/
|
160
|
+
exception IllegalArgument {
|
161
|
+
1:string message
|
162
|
+
}
|
163
|
+
|
164
|
+
/**
|
165
|
+
* An AlreadyExists exceptions signals that a table with the specified
|
166
|
+
* name already exists
|
167
|
+
*/
|
168
|
+
exception AlreadyExists {
|
169
|
+
1:string message
|
170
|
+
}
|
171
|
+
|
172
|
+
//
|
173
|
+
// Service
|
174
|
+
//
|
175
|
+
|
176
|
+
service Hbase {
|
177
|
+
/**
|
178
|
+
* Brings a table on-line (enables it)
|
179
|
+
*/
|
180
|
+
void enableTable(
|
181
|
+
/** name of the table */
|
182
|
+
1:Bytes tableName
|
183
|
+
) throws (1:IOError io)
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Disables a table (takes it off-line) If it is being served, the master
|
187
|
+
* will tell the servers to stop serving it.
|
188
|
+
*/
|
189
|
+
void disableTable(
|
190
|
+
/** name of the table */
|
191
|
+
1:Bytes tableName
|
192
|
+
) throws (1:IOError io)
|
193
|
+
|
194
|
+
/**
|
195
|
+
* @return true if table is on-line
|
196
|
+
*/
|
197
|
+
bool isTableEnabled(
|
198
|
+
/** name of the table to check */
|
199
|
+
1:Bytes tableName
|
200
|
+
) throws (1:IOError io)
|
201
|
+
|
202
|
+
void compact(1:Bytes tableNameOrRegionName)
|
203
|
+
throws (1:IOError io)
|
204
|
+
|
205
|
+
void majorCompact(1:Bytes tableNameOrRegionName)
|
206
|
+
throws (1:IOError io)
|
207
|
+
|
208
|
+
/**
|
209
|
+
* List all the userspace tables.
|
210
|
+
*
|
211
|
+
* @return returns a list of names
|
212
|
+
*/
|
213
|
+
list<Text> getTableNames()
|
214
|
+
throws (1:IOError io)
|
215
|
+
|
216
|
+
/**
|
217
|
+
* List all the column families assoicated with a table.
|
218
|
+
*
|
219
|
+
* @return list of column family descriptors
|
220
|
+
*/
|
221
|
+
map<Text,ColumnDescriptor> getColumnDescriptors (
|
222
|
+
/** table name */
|
223
|
+
1:Text tableName
|
224
|
+
) throws (1:IOError io)
|
225
|
+
|
226
|
+
/**
|
227
|
+
* List the regions associated with a table.
|
228
|
+
*
|
229
|
+
* @return list of region descriptors
|
230
|
+
*/
|
231
|
+
list<TRegionInfo> getTableRegions(
|
232
|
+
/** table name */
|
233
|
+
1:Text tableName)
|
234
|
+
throws (1:IOError io)
|
235
|
+
|
236
|
+
/**
|
237
|
+
* Create a table with the specified column families. The name
|
238
|
+
* field for each ColumnDescriptor must be set and must end in a
|
239
|
+
* colon (:). All other fields are optional and will get default
|
240
|
+
* values if not explicitly specified.
|
241
|
+
*
|
242
|
+
* @throws IllegalArgument if an input parameter is invalid
|
243
|
+
*
|
244
|
+
* @throws AlreadyExists if the table name already exists
|
245
|
+
*/
|
246
|
+
void createTable(
|
247
|
+
/** name of table to create */
|
248
|
+
1:Text tableName,
|
249
|
+
|
250
|
+
/** list of column family descriptors */
|
251
|
+
2:list<ColumnDescriptor> columnFamilies
|
252
|
+
) throws (1:IOError io, 2:IllegalArgument ia, 3:AlreadyExists exist)
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Deletes a table
|
256
|
+
*
|
257
|
+
* @throws IOError if table doesn't exist on server or there was some other
|
258
|
+
* problem
|
259
|
+
*/
|
260
|
+
void deleteTable(
|
261
|
+
/** name of table to delete */
|
262
|
+
1:Text tableName
|
263
|
+
) throws (1:IOError io)
|
264
|
+
|
265
|
+
/**
|
266
|
+
* Get a single TCell for the specified table, row, and column at the
|
267
|
+
* latest timestamp. Returns an empty list if no such value exists.
|
268
|
+
*
|
269
|
+
* @return value for specified row/column
|
270
|
+
*/
|
271
|
+
list<TCell> get(
|
272
|
+
/** name of table */
|
273
|
+
1:Text tableName,
|
274
|
+
|
275
|
+
/** row key */
|
276
|
+
2:Text row,
|
277
|
+
|
278
|
+
/** column name */
|
279
|
+
3:Text column,
|
280
|
+
|
281
|
+
/** Get attributes */
|
282
|
+
4:map<Text, Text> attributes
|
283
|
+
) throws (1:IOError io)
|
284
|
+
|
285
|
+
/**
|
286
|
+
* Get the specified number of versions for the specified table,
|
287
|
+
* row, and column.
|
288
|
+
*
|
289
|
+
* @return list of cells for specified row/column
|
290
|
+
*/
|
291
|
+
list<TCell> getVer(
|
292
|
+
/** name of table */
|
293
|
+
1:Text tableName,
|
294
|
+
|
295
|
+
/** row key */
|
296
|
+
2:Text row,
|
297
|
+
|
298
|
+
/** column name */
|
299
|
+
3:Text column,
|
300
|
+
|
301
|
+
/** number of versions to retrieve */
|
302
|
+
4:i32 numVersions,
|
303
|
+
|
304
|
+
/** Get attributes */
|
305
|
+
5:map<Text, Text> attributes
|
306
|
+
) throws (1:IOError io)
|
307
|
+
|
308
|
+
/**
|
309
|
+
* Get the specified number of versions for the specified table,
|
310
|
+
* row, and column. Only versions less than or equal to the specified
|
311
|
+
* timestamp will be returned.
|
312
|
+
*
|
313
|
+
* @return list of cells for specified row/column
|
314
|
+
*/
|
315
|
+
list<TCell> getVerTs(
|
316
|
+
/** name of table */
|
317
|
+
1:Text tableName,
|
318
|
+
|
319
|
+
/** row key */
|
320
|
+
2:Text row,
|
321
|
+
|
322
|
+
/** column name */
|
323
|
+
3:Text column,
|
324
|
+
|
325
|
+
/** timestamp */
|
326
|
+
4:i64 timestamp,
|
327
|
+
|
328
|
+
/** number of versions to retrieve */
|
329
|
+
5:i32 numVersions,
|
330
|
+
|
331
|
+
/** Get attributes */
|
332
|
+
6:map<Text, Text> attributes
|
333
|
+
) throws (1:IOError io)
|
334
|
+
|
335
|
+
/**
|
336
|
+
* Get all the data for the specified table and row at the latest
|
337
|
+
* timestamp. Returns an empty list if the row does not exist.
|
338
|
+
*
|
339
|
+
* @return TRowResult containing the row and map of columns to TCells
|
340
|
+
*/
|
341
|
+
list<TRowResult> getRow(
|
342
|
+
/** name of table */
|
343
|
+
1:Text tableName,
|
344
|
+
|
345
|
+
/** row key */
|
346
|
+
2:Text row,
|
347
|
+
|
348
|
+
/** Get attributes */
|
349
|
+
3:map<Text, Text> attributes
|
350
|
+
) throws (1:IOError io)
|
351
|
+
|
352
|
+
/**
|
353
|
+
* Get the specified columns for the specified table and row at the latest
|
354
|
+
* timestamp. Returns an empty list if the row does not exist.
|
355
|
+
*
|
356
|
+
* @return TRowResult containing the row and map of columns to TCells
|
357
|
+
*/
|
358
|
+
list<TRowResult> getRowWithColumns(
|
359
|
+
/** name of table */
|
360
|
+
1:Text tableName,
|
361
|
+
|
362
|
+
/** row key */
|
363
|
+
2:Text row,
|
364
|
+
|
365
|
+
/** List of columns to return, null for all columns */
|
366
|
+
3:list<Text> columns,
|
367
|
+
|
368
|
+
/** Get attributes */
|
369
|
+
4:map<Text, Text> attributes
|
370
|
+
) throws (1:IOError io)
|
371
|
+
|
372
|
+
/**
|
373
|
+
* Get all the data for the specified table and row at the specified
|
374
|
+
* timestamp. Returns an empty list if the row does not exist.
|
375
|
+
*
|
376
|
+
* @return TRowResult containing the row and map of columns to TCells
|
377
|
+
*/
|
378
|
+
list<TRowResult> getRowTs(
|
379
|
+
/** name of the table */
|
380
|
+
1:Text tableName,
|
381
|
+
|
382
|
+
/** row key */
|
383
|
+
2:Text row,
|
384
|
+
|
385
|
+
/** timestamp */
|
386
|
+
3:i64 timestamp,
|
387
|
+
|
388
|
+
/** Get attributes */
|
389
|
+
4:map<Text, Text> attributes
|
390
|
+
) throws (1:IOError io)
|
391
|
+
|
392
|
+
/**
|
393
|
+
* Get the specified columns for the specified table and row at the specified
|
394
|
+
* timestamp. Returns an empty list if the row does not exist.
|
395
|
+
*
|
396
|
+
* @return TRowResult containing the row and map of columns to TCells
|
397
|
+
*/
|
398
|
+
list<TRowResult> getRowWithColumnsTs(
|
399
|
+
/** name of table */
|
400
|
+
1:Text tableName,
|
401
|
+
|
402
|
+
/** row key */
|
403
|
+
2:Text row,
|
404
|
+
|
405
|
+
/** List of columns to return, null for all columns */
|
406
|
+
3:list<Text> columns,
|
407
|
+
4:i64 timestamp,
|
408
|
+
|
409
|
+
/** Get attributes */
|
410
|
+
5:map<Text, Text> attributes
|
411
|
+
) throws (1:IOError io)
|
412
|
+
|
413
|
+
/**
|
414
|
+
* Get all the data for the specified table and rows at the latest
|
415
|
+
* timestamp. Returns an empty list if no rows exist.
|
416
|
+
*
|
417
|
+
* @return TRowResult containing the rows and map of columns to TCells
|
418
|
+
*/
|
419
|
+
list<TRowResult> getRows(
|
420
|
+
/** name of table */
|
421
|
+
1:Text tableName,
|
422
|
+
|
423
|
+
/** row keys */
|
424
|
+
2:list<Text> rows
|
425
|
+
|
426
|
+
/** Get attributes */
|
427
|
+
3:map<Text, Text> attributes
|
428
|
+
) throws (1:IOError io)
|
429
|
+
|
430
|
+
/**
|
431
|
+
* Get the specified columns for the specified table and rows at the latest
|
432
|
+
* timestamp. Returns an empty list if no rows exist.
|
433
|
+
*
|
434
|
+
* @return TRowResult containing the rows and map of columns to TCells
|
435
|
+
*/
|
436
|
+
list<TRowResult> getRowsWithColumns(
|
437
|
+
/** name of table */
|
438
|
+
1:Text tableName,
|
439
|
+
|
440
|
+
/** row keys */
|
441
|
+
2:list<Text> rows,
|
442
|
+
|
443
|
+
/** List of columns to return, null for all columns */
|
444
|
+
3:list<Text> columns,
|
445
|
+
|
446
|
+
/** Get attributes */
|
447
|
+
4:map<Text, Text> attributes
|
448
|
+
) throws (1:IOError io)
|
449
|
+
|
450
|
+
/**
|
451
|
+
* Get all the data for the specified table and rows at the specified
|
452
|
+
* timestamp. Returns an empty list if no rows exist.
|
453
|
+
*
|
454
|
+
* @return TRowResult containing the rows and map of columns to TCells
|
455
|
+
*/
|
456
|
+
list<TRowResult> getRowsTs(
|
457
|
+
/** name of the table */
|
458
|
+
1:Text tableName,
|
459
|
+
|
460
|
+
/** row keys */
|
461
|
+
2:list<Text> rows
|
462
|
+
|
463
|
+
/** timestamp */
|
464
|
+
3:i64 timestamp,
|
465
|
+
|
466
|
+
/** Get attributes */
|
467
|
+
4:map<Text, Text> attributes
|
468
|
+
) throws (1:IOError io)
|
469
|
+
|
470
|
+
/**
|
471
|
+
* Get the specified columns for the specified table and rows at the specified
|
472
|
+
* timestamp. Returns an empty list if no rows exist.
|
473
|
+
*
|
474
|
+
* @return TRowResult containing the rows and map of columns to TCells
|
475
|
+
*/
|
476
|
+
list<TRowResult> getRowsWithColumnsTs(
|
477
|
+
/** name of table */
|
478
|
+
1:Text tableName,
|
479
|
+
|
480
|
+
/** row keys */
|
481
|
+
2:list<Text> rows
|
482
|
+
|
483
|
+
/** List of columns to return, null for all columns */
|
484
|
+
3:list<Text> columns,
|
485
|
+
4:i64 timestamp,
|
486
|
+
|
487
|
+
/** Get attributes */
|
488
|
+
5:map<Text, Text> attributes
|
489
|
+
) throws (1:IOError io)
|
490
|
+
|
491
|
+
/**
|
492
|
+
* Apply a series of mutations (updates/deletes) to a row in a
|
493
|
+
* single transaction. If an exception is thrown, then the
|
494
|
+
* transaction is aborted. Default current timestamp is used, and
|
495
|
+
* all entries will have an identical timestamp.
|
496
|
+
*/
|
497
|
+
void mutateRow(
|
498
|
+
/** name of table */
|
499
|
+
1:Text tableName,
|
500
|
+
|
501
|
+
/** row key */
|
502
|
+
2:Text row,
|
503
|
+
|
504
|
+
/** list of mutation commands */
|
505
|
+
3:list<Mutation> mutations,
|
506
|
+
|
507
|
+
/** Mutation attributes */
|
508
|
+
4:map<Text, Text> attributes
|
509
|
+
) throws (1:IOError io, 2:IllegalArgument ia)
|
510
|
+
|
511
|
+
/**
|
512
|
+
* Apply a series of mutations (updates/deletes) to a row in a
|
513
|
+
* single transaction. If an exception is thrown, then the
|
514
|
+
* transaction is aborted. The specified timestamp is used, and
|
515
|
+
* all entries will have an identical timestamp.
|
516
|
+
*/
|
517
|
+
void mutateRowTs(
|
518
|
+
/** name of table */
|
519
|
+
1:Text tableName,
|
520
|
+
|
521
|
+
/** row key */
|
522
|
+
2:Text row,
|
523
|
+
|
524
|
+
/** list of mutation commands */
|
525
|
+
3:list<Mutation> mutations,
|
526
|
+
|
527
|
+
/** timestamp */
|
528
|
+
4:i64 timestamp,
|
529
|
+
|
530
|
+
/** Mutation attributes */
|
531
|
+
5:map<Text, Text> attributes
|
532
|
+
) throws (1:IOError io, 2:IllegalArgument ia)
|
533
|
+
|
534
|
+
/**
|
535
|
+
* Apply a series of batches (each a series of mutations on a single row)
|
536
|
+
* in a single transaction. If an exception is thrown, then the
|
537
|
+
* transaction is aborted. Default current timestamp is used, and
|
538
|
+
* all entries will have an identical timestamp.
|
539
|
+
*/
|
540
|
+
void mutateRows(
|
541
|
+
/** name of table */
|
542
|
+
1:Text tableName,
|
543
|
+
|
544
|
+
/** list of row batches */
|
545
|
+
2:list<BatchMutation> rowBatches,
|
546
|
+
|
547
|
+
/** Mutation attributes */
|
548
|
+
3:map<Text, Text> attributes
|
549
|
+
) throws (1:IOError io, 2:IllegalArgument ia)
|
550
|
+
|
551
|
+
/**
|
552
|
+
* Apply a series of batches (each a series of mutations on a single row)
|
553
|
+
* in a single transaction. If an exception is thrown, then the
|
554
|
+
* transaction is aborted. The specified timestamp is used, and
|
555
|
+
* all entries will have an identical timestamp.
|
556
|
+
*/
|
557
|
+
void mutateRowsTs(
|
558
|
+
/** name of table */
|
559
|
+
1:Text tableName,
|
560
|
+
|
561
|
+
/** list of row batches */
|
562
|
+
2:list<BatchMutation> rowBatches,
|
563
|
+
|
564
|
+
/** timestamp */
|
565
|
+
3:i64 timestamp,
|
566
|
+
|
567
|
+
/** Mutation attributes */
|
568
|
+
4:map<Text, Text> attributes
|
569
|
+
) throws (1:IOError io, 2:IllegalArgument ia)
|
570
|
+
|
571
|
+
/**
|
572
|
+
* Atomically increment the column value specified. Returns the next value post increment.
|
573
|
+
*/
|
574
|
+
i64 atomicIncrement(
|
575
|
+
/** name of table */
|
576
|
+
1:Text tableName,
|
577
|
+
|
578
|
+
/** row to increment */
|
579
|
+
2:Text row,
|
580
|
+
|
581
|
+
/** name of column */
|
582
|
+
3:Text column,
|
583
|
+
|
584
|
+
/** amount to increment by */
|
585
|
+
4:i64 value
|
586
|
+
) throws (1:IOError io, 2:IllegalArgument ia)
|
587
|
+
|
588
|
+
/**
|
589
|
+
* Delete all cells that match the passed row and column.
|
590
|
+
*/
|
591
|
+
void deleteAll(
|
592
|
+
/** name of table */
|
593
|
+
1:Text tableName,
|
594
|
+
|
595
|
+
/** Row to update */
|
596
|
+
2:Text row,
|
597
|
+
|
598
|
+
/** name of column whose value is to be deleted */
|
599
|
+
3:Text column,
|
600
|
+
|
601
|
+
/** Delete attributes */
|
602
|
+
4:map<Text, Text> attributes
|
603
|
+
) throws (1:IOError io)
|
604
|
+
|
605
|
+
/**
|
606
|
+
* Delete all cells that match the passed row and column and whose
|
607
|
+
* timestamp is equal-to or older than the passed timestamp.
|
608
|
+
*/
|
609
|
+
void deleteAllTs(
|
610
|
+
/** name of table */
|
611
|
+
1:Text tableName,
|
612
|
+
|
613
|
+
/** Row to update */
|
614
|
+
2:Text row,
|
615
|
+
|
616
|
+
/** name of column whose value is to be deleted */
|
617
|
+
3:Text column,
|
618
|
+
|
619
|
+
/** timestamp */
|
620
|
+
4:i64 timestamp,
|
621
|
+
|
622
|
+
/** Delete attributes */
|
623
|
+
5:map<Text, Text> attributes
|
624
|
+
) throws (1:IOError io)
|
625
|
+
|
626
|
+
/**
|
627
|
+
* Completely delete the row's cells.
|
628
|
+
*/
|
629
|
+
void deleteAllRow(
|
630
|
+
/** name of table */
|
631
|
+
1:Text tableName,
|
632
|
+
|
633
|
+
/** key of the row to be completely deleted. */
|
634
|
+
2:Text row,
|
635
|
+
|
636
|
+
/** Delete attributes */
|
637
|
+
3:map<Text, Text> attributes
|
638
|
+
) throws (1:IOError io)
|
639
|
+
|
640
|
+
/**
|
641
|
+
* Increment a cell by the ammount.
|
642
|
+
* Increments can be applied async if hbase.regionserver.thrift.coalesceIncrement is set to true.
|
643
|
+
* False is the default. Turn to true if you need the extra performance and can accept some
|
644
|
+
* data loss if a thrift server dies with increments still in the queue.
|
645
|
+
*/
|
646
|
+
void increment(
|
647
|
+
/** The single increment to apply */
|
648
|
+
1:TIncrement increment
|
649
|
+
) throws (1:IOError io)
|
650
|
+
|
651
|
+
|
652
|
+
void incrementRows(
|
653
|
+
/** The list of increments */
|
654
|
+
1:list<TIncrement> increments
|
655
|
+
) throws (1:IOError io)
|
656
|
+
|
657
|
+
/**
|
658
|
+
* Completely delete the row's cells marked with a timestamp
|
659
|
+
* equal-to or older than the passed timestamp.
|
660
|
+
*/
|
661
|
+
void deleteAllRowTs(
|
662
|
+
/** name of table */
|
663
|
+
1:Text tableName,
|
664
|
+
|
665
|
+
/** key of the row to be completely deleted. */
|
666
|
+
2:Text row,
|
667
|
+
|
668
|
+
/** timestamp */
|
669
|
+
3:i64 timestamp,
|
670
|
+
|
671
|
+
/** Delete attributes */
|
672
|
+
4:map<Text, Text> attributes
|
673
|
+
) throws (1:IOError io)
|
674
|
+
|
675
|
+
/**
|
676
|
+
* Get a scanner on the current table, using the Scan instance
|
677
|
+
* for the scan parameters.
|
678
|
+
*/
|
679
|
+
ScannerID scannerOpenWithScan(
|
680
|
+
/** name of table */
|
681
|
+
1:Text tableName,
|
682
|
+
|
683
|
+
/** Scan instance */
|
684
|
+
2:TScan scan,
|
685
|
+
|
686
|
+
/** Scan attributes */
|
687
|
+
3:map<Text, Text> attributes
|
688
|
+
) throws (1:IOError io)
|
689
|
+
|
690
|
+
/**
|
691
|
+
* Get a scanner on the current table starting at the specified row and
|
692
|
+
* ending at the last row in the table. Return the specified columns.
|
693
|
+
*
|
694
|
+
* @return scanner id to be used with other scanner procedures
|
695
|
+
*/
|
696
|
+
ScannerID scannerOpen(
|
697
|
+
/** name of table */
|
698
|
+
1:Text tableName,
|
699
|
+
|
700
|
+
/**
|
701
|
+
* Starting row in table to scan.
|
702
|
+
* Send "" (empty string) to start at the first row.
|
703
|
+
*/
|
704
|
+
2:Text startRow,
|
705
|
+
|
706
|
+
/**
|
707
|
+
* columns to scan. If column name is a column family, all
|
708
|
+
* columns of the specified column family are returned. It's also possible
|
709
|
+
* to pass a regex in the column qualifier.
|
710
|
+
*/
|
711
|
+
3:list<Text> columns,
|
712
|
+
|
713
|
+
/** Scan attributes */
|
714
|
+
4:map<Text, Text> attributes
|
715
|
+
) throws (1:IOError io)
|
716
|
+
|
717
|
+
/**
|
718
|
+
* Get a scanner on the current table starting and stopping at the
|
719
|
+
* specified rows. ending at the last row in the table. Return the
|
720
|
+
* specified columns.
|
721
|
+
*
|
722
|
+
* @return scanner id to be used with other scanner procedures
|
723
|
+
*/
|
724
|
+
ScannerID scannerOpenWithStop(
|
725
|
+
/** name of table */
|
726
|
+
1:Text tableName,
|
727
|
+
|
728
|
+
/**
|
729
|
+
* Starting row in table to scan.
|
730
|
+
* Send "" (empty string) to start at the first row.
|
731
|
+
*/
|
732
|
+
2:Text startRow,
|
733
|
+
|
734
|
+
/**
|
735
|
+
* row to stop scanning on. This row is *not* included in the
|
736
|
+
* scanner's results
|
737
|
+
*/
|
738
|
+
3:Text stopRow,
|
739
|
+
|
740
|
+
/**
|
741
|
+
* columns to scan. If column name is a column family, all
|
742
|
+
* columns of the specified column family are returned. It's also possible
|
743
|
+
* to pass a regex in the column qualifier.
|
744
|
+
*/
|
745
|
+
4:list<Text> columns,
|
746
|
+
|
747
|
+
/** Scan attributes */
|
748
|
+
5:map<Text, Text> attributes
|
749
|
+
) throws (1:IOError io)
|
750
|
+
|
751
|
+
/**
|
752
|
+
* Open a scanner for a given prefix. That is all rows will have the specified
|
753
|
+
* prefix. No other rows will be returned.
|
754
|
+
*
|
755
|
+
* @return scanner id to use with other scanner calls
|
756
|
+
*/
|
757
|
+
ScannerID scannerOpenWithPrefix(
|
758
|
+
/** name of table */
|
759
|
+
1:Text tableName,
|
760
|
+
|
761
|
+
/** the prefix (and thus start row) of the keys you want */
|
762
|
+
2:Text startAndPrefix,
|
763
|
+
|
764
|
+
/** the columns you want returned */
|
765
|
+
3:list<Text> columns,
|
766
|
+
|
767
|
+
/** Scan attributes */
|
768
|
+
4:map<Text, Text> attributes
|
769
|
+
) throws (1:IOError io)
|
770
|
+
|
771
|
+
/**
|
772
|
+
* Get a scanner on the current table starting at the specified row and
|
773
|
+
* ending at the last row in the table. Return the specified columns.
|
774
|
+
* Only values with the specified timestamp are returned.
|
775
|
+
*
|
776
|
+
* @return scanner id to be used with other scanner procedures
|
777
|
+
*/
|
778
|
+
ScannerID scannerOpenTs(
|
779
|
+
/** name of table */
|
780
|
+
1:Text tableName,
|
781
|
+
|
782
|
+
/**
|
783
|
+
* Starting row in table to scan.
|
784
|
+
* Send "" (empty string) to start at the first row.
|
785
|
+
*/
|
786
|
+
2:Text startRow,
|
787
|
+
|
788
|
+
/**
|
789
|
+
* columns to scan. If column name is a column family, all
|
790
|
+
* columns of the specified column family are returned. It's also possible
|
791
|
+
* to pass a regex in the column qualifier.
|
792
|
+
*/
|
793
|
+
3:list<Text> columns,
|
794
|
+
|
795
|
+
/** timestamp */
|
796
|
+
4:i64 timestamp,
|
797
|
+
|
798
|
+
/** Scan attributes */
|
799
|
+
5:map<Text, Text> attributes
|
800
|
+
) throws (1:IOError io)
|
801
|
+
|
802
|
+
/**
|
803
|
+
* Get a scanner on the current table starting and stopping at the
|
804
|
+
* specified rows. ending at the last row in the table. Return the
|
805
|
+
* specified columns. Only values with the specified timestamp are
|
806
|
+
* returned.
|
807
|
+
*
|
808
|
+
* @return scanner id to be used with other scanner procedures
|
809
|
+
*/
|
810
|
+
ScannerID scannerOpenWithStopTs(
|
811
|
+
/** name of table */
|
812
|
+
1:Text tableName,
|
813
|
+
|
814
|
+
/**
|
815
|
+
* Starting row in table to scan.
|
816
|
+
* Send "" (empty string) to start at the first row.
|
817
|
+
*/
|
818
|
+
2:Text startRow,
|
819
|
+
|
820
|
+
/**
|
821
|
+
* row to stop scanning on. This row is *not* included in the
|
822
|
+
* scanner's results
|
823
|
+
*/
|
824
|
+
3:Text stopRow,
|
825
|
+
|
826
|
+
/**
|
827
|
+
* columns to scan. If column name is a column family, all
|
828
|
+
* columns of the specified column family are returned. It's also possible
|
829
|
+
* to pass a regex in the column qualifier.
|
830
|
+
*/
|
831
|
+
4:list<Text> columns,
|
832
|
+
|
833
|
+
/** timestamp */
|
834
|
+
5:i64 timestamp,
|
835
|
+
|
836
|
+
/** Scan attributes */
|
837
|
+
6:map<Text, Text> attributes
|
838
|
+
) throws (1:IOError io)
|
839
|
+
|
840
|
+
/**
|
841
|
+
* Returns the scanner's current row value and advances to the next
|
842
|
+
* row in the table. When there are no more rows in the table, or a key
|
843
|
+
* greater-than-or-equal-to the scanner's specified stopRow is reached,
|
844
|
+
* an empty list is returned.
|
845
|
+
*
|
846
|
+
* @return a TRowResult containing the current row and a map of the columns to TCells.
|
847
|
+
*
|
848
|
+
* @throws IllegalArgument if ScannerID is invalid
|
849
|
+
*
|
850
|
+
* @throws NotFound when the scanner reaches the end
|
851
|
+
*/
|
852
|
+
list<TRowResult> scannerGet(
|
853
|
+
/** id of a scanner returned by scannerOpen */
|
854
|
+
1:ScannerID id
|
855
|
+
) throws (1:IOError io, 2:IllegalArgument ia)
|
856
|
+
|
857
|
+
/**
|
858
|
+
* Returns, starting at the scanner's current row value nbRows worth of
|
859
|
+
* rows and advances to the next row in the table. When there are no more
|
860
|
+
* rows in the table, or a key greater-than-or-equal-to the scanner's
|
861
|
+
* specified stopRow is reached, an empty list is returned.
|
862
|
+
*
|
863
|
+
* @return a TRowResult containing the current row and a map of the columns to TCells.
|
864
|
+
*
|
865
|
+
* @throws IllegalArgument if ScannerID is invalid
|
866
|
+
*
|
867
|
+
* @throws NotFound when the scanner reaches the end
|
868
|
+
*/
|
869
|
+
list<TRowResult> scannerGetList(
|
870
|
+
/** id of a scanner returned by scannerOpen */
|
871
|
+
1:ScannerID id,
|
872
|
+
|
873
|
+
/** number of results to return */
|
874
|
+
2:i32 nbRows
|
875
|
+
) throws (1:IOError io, 2:IllegalArgument ia)
|
876
|
+
|
877
|
+
/**
|
878
|
+
* Closes the server-state associated with an open scanner.
|
879
|
+
*
|
880
|
+
* @throws IllegalArgument if ScannerID is invalid
|
881
|
+
*/
|
882
|
+
void scannerClose(
|
883
|
+
/** id of a scanner returned by scannerOpen */
|
884
|
+
1:ScannerID id
|
885
|
+
) throws (1:IOError io, 2:IllegalArgument ia)
|
886
|
+
|
887
|
+
/**
|
888
|
+
* Get the row just before the specified one.
|
889
|
+
*
|
890
|
+
* @return value for specified row/column
|
891
|
+
*/
|
892
|
+
list<TCell> getRowOrBefore(
|
893
|
+
/** name of table */
|
894
|
+
1:Text tableName,
|
895
|
+
|
896
|
+
/** row key */
|
897
|
+
2:Text row,
|
898
|
+
|
899
|
+
/** column name */
|
900
|
+
3:Text family
|
901
|
+
) throws (1:IOError io)
|
902
|
+
|
903
|
+
/**
|
904
|
+
* Get the regininfo for the specified row. It scans
|
905
|
+
* the metatable to find region's start and end keys.
|
906
|
+
*
|
907
|
+
* @return value for specified row/column
|
908
|
+
*/
|
909
|
+
TRegionInfo getRegionInfo(
|
910
|
+
/** row key */
|
911
|
+
1:Text row,
|
912
|
+
|
913
|
+
) throws (1:IOError io)
|
914
|
+
}
|