github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/pingcap/go-hbase/protobuf/Client.proto (about) 1 package proto; 2 /** 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 // This file contains protocol buffers that are used for Client service. 21 22 option java_package = "org.apache.hadoop.hbase.protobuf.generated"; 23 option java_outer_classname = "ClientProtos"; 24 option java_generic_services = true; 25 option java_generate_equals_and_hash = true; 26 option optimize_for = SPEED; 27 28 import "HBase.proto"; 29 import "Filter.proto"; 30 import "Cell.proto"; 31 import "Comparator.proto"; 32 33 /** 34 * The protocol buffer version of Authorizations. 35 */ 36 message Authorizations { 37 repeated string label = 1; 38 } 39 40 /** 41 * The protocol buffer version of CellVisibility. 42 */ 43 message CellVisibility { 44 required string expression = 1; 45 } 46 47 /** 48 * Container for a list of column qualifier names of a family. 49 */ 50 message Column { 51 required bytes family = 1; 52 repeated bytes qualifier = 2; 53 } 54 55 /** 56 * The protocol buffer version of Get. 57 * Unless existence_only is specified, return all the requested data 58 * for the row that matches exactly, or the one that immediately 59 * precedes it if closest_row_before is specified. 60 */ 61 message Get { 62 required bytes row = 1; 63 repeated Column column = 2; 64 repeated NameBytesPair attribute = 3; 65 optional Filter filter = 4; 66 optional TimeRange time_range = 5; 67 optional uint32 max_versions = 6 [default = 1]; 68 optional bool cache_blocks = 7 [default = true]; 69 optional uint32 store_limit = 8; 70 optional uint32 store_offset = 9; 71 72 // The result isn't asked for, just check for 73 // the existence. 74 optional bool existence_only = 10 [default = false]; 75 76 // If the row to get doesn't exist, return the 77 // closest row before. 78 optional bool closest_row_before = 11 [default = false]; 79 } 80 81 message Result { 82 // Result includes the Cells or else it just has a count of Cells 83 // that are carried otherwise. 84 repeated Cell cell = 1; 85 // The below count is set when the associated cells are 86 // not part of this protobuf message; they are passed alongside 87 // and then this Message is just a placeholder with metadata. 88 // The count is needed to know how many to peel off the block of Cells as 89 // ours. NOTE: This is different from the pb managed cell_count of the 90 // 'cell' field above which is non-null when the cells are pb'd. 91 optional int32 associated_cell_count = 2; 92 93 // used for Get to check existence only. Not set if existence_only was not set to true 94 // in the query. 95 optional bool exists = 3; 96 } 97 98 /** 99 * The get request. Perform a single Get operation. 100 */ 101 message GetRequest { 102 required RegionSpecifier region = 1; 103 required Get get = 2; 104 } 105 106 message GetResponse { 107 optional Result result = 1; 108 } 109 110 /** 111 * Condition to check if the value of a given cell (row, 112 * family, qualifier) matches a value via a given comparator. 113 * 114 * Condition is used in check and mutate operations. 115 */ 116 message Condition { 117 required bytes row = 1; 118 required bytes family = 2; 119 required bytes qualifier = 3; 120 required CompareType compare_type = 4; 121 required Comparator comparator = 5; 122 } 123 124 125 /** 126 * A specific mutation inside a mutate request. 127 * It can be an append, increment, put or delete based 128 * on the mutation type. It can be fully filled in or 129 * only metadata present because data is being carried 130 * elsewhere outside of pb. 131 */ 132 message MutationProto { 133 optional bytes row = 1; 134 optional MutationType mutate_type = 2; 135 repeated ColumnValue column_value = 3; 136 optional uint64 timestamp = 4; 137 repeated NameBytesPair attribute = 5; 138 optional Durability durability = 6 [default = USE_DEFAULT]; 139 140 // For some mutations, a result may be returned, in which case, 141 // time range can be specified for potential performance gain 142 optional TimeRange time_range = 7; 143 // The below count is set when the associated cells are NOT 144 // part of this protobuf message; they are passed alongside 145 // and then this Message is a placeholder with metadata. The 146 // count is needed to know how many to peel off the block of Cells as 147 // ours. NOTE: This is different from the pb managed cell_count of the 148 // 'cell' field above which is non-null when the cells are pb'd. 149 optional int32 associated_cell_count = 8; 150 151 optional uint64 nonce = 9; 152 153 enum Durability { 154 USE_DEFAULT = 0; 155 SKIP_WAL = 1; 156 ASYNC_WAL = 2; 157 SYNC_WAL = 3; 158 FSYNC_WAL = 4; 159 } 160 161 enum MutationType { 162 APPEND = 0; 163 INCREMENT = 1; 164 PUT = 2; 165 DELETE = 3; 166 } 167 168 enum DeleteType { 169 DELETE_ONE_VERSION = 0; 170 DELETE_MULTIPLE_VERSIONS = 1; 171 DELETE_FAMILY = 2; 172 DELETE_FAMILY_VERSION = 3; 173 } 174 175 message ColumnValue { 176 required bytes family = 1; 177 repeated QualifierValue qualifier_value = 2; 178 179 message QualifierValue { 180 optional bytes qualifier = 1; 181 optional bytes value = 2; 182 optional uint64 timestamp = 3; 183 optional DeleteType delete_type = 4; 184 optional bytes tags = 5; 185 } 186 } 187 } 188 189 /** 190 * The mutate request. Perform a single Mutate operation. 191 * 192 * Optionally, you can specify a condition. The mutate 193 * will take place only if the condition is met. Otherwise, 194 * the mutate will be ignored. In the response result, 195 * parameter processed is used to indicate if the mutate 196 * actually happened. 197 */ 198 message MutateRequest { 199 required RegionSpecifier region = 1; 200 required MutationProto mutation = 2; 201 optional Condition condition = 3; 202 optional uint64 nonce_group = 4; 203 } 204 205 message MutateResponse { 206 optional Result result = 1; 207 208 // used for mutate to indicate processed only 209 optional bool processed = 2; 210 } 211 212 /** 213 * Instead of get from a table, you can scan it with optional filters. 214 * You can specify the row key range, time range, the columns/families 215 * to scan and so on. 216 * 217 * This scan is used the first time in a scan request. The response of 218 * the initial scan will return a scanner id, which should be used to 219 * fetch result batches later on before it is closed. 220 */ 221 message Scan { 222 repeated Column column = 1; 223 repeated NameBytesPair attribute = 2; 224 optional bytes start_row = 3; 225 optional bytes stop_row = 4; 226 optional Filter filter = 5; 227 optional TimeRange time_range = 6; 228 optional uint32 max_versions = 7 [default = 1]; 229 optional bool cache_blocks = 8 [default = true]; 230 optional uint32 batch_size = 9; 231 optional uint64 max_result_size = 10; 232 optional uint32 store_limit = 11; 233 optional uint32 store_offset = 12; 234 optional bool load_column_families_on_demand = 13; /* DO NOT add defaults to load_column_families_on_demand. */ 235 optional bool small = 14; 236 optional bool reversed = 15 [default = false]; 237 optional uint32 caching = 17; 238 } 239 240 /** 241 * A scan request. Initially, it should specify a scan. Later on, you 242 * can use the scanner id returned to fetch result batches with a different 243 * scan request. 244 * 245 * The scanner will remain open if there are more results, and it's not 246 * asked to be closed explicitly. 247 * 248 * You can fetch the results and ask the scanner to be closed to save 249 * a trip if you are not interested in remaining results. 250 */ 251 message ScanRequest { 252 optional RegionSpecifier region = 1; 253 optional Scan scan = 2; 254 optional uint64 scanner_id = 3; 255 optional uint32 number_of_rows = 4; 256 optional bool close_scanner = 5; 257 optional uint64 next_call_seq = 6; 258 } 259 260 /** 261 * The scan response. If there are no more results, more_results will 262 * be false. If it is not specified, it means there are more. 263 */ 264 message ScanResponse { 265 // This field is filled in if we are doing cellblocks. A cellblock is made up 266 // of all Cells serialized out as one cellblock BUT responses from a server 267 // have their Cells grouped by Result. So we can reconstitute the 268 // Results on the client-side, this field is a list of counts of Cells 269 // in each Result that makes up the response. For example, if this field 270 // has 3, 3, 3 in it, then we know that on the client, we are to make 271 // three Results each of three Cells each. 272 repeated uint32 cells_per_result = 1; 273 optional uint64 scanner_id = 2; 274 optional bool more_results = 3; 275 optional uint32 ttl = 4; 276 // If cells are not carried in an accompanying cellblock, then they are pb'd here. 277 // This field is mutually exclusive with cells_per_result (since the Cells will 278 // be inside the pb'd Result) 279 repeated Result results = 5; 280 281 // A server may choose to limit the number of results returned to the client for 282 // reasons such as the size in bytes or quantity of results accumulated. This field 283 // will true when more results exist in the current region. 284 optional bool more_results_in_region = 8; 285 } 286 287 /** 288 * Atomically bulk load multiple HFiles (say from different column families) 289 * into an open region. 290 */ 291 message BulkLoadHFileRequest { 292 required RegionSpecifier region = 1; 293 repeated FamilyPath family_path = 2; 294 optional bool assign_seq_num = 3; 295 296 message FamilyPath { 297 required bytes family = 1; 298 required string path = 2; 299 } 300 } 301 302 message BulkLoadHFileResponse { 303 required bool loaded = 1; 304 } 305 306 message CoprocessorServiceCall { 307 required bytes row = 1; 308 required string service_name = 2; 309 required string method_name = 3; 310 required bytes request = 4; 311 } 312 313 message CoprocessorServiceResult { 314 optional NameBytesPair value = 1; 315 } 316 317 message CoprocessorServiceRequest { 318 required RegionSpecifier region = 1; 319 required CoprocessorServiceCall call = 2; 320 } 321 322 message CoprocessorServiceResponse { 323 required RegionSpecifier region = 1; 324 required NameBytesPair value = 2; 325 } 326 327 // Either a Get or a Mutation 328 message Action { 329 // If part of a multi action, useful aligning 330 // result with what was originally submitted. 331 optional uint32 index = 1; 332 optional MutationProto mutation = 2; 333 optional Get get = 3; 334 optional CoprocessorServiceCall service_call = 4; 335 } 336 337 /** 338 * Actions to run against a Region. 339 */ 340 message RegionAction { 341 required RegionSpecifier region = 1; 342 // When set, run mutations as atomic unit. 343 optional bool atomic = 2; 344 repeated Action action = 3; 345 } 346 347 /* 348 * Statistics about the current load on the region 349 */ 350 message RegionLoadStats { 351 // Percent load on the memstore. Guaranteed to be positive, between 0 and 100. 352 optional int32 memstoreLoad = 1 [default = 0]; 353 // Percent JVM heap occupancy. Guaranteed to be positive, between 0 and 100. 354 // We can move this to "ServerLoadStats" should we develop them. 355 optional int32 heapOccupancy = 2 [default = 0]; 356 } 357 358 /** 359 * Either a Result or an Exception NameBytesPair (keyed by 360 * exception name whose value is the exception stringified) 361 * or maybe empty if no result and no exception. 362 */ 363 message ResultOrException { 364 // If part of a multi call, save original index of the list of all 365 // passed so can align this response w/ original request. 366 optional uint32 index = 1; 367 optional Result result = 2; 368 optional NameBytesPair exception = 3; 369 // result if this was a coprocessor service call 370 optional CoprocessorServiceResult service_result = 4; 371 // current load on the region 372 optional RegionLoadStats loadStats = 5; 373 } 374 375 /** 376 * The result of a RegionAction. 377 */ 378 message RegionActionResult { 379 repeated ResultOrException resultOrException = 1; 380 // If the operation failed globally for this region, this exception is set 381 optional NameBytesPair exception = 2; 382 } 383 384 /** 385 * Execute a list of actions on a given region in order. 386 * Nothing prevents a request to contains a set of RegionAction on the same region. 387 * For this reason, the matching between the MultiRequest and the MultiResponse is not 388 * done by the region specifier but by keeping the order of the RegionActionResult vs. 389 * the order of the RegionAction. 390 */ 391 message MultiRequest { 392 repeated RegionAction regionAction = 1; 393 optional uint64 nonceGroup = 2; 394 optional Condition condition = 3; 395 } 396 397 message MultiResponse { 398 repeated RegionActionResult regionActionResult = 1; 399 // used for mutate to indicate processed only 400 optional bool processed = 2; 401 } 402 403 404 service ClientService { 405 rpc Get(GetRequest) 406 returns(GetResponse); 407 408 rpc Mutate(MutateRequest) 409 returns(MutateResponse); 410 411 rpc Scan(ScanRequest) 412 returns(ScanResponse); 413 414 rpc BulkLoadHFile(BulkLoadHFileRequest) 415 returns(BulkLoadHFileResponse); 416 417 rpc ExecService(CoprocessorServiceRequest) 418 returns(CoprocessorServiceResponse); 419 420 rpc ExecRegionServerService(CoprocessorServiceRequest) 421 returns(CoprocessorServiceResponse); 422 423 rpc Multi(MultiRequest) 424 returns(MultiResponse); 425 }