github.com/tsuna/gohbase@v0.0.0-20250731002811-4ffcadfba63e/pb/RPC.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 syntax = "proto2"; 19 package pb; 20 21 import "Tracing.proto"; 22 import "HBase.proto"; 23 24 option java_package = "org.apache.hadoop.hbase.protobuf.generated"; 25 option java_outer_classname = "RPCProtos"; 26 option java_generate_equals_and_hash = true; 27 option optimize_for = SPEED; 28 option go_package = "../pb"; 29 30 // See https://issues.apache.org/jira/browse/HBASE-7898 for high-level 31 // description of RPC specification. 32 // 33 // On connection setup, the client sends six bytes of preamble -- a four 34 // byte magic, a byte of version, and a byte of authentication type. 35 // 36 // We then send a "ConnectionHeader" protobuf of user information and the 37 // 'protocol' or 'service' that is to be run over this connection as well as 38 // info such as codecs and compression to use when we send cell blocks(see below). 39 // This connection header protobuf is prefaced by an int that holds the length 40 // of this connection header (this is NOT a varint). The pb connection header 41 // is sent with Message#writeTo. The server throws an exception if it doesn't 42 // like what it was sent noting what it is objecting too. Otherwise, the server 43 // says nothing and is open for business. 44 // 45 // Hereafter the client makes requests and the server returns responses. 46 // 47 // Requests look like this: 48 // 49 // <An int with the total length of the request> 50 // <RequestHeader Message written out using Message#writeDelimitedTo> 51 // <Optionally a Request Parameter Message written out using Message#writeDelimitedTo> 52 // <Optionally a Cell block> 53 // 54 // ...where the Request Parameter Message is whatever the method name stipulated 55 // in the RequestHeader expects; e.g. if the method is a scan, then the pb 56 // Request Message is a GetRequest, or a ScanRequest. A block of Cells 57 // optionally follows. The presence of a Request param Message and/or a 58 // block of Cells will be noted in the RequestHeader. 59 // 60 // Response is the mirror of the request: 61 // 62 // <An int with the total length of the response> 63 // <ResponseHeader Message written out using Message#writeDelimitedTo> 64 // <Optionally a Response Result Message written out using Message#writeDelimitedTo> 65 // <Optionally a Cell block> 66 // 67 // ...where the Response Message is the response type that goes with the 68 // method specified when making the request and the follow on Cell blocks may 69 // or may not be there -- read the response header to find out if one following. 70 // If an exception, it will be included inside the Response Header. 71 // 72 // Any time we write a pb, we do it with Message#writeDelimitedTo EXCEPT when 73 // the connection header is sent; this is prefaced by an int with its length 74 // and the pb connection header is then written with Message#writeTo. 75 // 76 77 // User Information proto. Included in ConnectionHeader on connection setup 78 message UserInformation { 79 required string effective_user = 1; 80 optional string real_user = 2; 81 } 82 83 // This is sent on connection setup after the connection preamble is sent. 84 message ConnectionHeader { 85 optional UserInformation user_info = 1; 86 optional string service_name = 2; 87 // Cell block codec we will use sending over optional cell blocks. Server throws exception 88 // if cannot deal. Null means no codec'ing going on so we are pb all the time (SLOW!!!) 89 optional string cell_block_codec_class = 3; 90 // Compressor we will use if cell block is compressed. Server will throw exception if not supported. 91 // Class must implement hadoop's CompressionCodec Interface. Can't compress if no codec. 92 optional string cell_block_compressor_class = 4; 93 optional VersionInfo version_info = 5; 94 } 95 96 // Optional Cell block Message. Included in client RequestHeader 97 message CellBlockMeta { 98 // Length of the following cell block. Could calculate it but convenient having it too hand. 99 optional uint32 length = 1; 100 } 101 102 // At the RPC layer, this message is used to carry 103 // the server side exception to the RPC client. 104 message ExceptionResponse { 105 // Class name of the exception thrown from the server 106 optional string exception_class_name = 1; 107 // Exception stack trace from the server side 108 optional string stack_trace = 2; 109 // Optional hostname. Filled in for some exceptions such as region moved 110 // where exception gives clue on where the region may have moved. 111 optional string hostname = 3; 112 optional int32 port = 4; 113 // Set if we are NOT to retry on receipt of this exception 114 optional bool do_not_retry = 5; 115 } 116 117 // Header sent making a request. 118 message RequestHeader { 119 // Monotonically increasing call_id to keep track of RPC requests and their response 120 optional uint32 call_id = 1; 121 optional RPCTInfo trace_info = 2; 122 optional string method_name = 3; 123 // If true, then a pb Message param follows. 124 optional bool request_param = 4; 125 // If present, then an encoded data block follows. 126 optional CellBlockMeta cell_block_meta = 5; 127 // 0 is NORMAL priority. 200 is HIGH. If no priority, treat it as NORMAL. 128 // See HConstants. 129 optional uint32 priority = 6; 130 optional uint32 timeout = 7; 131 } 132 133 message ResponseHeader { 134 optional uint32 call_id = 1; 135 // If present, then request threw an exception and no response message (else we presume one) 136 optional ExceptionResponse exception = 2; 137 // If present, then an encoded data block follows. 138 optional CellBlockMeta cell_block_meta = 3; 139 }