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