-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhbase.thrift
More file actions
515 lines (447 loc) · 13.8 KB
/
hbase.thrift
File metadata and controls
515 lines (447 loc) · 13.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// NOTE: The "required" and "optional" keywords for the service methods are purely for documentation
namespace java org.apache.hadoop.hbase.thrift2.generated
namespace cpp apache.hadoop.hbase.thrift2
namespace rb Apache.Hadoop.Hbase.Thrift2
namespace py hbase
namespace perl Hbase
struct TTimeRange {
1: required i64 minStamp,
2: required i64 maxStamp
}
/**
* Addresses a single cell or multiple cells
* in a HBase table by column family and optionally
* a column qualifier and timestamp
*/
struct TColumn {
1: required binary family,
2: optional binary qualifier,
3: optional i64 timestamp
}
/**
* Represents a single cell and its value.
*/
struct TColumnValue {
1: required binary family,
2: required binary qualifier,
3: required binary value,
4: optional i64 timestamp,
5: optional binary tags
}
/**
* Represents a single cell and the amount to increment it by
*/
struct TColumnIncrement {
1: required binary family,
2: required binary qualifier,
3: optional i64 amount = 1
}
/**
* if no Result is found, row and columnValues will not be set.
*/
struct TResult {
1: optional binary row,
2: required list<TColumnValue> columnValues
}
/**
* Specify type of delete:
* - DELETE_COLUMN means exactly one version will be removed,
* - DELETE_COLUMNS means previous versions will also be removed.
*/
enum TDeleteType {
DELETE_COLUMN = 0,
DELETE_COLUMNS = 1
}
/**
* Specify Durability:
* - SKIP_WAL means do not write the Mutation to the WAL.
* - ASYNC_WAL means write the Mutation to the WAL asynchronously,
* - SYNC_WAL means write the Mutation to the WAL synchronously,
* - FSYNC_WAL means Write the Mutation to the WAL synchronously and force the entries to disk.
*/
enum TDurability {
SKIP_WAL = 1,
ASYNC_WAL = 2,
SYNC_WAL = 3,
FSYNC_WAL = 4
}
struct TAuthorization {
1: optional list<string> labels
}
struct TCellVisibility {
1: optional string expression
}
/**
* Used to perform Get operations on a single row.
*
* The scope can be further narrowed down by specifying a list of
* columns or column families.
*
* To get everything for a row, instantiate a Get object with just the row to get.
* To further define the scope of what to get you can add a timestamp or time range
* with an optional maximum number of versions to return.
*
* If you specify a time range and a timestamp the range is ignored.
* Timestamps on TColumns are ignored.
*/
struct TGet {
1: required binary row,
2: optional list<TColumn> columns,
3: optional i64 timestamp,
4: optional TTimeRange timeRange,
5: optional i32 maxVersions,
6: optional binary filterString,
7: optional map<binary, binary> attributes
8: optional TAuthorization authorizations
}
/**
* Used to perform Put operations for a single row.
*
* Add column values to this object and they'll be added.
* You can provide a default timestamp if the column values
* don't have one. If you don't provide a default timestamp
* the current time is inserted.
*
* You can specify how this Put should be written to the write-ahead Log (WAL)
* by changing the durability. If you don't provide durability, it defaults to
* column family's default setting for durability.
*/
struct TPut {
1: required binary row,
2: required list<TColumnValue> columnValues
3: optional i64 timestamp,
5: optional map<binary, binary> attributes,
6: optional TDurability durability,
7: optional TCellVisibility cellVisibility
}
/**
* Used to perform Delete operations on a single row.
*
* The scope can be further narrowed down by specifying a list of
* columns or column families as TColumns.
*
* Specifying only a family in a TColumn will delete the whole family.
* If a timestamp is specified all versions with a timestamp less than
* or equal to this will be deleted. If no timestamp is specified the
* current time will be used.
*
* Specifying a family and a column qualifier in a TColumn will delete only
* this qualifier. If a timestamp is specified only versions equal
* to this timestamp will be deleted. If no timestamp is specified the
* most recent version will be deleted. To delete all previous versions,
* specify the DELETE_COLUMNS TDeleteType.
*
* The top level timestamp is only used if a complete row should be deleted
* (i.e. no columns are passed) and if it is specified it works the same way
* as if you had added a TColumn for every column family and this timestamp
* (i.e. all versions older than or equal in all column families will be deleted)
*
* You can specify how this Delete should be written to the write-ahead Log (WAL)
* by changing the durability. If you don't provide durability, it defaults to
* column family's default setting for durability.
*/
struct TDelete {
1: required binary row,
2: optional list<TColumn> columns,
3: optional i64 timestamp,
4: optional TDeleteType deleteType = 1,
6: optional map<binary, binary> attributes,
7: optional TDurability durability
}
/**
* Used to perform Increment operations for a single row.
*
* You can specify how this Increment should be written to the write-ahead Log (WAL)
* by changing the durability. If you don't provide durability, it defaults to
* column family's default setting for durability.
*/
struct TIncrement {
1: required binary row,
2: required list<TColumnIncrement> columns,
4: optional map<binary, binary> attributes,
5: optional TDurability durability
6: optional TCellVisibility cellVisibility
}
/*
* Used to perform append operation
*/
struct TAppend {
1: required binary row,
2: required list<TColumnValue> columns,
3: optional map<binary, binary> attributes,
4: optional TDurability durability
5: optional TCellVisibility cellVisibility
}
/**
* Any timestamps in the columns are ignored, use timeRange to select by timestamp.
* Max versions defaults to 1.
*/
struct TScan {
1: optional binary startRow,
2: optional binary stopRow,
3: optional list<TColumn> columns
4: optional i32 caching,
5: optional i32 maxVersions=1,
6: optional TTimeRange timeRange,
7: optional binary filterString,
8: optional i32 batchSize,
9: optional map<binary, binary> attributes
10: optional TAuthorization authorizations
11: optional bool reversed
}
/**
* Atomic mutation for the specified row. It can be either Put or Delete.
*/
union TMutation {
1: TPut put,
2: TDelete deleteSingle,
}
/**
* A TRowMutations object is used to apply a number of Mutations to a single row.
*/
struct TRowMutations {
1: required binary row
2: required list<TMutation> mutations
}
//
// Exceptions
//
/**
* A TIOError exception signals that an error occurred communicating
* to the HBase master or a HBase region server. Also used to return
* more general HBase error conditions.
*/
exception TIOError {
1: optional string message
}
/**
* A TIllegalArgument exception indicates an illegal or invalid
* argument was passed into a procedure.
*/
exception TIllegalArgument {
1: optional string message
}
service THBaseService {
/**
* Test for the existence of columns in the table, as specified in the TGet.
*
* @return true if the specified TGet matches one or more keys, false if not
*/
bool exists(
/** the table to check on */
1: required binary table,
/** the TGet to check for */
2: required TGet tget
) throws (1:TIOError io)
/**
* Method for getting data from a row.
*
* If the row cannot be found an empty Result is returned.
* This can be checked by the empty field of the TResult
*
* @return the result
*/
TResult get(
/** the table to get from */
1: required binary table,
/** the TGet to fetch */
2: required TGet tget
) throws (1: TIOError io)
/**
* Method for getting multiple rows.
*
* If a row cannot be found there will be a null
* value in the result list for that TGet at the
* same position.
*
* So the Results are in the same order as the TGets.
*/
list<TResult> getMultiple(
/** the table to get from */
1: required binary table,
/** a list of TGets to fetch, the Result list
will have the Results at corresponding positions
or null if there was an error */
2: required list<TGet> tgets
) throws (1: TIOError io)
/**
* Commit a TPut to a table.
*/
void put(
/** the table to put data in */
1: required binary table,
/** the TPut to put */
2: required TPut tput
) throws (1: TIOError io)
/**
* Atomically checks if a row/family/qualifier value matches the expected
* value. If it does, it adds the TPut.
*
* @return true if the new put was executed, false otherwise
*/
bool checkAndPut(
/** to check in and put to */
1: required binary table,
/** row to check */
2: required binary row,
/** column family to check */
3: required binary family,
/** column qualifier to check */
4: required binary qualifier,
/** the expected value, if not provided the
check is for the non-existence of the
column in question */
5: binary value,
/** the TPut to put if the check succeeds */
6: required TPut tput
) throws (1: TIOError io)
/**
* Commit a List of Puts to the table.
*/
void putMultiple(
/** the table to put data in */
1: required binary table,
/** a list of TPuts to commit */
2: required list<TPut> tputs
) throws (1: TIOError io)
/**
* Deletes as specified by the TDelete.
*
* Note: "delete" is a reserved keyword and cannot be used in Thrift
* thus the inconsistent naming scheme from the other functions.
*/
void deleteSingle(
/** the table to delete from */
1: required binary table,
/** the TDelete to delete */
2: required TDelete tdelete
) throws (1: TIOError io)
/**
* Bulk commit a List of TDeletes to the table.
*
* Throws a TIOError if any of the deletes fail.
*
* Always returns an empty list for backwards compatibility.
*/
list<TDelete> deleteMultiple(
/** the table to delete from */
1: required binary table,
/** list of TDeletes to delete */
2: required list<TDelete> tdeletes
) throws (1: TIOError io)
/**
* Atomically checks if a row/family/qualifier value matches the expected
* value. If it does, it adds the delete.
*
* @return true if the new delete was executed, false otherwise
*/
bool checkAndDelete(
/** to check in and delete from */
1: required binary table,
/** row to check */
2: required binary row,
/** column family to check */
3: required binary family,
/** column qualifier to check */
4: required binary qualifier,
/** the expected value, if not provided the
check is for the non-existence of the
column in question */
5: binary value,
/** the TDelete to execute if the check succeeds */
6: required TDelete tdelete
) throws (1: TIOError io)
TResult increment(
/** the table to increment the value on */
1: required binary table,
/** the TIncrement to increment */
2: required TIncrement tincrement
) throws (1: TIOError io)
TResult append(
/** the table to append the value on */
1: required binary table,
/** the TAppend to append */
2: required TAppend tappend
) throws (1: TIOError io)
/**
* Get a Scanner for the provided TScan object.
*
* @return Scanner Id to be used with other scanner procedures
*/
i32 openScanner(
/** the table to get the Scanner for */
1: required binary table,
/** the scan object to get a Scanner for */
2: required TScan tscan,
) throws (1: TIOError io)
/**
* Grabs multiple rows from a Scanner.
*
* @return Between zero and numRows TResults
*/
list<TResult> getScannerRows(
/** the Id of the Scanner to return rows from. This is an Id returned from the openScanner function. */
1: required i32 scannerId,
/** number of rows to return */
2: i32 numRows = 1
) throws (
1: TIOError io,
/** if the scannerId is invalid */
2: TIllegalArgument ia
)
/**
* Closes the scanner. Should be called to free server side resources timely.
* Typically close once the scanner is not needed anymore, i.e. after looping
* over it to get all the required rows.
*/
void closeScanner(
/** the Id of the Scanner to close **/
1: required i32 scannerId
) throws (
1: TIOError io,
/** if the scannerId is invalid */
2: TIllegalArgument ia
)
/**
* mutateRow performs multiple mutations atomically on a single row.
*/
void mutateRow(
/** table to apply the mutations */
1: required binary table,
/** mutations to apply */
2: required TRowMutations trowMutations
) throws (1: TIOError io)
/**
* Get results for the provided TScan object.
* This helper function opens a scanner, get the results and close the scanner.
*
* @return between zero and numRows TResults
*/
list<TResult> getScannerResults(
/** the table to get the Scanner for */
1: required binary table,
/** the scan object to get a Scanner for */
2: required TScan tscan,
/** number of rows to return */
3: i32 numRows = 1
) throws (
1: TIOError io
)
}