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