text:
001    // Generated by the protocol buffer compiler.  DO NOT EDIT!
002    // source: ProtobufRpcEngine.proto
003
004    package org.apache.hadoop.ipc.protobuf;
005
006    public final class ProtobufRpcEngineProtos {
007      private ProtobufRpcEngineProtos() {}
008      public static void registerAllExtensions(
009          com.google.protobuf.ExtensionRegistry registry) {
010      }
011      public interface RequestHeaderProtoOrBuilder
012          extends com.google.protobuf.MessageOrBuilder {
013
014        // required string methodName = 1;
015        /**
016         * <code>required string methodName = 1;</code>
017         *
018         * <pre>
019         ** Name of the RPC method
020         * </pre>
021         */
022        boolean hasMethodName();
023        /**
024         * <code>required string methodName = 1;</code>
025         *
026         * <pre>
027         ** Name of the RPC method
028         * </pre>
029         */
030        java.lang.String getMethodName();
031        /**
032         * <code>required string methodName = 1;</code>
033         *
034         * <pre>
035         ** Name of the RPC method
036         * </pre>
037         */
038        com.google.protobuf.ByteString
039            getMethodNameBytes();
040
041        // required string declaringClassProtocolName = 2;
042        /**
043         * <code>required string declaringClassProtocolName = 2;</code>
044         *
045         * <pre>
046         **
047         * RPCs for a particular interface (ie protocol) are done using a
048         * IPC connection that is setup using rpcProxy.
049         * The rpcProxy's has a declared protocol name that is
050         * sent form client to server at connection time.
051         *
052         * Each Rpc call also sends a protocol name
053         * (called declaringClassprotocolName). This name is usually the same
054         * as the connection protocol name except in some cases.
055         * For example metaProtocols such ProtocolInfoProto which get metainfo
056         * about the protocol reuse the connection but need to indicate that
057         * the actual protocol is different (i.e. the protocol is
058         * ProtocolInfoProto) since they reuse the connection; in this case
059         * the declaringClassProtocolName field is set to the ProtocolInfoProto
060         * </pre>
061         */
062        boolean hasDeclaringClassProtocolName();
063        /**
064         * <code>required string declaringClassProtocolName = 2;</code>
065         *
066         * <pre>
067         **
068         * RPCs for a particular interface (ie protocol) are done using a
069         * IPC connection that is setup using rpcProxy.
070         * The rpcProxy's has a declared protocol name that is
071         * sent form client to server at connection time.
072         *
073         * Each Rpc call also sends a protocol name
074         * (called declaringClassprotocolName). This name is usually the same
075         * as the connection protocol name except in some cases.
076         * For example metaProtocols such ProtocolInfoProto which get metainfo
077         * about the protocol reuse the connection but need to indicate that
078         * the actual protocol is different (i.e. the protocol is
079         * ProtocolInfoProto) since they reuse the connection; in this case
080         * the declaringClassProtocolName field is set to the ProtocolInfoProto
081         * </pre>
082         */
083        java.lang.String getDeclaringClassProtocolName();
084        /**
085         * <code>required string declaringClassProtocolName = 2;</code>
086         *
087         * <pre>
088         **
089         * RPCs for a particular interface (ie protocol) are done using a
090         * IPC connection that is setup using rpcProxy.
091         * The rpcProxy's has a declared protocol name that is
092         * sent form client to server at connection time.
093         *
094         * Each Rpc call also sends a protocol name
095         * (called declaringClassprotocolName). This name is usually the same
096         * as the connection protocol name except in some cases.
097         * For example metaProtocols such ProtocolInfoProto which get metainfo
098         * about the protocol reuse the connection but need to indicate that
099         * the actual protocol is different (i.e. the protocol is
100         * ProtocolInfoProto) since they reuse the connection; in this case
101         * the declaringClassProtocolName field is set to the ProtocolInfoProto
102         * </pre>
103         */
104        com.google.protobuf.ByteString
105            getDeclaringClassProtocolNameBytes();
106
107        // required uint64 clientProtocolVersion = 3;
108        /**
109         * <code>required uint64 clientProtocolVersion = 3;</code>
110         *
111         * <pre>
112         ** protocol version of class declaring the called method
113         * </pre>
114         */
115        boolean hasClientProtocolVersion();
116        /**
117         * <code>required uint64 clientProtocolVersion = 3;</code>
118         *
119         * <pre>
120         ** protocol version of class declaring the called method
121         * </pre>
122         */
123        long getClientProtocolVersion();
124      }
125      /**
126       * Protobuf type {@code hadoop.common.RequestHeaderProto}
127       *
128       * <pre>
129       **
130       * This message is the header for the Protobuf Rpc Engine
131       * when sending a RPC request from  RPC client to the RPC server.
132       * The actual request (serialized as protobuf) follows this request.
133       *
134       * No special header is needed for the Rpc Response for Protobuf Rpc Engine.
135       * The normal RPC response header (see RpcHeader.proto) are sufficient.
136       * </pre>
137       */
138      public static final class RequestHeaderProto extends
139          com.google.protobuf.GeneratedMessage
140          implements RequestHeaderProtoOrBuilder {
141        // Use RequestHeaderProto.newBuilder() to construct.
142        private RequestHeaderProto(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
143          super(builder);
144          this.unknownFields = builder.getUnknownFields();
145        }
146        private RequestHeaderProto(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
147
148        private static final RequestHeaderProto defaultInstance;
149        public static RequestHeaderProto getDefaultInstance() {
150          return defaultInstance;
151        }
152
153        public RequestHeaderProto getDefaultInstanceForType() {
154          return defaultInstance;
155        }
156
157        private final com.google.protobuf.UnknownFieldSet unknownFields;
158        @java.lang.Override
159        public final com.google.protobuf.UnknownFieldSet
160            getUnknownFields() {
161          return this.unknownFields;
162        }
163        private RequestHeaderProto(
164            com.google.protobuf.CodedInputStream input,
165            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
166            throws com.google.protobuf.InvalidProtocolBufferException {
167          initFields();
168          int mutable_bitField0_ = 0;
169          com.google.protobuf.UnknownFieldSet.Builder unknownFields =
170              com.google.protobuf.UnknownFieldSet.newBuilder();
171          try {
172            boolean done = false;
173            while (!done) {
174              int tag = input.readTag();
175              switch (tag) {
176                case 0:
177                  done = true;
178                  break;
179                default: {
180                  if (!parseUnknownField(input, unknownFields,
181                                         extensionRegistry, tag)) {
182                    done = true;
183                  }
184                  break;
185                }
186                case 10: {
187                  bitField0_ |= 0x00000001;
188                  methodName_ = input.readBytes();
189                  break;
190                }
191                case 18: {
192                  bitField0_ |= 0x00000002;
193                  declaringClassProtocolName_ = input.readBytes();
194                  break;
195                }
196                case 24: {
197                  bitField0_ |= 0x00000004;
198                  clientProtocolVersion_ = input.readUInt64();
199                  break;
200                }
201              }
202            }
203          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
204            throw e.setUnfinishedMessage(this);
205          } catch (java.io.IOException e) {
206            throw new com.google.protobuf.InvalidProtocolBufferException(
207                e.getMessage()).setUnfinishedMessage(this);
208          } finally {
209            this.unknownFields = unknownFields.build();
210            makeExtensionsImmutable();
211          }
212        }
213        public static final com.google.protobuf.Descriptors.Descriptor
214            getDescriptor() {
215          return org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.internal_static_hadoop_common_RequestHeaderProto_descriptor;
216        }
217
218        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
219            internalGetFieldAccessorTable() {
220          return org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.internal_static_hadoop_common_RequestHeaderProto_fieldAccessorTable
221              .ensureFieldAccessorsInitialized(
222                  org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto.class, org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto.Builder.class);
223        }
224
225        public static com.google.protobuf.Parser<RequestHeaderProto> PARSER =
226            new com.google.protobuf.AbstractParser<RequestHeaderProto>() {
227          public RequestHeaderProto parsePartialFrom(
228              com.google.protobuf.CodedInputStream input,
229              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
230              throws com.google.protobuf.InvalidProtocolBufferException {
231            return new RequestHeaderProto(input, extensionRegistry);
232          }
233        };
234
235        @java.lang.Override
236        public com.google.protobuf.Parser<RequestHeaderProto> getParserForType() {
237          return PARSER;
238        }
239
240        private int bitField0_;
241        // required string methodName = 1;
242        public static final int METHODNAME_FIELD_NUMBER = 1;
243        private java.lang.Object methodName_;
244        /**
245         * <code>required string methodName = 1;</code>
246         *
247         * <pre>
248         ** Name of the RPC method
249         * </pre>
250         */
251        public boolean hasMethodName() {
252          return ((bitField0_ & 0x00000001) == 0x00000001);
253        }
254        /**
255         * <code>required string methodName = 1;</code>
256         *
257         * <pre>
258         ** Name of the RPC method
259         * </pre>
260         */
261        public java.lang.String getMethodName() {
262          java.lang.Object ref = methodName_;
263          if (ref instanceof java.lang.String) {
264            return (java.lang.String) ref;
265          } else {
266            com.google.protobuf.ByteString bs =
267                (com.google.protobuf.ByteString) ref;
268            java.lang.String s = bs.toStringUtf8();
269            if (bs.isValidUtf8()) {
270              methodName_ = s;
271            }
272            return s;
273          }
274        }
275        /**
276         * <code>required string methodName = 1;</code>
277         *
278         * <pre>
279         ** Name of the RPC method
280         * </pre>
281         */
282        public com.google.protobuf.ByteString
283            getMethodNameBytes() {
284          java.lang.Object ref = methodName_;
285          if (ref instanceof java.lang.String) {
286            com.google.protobuf.ByteString b =
287                com.google.protobuf.ByteString.copyFromUtf8(
288                    (java.lang.String) ref);
289            methodName_ = b;
290            return b;
291          } else {
292            return (com.google.protobuf.ByteString) ref;
293          }
294        }
295
296        // required string declaringClassProtocolName = 2;
297        public static final int DECLARINGCLASSPROTOCOLNAME_FIELD_NUMBER = 2;
298        private java.lang.Object declaringClassProtocolName_;
299        /**
300         * <code>required string declaringClassProtocolName = 2;</code>
301         *
302         * <pre>
303         **
304         * RPCs for a particular interface (ie protocol) are done using a
305         * IPC connection that is setup using rpcProxy.
306         * The rpcProxy's has a declared protocol name that is
307         * sent form client to server at connection time.
308         *
309         * Each Rpc call also sends a protocol name
310         * (called declaringClassprotocolName). This name is usually the same
311         * as the connection protocol name except in some cases.
312         * For example metaProtocols such ProtocolInfoProto which get metainfo
313         * about the protocol reuse the connection but need to indicate that
314         * the actual protocol is different (i.e. the protocol is
315         * ProtocolInfoProto) since they reuse the connection; in this case
316         * the declaringClassProtocolName field is set to the ProtocolInfoProto
317         * </pre>
318         */
319        public boolean hasDeclaringClassProtocolName() {
320          return ((bitField0_ & 0x00000002) == 0x00000002);
321        }
322        /**
323         * <code>required string declaringClassProtocolName = 2;</code>
324         *
325         * <pre>
326         **
327         * RPCs for a particular interface (ie protocol) are done using a
328         * IPC connection that is setup using rpcProxy.
329         * The rpcProxy's has a declared protocol name that is
330         * sent form client to server at connection time.
331         *
332         * Each Rpc call also sends a protocol name
333         * (called declaringClassprotocolName). This name is usually the same
334         * as the connection protocol name except in some cases.
335         * For example metaProtocols such ProtocolInfoProto which get metainfo
336         * about the protocol reuse the connection but need to indicate that
337         * the actual protocol is different (i.e. the protocol is
338         * ProtocolInfoProto) since they reuse the connection; in this case
339         * the declaringClassProtocolName field is set to the ProtocolInfoProto
340         * </pre>
341         */
342        public java.lang.String getDeclaringClassProtocolName() {
343          java.lang.Object ref = declaringClassProtocolName_;
344          if (ref instanceof java.lang.String) {
345            return (java.lang.String) ref;
346          } else {
347            com.google.protobuf.ByteString bs =
348                (com.google.protobuf.ByteString) ref;
349            java.lang.String s = bs.toStringUtf8();
350            if (bs.isValidUtf8()) {
351              declaringClassProtocolName_ = s;
352            }
353            return s;
354          }
355        }
356        /**
357         * <code>required string declaringClassProtocolName = 2;</code>
358         *
359         * <pre>
360         **
361         * RPCs for a particular interface (ie protocol) are done using a
362         * IPC connection that is setup using rpcProxy.
363         * The rpcProxy's has a declared protocol name that is
364         * sent form client to server at connection time.
365         *
366         * Each Rpc call also sends a protocol name
367         * (called declaringClassprotocolName). This name is usually the same
368         * as the connection protocol name except in some cases.
369         * For example metaProtocols such ProtocolInfoProto which get metainfo
370         * about the protocol reuse the connection but need to indicate that
371         * the actual protocol is different (i.e. the protocol is
372         * ProtocolInfoProto) since they reuse the connection; in this case
373         * the declaringClassProtocolName field is set to the ProtocolInfoProto
374         * </pre>
375         */
376        public com.google.protobuf.ByteString
377            getDeclaringClassProtocolNameBytes() {
378          java.lang.Object ref = declaringClassProtocolName_;
379          if (ref instanceof java.lang.String) {
380            com.google.protobuf.ByteString b =
381                com.google.protobuf.ByteString.copyFromUtf8(
382                    (java.lang.String) ref);
383            declaringClassProtocolName_ = b;
384            return b;
385          } else {
386            return (com.google.protobuf.ByteString) ref;
387          }
388        }
389
390        // required uint64 clientProtocolVersion = 3;
391        public static final int CLIENTPROTOCOLVERSION_FIELD_NUMBER = 3;
392        private long clientProtocolVersion_;
393        /**
394         * <code>required uint64 clientProtocolVersion = 3;</code>
395         *
396         * <pre>
397         ** protocol version of class declaring the called method
398         * </pre>
399         */
400        public boolean hasClientProtocolVersion() {
401          return ((bitField0_ & 0x00000004) == 0x00000004);
402        }
403        /**
404         * <code>required uint64 clientProtocolVersion = 3;</code>
405         *
406         * <pre>
407         ** protocol version of class declaring the called method
408         * </pre>
409         */
410        public long getClientProtocolVersion() {
411          return clientProtocolVersion_;
412        }
413
414        private void initFields() {
415          methodName_ = "";
416          declaringClassProtocolName_ = "";
417          clientProtocolVersion_ = 0L;
418        }
419        private byte memoizedIsInitialized = -1;
420        public final boolean isInitialized() {
421          byte isInitialized = memoizedIsInitialized;
422          if (isInitialized != -1) return isInitialized == 1;
423
424          if (!hasMethodName()) {
425            memoizedIsInitialized = 0;
426            return false;
427          }
428          if (!hasDeclaringClassProtocolName()) {
429            memoizedIsInitialized = 0;
430            return false;
431          }
432          if (!hasClientProtocolVersion()) {
433            memoizedIsInitialized = 0;
434            return false;
435          }
436          memoizedIsInitialized = 1;
437          return true;
438        }
439
440        public void writeTo(com.google.protobuf.CodedOutputStream output)
441                            throws java.io.IOException {
442          getSerializedSize();
443          if (((bitField0_ & 0x00000001) == 0x00000001)) {
444            output.writeBytes(1, getMethodNameBytes());
445          }
446          if (((bitField0_ & 0x00000002) == 0x00000002)) {
447            output.writeBytes(2, getDeclaringClassProtocolNameBytes());
448          }
449          if (((bitField0_ & 0x00000004) == 0x00000004)) {
450            output.writeUInt64(3, clientProtocolVersion_);
451          }
452          getUnknownFields().writeTo(output);
453        }
454
455        private int memoizedSerializedSize = -1;
456        public int getSerializedSize() {
457          int size = memoizedSerializedSize;
458          if (size != -1) return size;
459
460          size = 0;
461          if (((bitField0_ & 0x00000001) == 0x00000001)) {
462            size += com.google.protobuf.CodedOutputStream
463              .computeBytesSize(1, getMethodNameBytes());
464          }
465          if (((bitField0_ & 0x00000002) == 0x00000002)) {
466            size += com.google.protobuf.CodedOutputStream
467              .computeBytesSize(2, getDeclaringClassProtocolNameBytes());
468          }
469          if (((bitField0_ & 0x00000004) == 0x00000004)) {
470            size += com.google.protobuf.CodedOutputStream
471              .computeUInt64Size(3, clientProtocolVersion_);
472          }
473          size += getUnknownFields().getSerializedSize();
474          memoizedSerializedSize = size;
475          return size;
476        }
477
478        private static final long serialVersionUID = 0L;
479        @java.lang.Override
480        protected java.lang.Object writeReplace()
481            throws java.io.ObjectStreamException {
482          return super.writeReplace();
483        }
484
485        @java.lang.Override
486        public boolean equals(final java.lang.Object obj) {
487          if (obj == this) {
488           return true;
489          }
490          if (!(obj instanceof org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto)) {
491            return super.equals(obj);
492          }
493          org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto other = (org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto) obj;
494
495          boolean result = true;
496          result = result && (hasMethodName() == other.hasMethodName());
497          if (hasMethodName()) {
498            result = result && getMethodName()
499                .equals(other.getMethodName());
500          }
501          result = result && (hasDeclaringClassProtocolName() == other.hasDeclaringClassProtocolName());
502          if (hasDeclaringClassProtocolName()) {
503            result = result && getDeclaringClassProtocolName()
504                .equals(other.getDeclaringClassProtocolName());
505          }
506          result = result && (hasClientProtocolVersion() == other.hasClientProtocolVersion());
507          if (hasClientProtocolVersion()) {
508            result = result && (getClientProtocolVersion()
509                == other.getClientProtocolVersion());
510          }
511          result = result &&
512              getUnknownFields().equals(other.getUnknownFields());
513          return result;
514        }
515
516        private int memoizedHashCode = 0;
517        @java.lang.Override
518        public int hashCode() {
519          if (memoizedHashCode != 0) {
520            return memoizedHashCode;
521          }
522          int hash = 41;
523          hash = (19 * hash) + getDescriptorForType().hashCode();
524          if (hasMethodName()) {
525            hash = (37 * hash) + METHODNAME_FIELD_NUMBER;
526            hash = (53 * hash) + getMethodName().hashCode();
527          }
528          if (hasDeclaringClassProtocolName()) {
529            hash = (37 * hash) + DECLARINGCLASSPROTOCOLNAME_FIELD_NUMBER;
530            hash = (53 * hash) + getDeclaringClassProtocolName().hashCode();
531          }
532          if (hasClientProtocolVersion()) {
533            hash = (37 * hash) + CLIENTPROTOCOLVERSION_FIELD_NUMBER;
534            hash = (53 * hash) + hashLong(getClientProtocolVersion());
535          }
536          hash = (29 * hash) + getUnknownFields().hashCode();
537          memoizedHashCode = hash;
538          return hash;
539        }
540
541        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseFrom(
542            com.google.protobuf.ByteString data)
543            throws com.google.protobuf.InvalidProtocolBufferException {
544          return PARSER.parseFrom(data);
545        }
546        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseFrom(
547            com.google.protobuf.ByteString data,
548            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
549            throws com.google.protobuf.InvalidProtocolBufferException {
550          return PARSER.parseFrom(data, extensionRegistry);
551        }
552        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseFrom(byte[] data)
553            throws com.google.protobuf.InvalidProtocolBufferException {
554          return PARSER.parseFrom(data);
555        }
556        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseFrom(
557            byte[] data,
558            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
559            throws com.google.protobuf.InvalidProtocolBufferException {
560          return PARSER.parseFrom(data, extensionRegistry);
561        }
562        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseFrom(java.io.InputStream input)
563            throws java.io.IOException {
564          return PARSER.parseFrom(input);
565        }
566        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseFrom(
567            java.io.InputStream input,
568            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
569            throws java.io.IOException {
570          return PARSER.parseFrom(input, extensionRegistry);
571        }
572        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseDelimitedFrom(java.io.InputStream input)
573            throws java.io.IOException {
574          return PARSER.parseDelimitedFrom(input);
575        }
576        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseDelimitedFrom(
577            java.io.InputStream input,
578            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
579            throws java.io.IOException {
580          return PARSER.parseDelimitedFrom(input, extensionRegistry);
581        }
582        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseFrom(
583            com.google.protobuf.CodedInputStream input)
584            throws java.io.IOException {
585          return PARSER.parseFrom(input);
586        }
587        public static org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parseFrom(
588            com.google.protobuf.CodedInputStream input,
589            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
590            throws java.io.IOException {
591          return PARSER.parseFrom(input, extensionRegistry);
592        }
593
594        public static Builder newBuilder() { return Builder.create(); }
595        public Builder newBuilderForType() { return newBuilder(); }
596        public static Builder newBuilder(org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto prototype) {
597          return newBuilder().mergeFrom(prototype);
598        }
599        public Builder toBuilder() { return newBuilder(this); }
600
601        @java.lang.Override
602        protected Builder newBuilderForType(
603            com.google.protobuf.GeneratedMessage.BuilderParent parent) {
604          Builder builder = new Builder(parent);
605          return builder;
606        }
607        /**
608         * Protobuf type {@code hadoop.common.RequestHeaderProto}
609         *
610         * <pre>
611         **
612         * This message is the header for the Protobuf Rpc Engine
613         * when sending a RPC request from  RPC client to the RPC server.
614         * The actual request (serialized as protobuf) follows this request.
615         *
616         * No special header is needed for the Rpc Response for Protobuf Rpc Engine.
617         * The normal RPC response header (see RpcHeader.proto) are sufficient.
618         * </pre>
619         */
620        public static final class Builder extends
621            com.google.protobuf.GeneratedMessage.Builder<Builder>
622           implements org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProtoOrBuilder {
623          public static final com.google.protobuf.Descriptors.Descriptor
624              getDescriptor() {
625            return org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.internal_static_hadoop_common_RequestHeaderProto_descriptor;
626          }
627
628          protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
629              internalGetFieldAccessorTable() {
630            return org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.internal_static_hadoop_common_RequestHeaderProto_fieldAccessorTable
631                .ensureFieldAccessorsInitialized(
632                    org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto.class, org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto.Builder.class);
633          }
634
635          // Construct using org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto.newBuilder()
636          private Builder() {
637            maybeForceBuilderInitialization();
638          }
639
640          private Builder(
641              com.google.protobuf.GeneratedMessage.BuilderParent parent) {
642            super(parent);
643            maybeForceBuilderInitialization();
644          }
645          private void maybeForceBuilderInitialization() {
646            if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
647            }
648          }
649          private static Builder create() {
650            return new Builder();
651          }
652
653          public Builder clear() {
654            super.clear();
655            methodName_ = "";
656            bitField0_ = (bitField0_ & ~0x00000001);
657            declaringClassProtocolName_ = "";
658            bitField0_ = (bitField0_ & ~0x00000002);
659            clientProtocolVersion_ = 0L;
660            bitField0_ = (bitField0_ & ~0x00000004);
661            return this;
662          }
663
664          public Builder clone() {
665            return create().mergeFrom(buildPartial());
666          }
667
668          public com.google.protobuf.Descriptors.Descriptor
669              getDescriptorForType() {
670            return org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.internal_static_hadoop_common_RequestHeaderProto_descriptor;
671          }
672
673          public org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto getDefaultInstanceForType() {
674            return org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto.getDefaultInstance();
675          }
676
677          public org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto build() {
678            org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto result = buildPartial();
679            if (!result.isInitialized()) {
680              throw newUninitializedMessageException(result);
681            }
682            return result;
683          }
684
685          public org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto buildPartial() {
686            org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto result = new org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto(this);
687            int from_bitField0_ = bitField0_;
688            int to_bitField0_ = 0;
689            if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
690              to_bitField0_ |= 0x00000001;
691            }
692            result.methodName_ = methodName_;
693            if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
694              to_bitField0_ |= 0x00000002;
695            }
696            result.declaringClassProtocolName_ = declaringClassProtocolName_;
697            if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
698              to_bitField0_ |= 0x00000004;
699            }
700            result.clientProtocolVersion_ = clientProtocolVersion_;
701            result.bitField0_ = to_bitField0_;
702            onBuilt();
703            return result;
704          }
705
706          public Builder mergeFrom(com.google.protobuf.Message other) {
707            if (other instanceof org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto) {
708              return mergeFrom((org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto)other);
709            } else {
710              super.mergeFrom(other);
711              return this;
712            }
713          }
714
715          public Builder mergeFrom(org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto other) {
716            if (other == org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto.getDefaultInstance()) return this;
717            if (other.hasMethodName()) {
718              bitField0_ |= 0x00000001;
719              methodName_ = other.methodName_;
720              onChanged();
721            }
722            if (other.hasDeclaringClassProtocolName()) {
723              bitField0_ |= 0x00000002;
724              declaringClassProtocolName_ = other.declaringClassProtocolName_;
725              onChanged();
726            }
727            if (other.hasClientProtocolVersion()) {
728              setClientProtocolVersion(other.getClientProtocolVersion());
729            }
730            this.mergeUnknownFields(other.getUnknownFields());
731            return this;
732          }
733
734          public final boolean isInitialized() {
735            if (!hasMethodName()) {
736
737              return false;
738            }
739            if (!hasDeclaringClassProtocolName()) {
740
741              return false;
742            }
743            if (!hasClientProtocolVersion()) {
744
745              return false;
746            }
747            return true;
748          }
749
750          public Builder mergeFrom(
751              com.google.protobuf.CodedInputStream input,
752              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
753              throws java.io.IOException {
754            org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto parsedMessage = null;
755            try {
756              parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
757            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
758              parsedMessage = (org.apache.hadoop.ipc.protobuf.ProtobufRpcEngineProtos.RequestHeaderProto) e.getUnfinishedMessage();
759              throw e;
760            } finally {
761              if (parsedMessage != null) {
762                mergeFrom(parsedMessage);
763              }
764            }
765            return this;
766          }
767          private int bitField0_;
768
769          // required string methodName = 1;
770          private java.lang.Object methodName_ = "";
771          /**
772           * <code>required string methodName = 1;</code>
773           *
774           * <pre>
775           ** Name of the RPC method
776           * </pre>
777           */
778          public boolean hasMethodName() {
779            return ((bitField0_ & 0x00000001) == 0x00000001);
780          }
781          /**
782           * <code>required string methodName = 1;</code>
783           *
784           * <pre>
785           ** Name of the RPC method
786           * </pre>
787           */
788          public java.lang.String getMethodName() {
789            java.lang.Object ref = methodName_;
790            if (!(ref instanceof java.lang.String)) {
791              java.lang.String s = ((com.google.protobuf.ByteString) ref)
792                  .toStringUtf8();
793              methodName_ = s;
794              return s;
795            } else {
796              return (java.lang.String) ref;
797            }
798          }
799          /**
800           * <code>required string methodName = 1;</code>
801           *
802           * <pre>
803           ** Name of the RPC method
804           * </pre>
805           */
806          public com.google.protobuf.ByteString
807              getMethodNameBytes() {
808            java.lang.Object ref = methodName_;
809            if (ref instanceof String) {
810              com.google.protobuf.ByteString b =
811                  com.google.protobuf.ByteString.copyFromUtf8(
812                      (java.lang.String) ref);
813              methodName_ = b;
814              return b;
815            } else {
816              return (com.google.protobuf.ByteString) ref;
817            }
818          }
819          /**
820           * <code>required string methodName = 1;</code>
821           *
822           * <pre>
823           ** Name of the RPC method
824           * </pre>
825           */
826          public Builder setMethodName(
827              java.lang.String value) {
828            if (value == null) {
829        throw new NullPointerException();
830      }
831      bitField0_ |= 0x00000001;
832            methodName_ = value;
833            onChanged();
834            return this;
835          }
836          /**
837           * <code>required string methodName = 1;</code>
838           *
839           * <pre>
840           ** Name of the RPC method
841           * </pre>
842           */
843          public Builder clearMethodName() {
844            bitField0_ = (bitField0_ & ~0x00000001);
845            methodName_ = getDefaultInstance().getMethodName();
846            onChanged();
847            return this;
848          }
849          /**
850           * <code>required string methodName = 1;</code>
851           *
852           * <pre>
853           ** Name of the RPC method
854           * </pre>
855           */
856          public Builder setMethodNameBytes(
857              com.google.protobuf.ByteString value) {
858            if (value == null) {
859        throw new NullPointerException();
860      }
861      bitField0_ |= 0x00000001;
862            methodName_ = value;
863            onChanged();
864            return this;
865          }
866
867          // required string declaringClassProtocolName = 2;
868          private java.lang.Object declaringClassProtocolName_ = "";
869          /**
870           * <code>required string declaringClassProtocolName = 2;</code>
871           *
872           * <pre>
873           **
874           * RPCs for a particular interface (ie protocol) are done using a
875           * IPC connection that is setup using rpcProxy.
876           * The rpcProxy's has a declared protocol name that is
877           * sent form client to server at connection time.
878           *
879           * Each Rpc call also sends a protocol name
880           * (called declaringClassprotocolName). This name is usually the same
881           * as the connection protocol name except in some cases.
882           * For example metaProtocols such ProtocolInfoProto which get metainfo
883           * about the protocol reuse the connection but need to indicate that
884           * the actual protocol is different (i.e. the protocol is
885           * ProtocolInfoProto) since they reuse the connection; in this case
886           * the declaringClassProtocolName field is set to the ProtocolInfoProto
887           * </pre>
888           */
889          public boolean hasDeclaringClassProtocolName() {
890            return ((bitField0_ & 0x00000002) == 0x00000002);
891          }
892          /**
893           * <code>required string declaringClassProtocolName = 2;</code>
894           *
895           * <pre>
896           **
897           * RPCs for a particular interface (ie protocol) are done using a
898           * IPC connection that is setup using rpcProxy.
899           * The rpcProxy's has a declared protocol name that is
900           * sent form client to server at connection time.
901           *
902           * Each Rpc call also sends a protocol name
903           * (called declaringClassprotocolName). This name is usually the same
904           * as the connection protocol name except in some cases.
905           * For example metaProtocols such ProtocolInfoProto which get metainfo
906           * about the protocol reuse the connection but need to indicate that
907           * the actual protocol is different (i.e. the protocol is
908           * ProtocolInfoProto) since they reuse the connection; in this case
909           * the declaringClassProtocolName field is set to the ProtocolInfoProto
910           * </pre>
911           */
912          public java.lang.String getDeclaringClassProtocolName() {
913            java.lang.Object ref = declaringClassProtocolName_;
914            if (!(ref instanceof java.lang.String)) {
915              java.lang.String s = ((com.google.protobuf.ByteString) ref)
916                  .toStringUtf8();
917              declaringClassProtocolName_ = s;
918              return s;
919            } else {
920              return (java.lang.String) ref;
921            }
922          }
923          /**
924           * <code>required string declaringClassProtocolName = 2;</code>
925           *
926           * <pre>
927           **
928           * RPCs for a particular interface (ie protocol) are done using a
929           * IPC connection that is setup using rpcProxy.
930           * The rpcProxy's has a declared protocol name that is
931           * sent form client to server at connection time.
932           *
933           * Each Rpc call also sends a protocol name
934           * (called declaringClassprotocolName). This name is usually the same
935           * as the connection protocol name except in some cases.
936           * For example metaProtocols such ProtocolInfoProto which get metainfo
937           * about the protocol reuse the connection but need to indicate that
938           * the actual protocol is different (i.e. the protocol is
939           * ProtocolInfoProto) since they reuse the connection; in this case
940           * the declaringClassProtocolName field is set to the ProtocolInfoProto
941           * </pre>
942           */
943          public com.google.protobuf.ByteString
944              getDeclaringClassProtocolNameBytes() {
945            java.lang.Object ref = declaringClassProtocolName_;
946            if (ref instanceof String) {
947              com.google.protobuf.ByteString b =
948                  com.google.protobuf.ByteString.copyFromUtf8(
949                      (java.lang.String) ref);
950              declaringClassProtocolName_ = b;
951              return b;
952            } else {
953              return (com.google.protobuf.ByteString) ref;
954            }
955          }
956          /**
957           * <code>required string declaringClassProtocolName = 2;</code>
958           *
959           * <pre>
960           **
961           * RPCs for a particular interface (ie protocol) are done using a
962           * IPC connection that is setup using rpcProxy.
963           * The rpcProxy's has a declared protocol name that is
964           * sent form client to server at connection time.
965           *
966           * Each Rpc call also sends a protocol name
967           * (called declaringClassprotocolName). This name is usually the same
968           * as the connection protocol name except in some cases.
969           * For example metaProtocols such ProtocolInfoProto which get metainfo
970           * about the protocol reuse the connection but need to indicate that
971           * the actual protocol is different (i.e. the protocol is
972           * ProtocolInfoProto) since they reuse the connection; in this case
973           * the declaringClassProtocolName field is set to the ProtocolInfoProto
974           * </pre>
975           */
976          public Builder setDeclaringClassProtocolName(
977              java.lang.String value) {
978            if (value == null) {
979        throw new NullPointerException();
980      }
981      bitField0_ |= 0x00000002;
982            declaringClassProtocolName_ = value;
983            onChanged();
984            return this;
985          }
986          /**
987           * <code>required string declaringClassProtocolName = 2;</code>
988           *
989           * <pre>
990           **
991           * RPCs for a particular interface (ie protocol) are done using a
992           * IPC connection that is setup using rpcProxy.
993           * The rpcProxy's has a declared protocol name that is
994           * sent form client to server at connection time.
995           *
996           * Each Rpc call also sends a protocol name
997           * (called declaringClassprotocolName). This name is usually the same
998           * as the connection protocol name except in some cases.
999           * For example metaProtocols such ProtocolInfoProto which get metainfo
1000           * about the protocol reuse the connection but need to indicate that
1001           * the actual protocol is different (i.e. the protocol is
1002           * ProtocolInfoProto) since they reuse the connection; in this case
1003           * the declaringClassProtocolName field is set to the ProtocolInfoProto
1004           * </pre>
1005           */
1006          public Builder clearDeclaringClassProtocolName() {
1007            bitField0_ = (bitField0_ & ~0x00000002);
1008            declaringClassProtocolName_ = getDefaultInstance().getDeclaringClassProtocolName();
1009            onChanged();
1010            return this;
1011          }
1012          /**
1013           * <code>required string declaringClassProtocolName = 2;</code>
1014           *
1015           * <pre>
1016           **
1017           * RPCs for a particular interface (ie protocol) are done using a
1018           * IPC connection that is setup using rpcProxy.
1019           * The rpcProxy's has a declared protocol name that is
1020           * sent form client to server at connection time.
1021           *
1022           * Each Rpc call also sends a protocol name
1023           * (called declaringClassprotocolName). This name is usually the same
1024           * as the connection protocol name except in some cases.
1025           * For example metaProtocols such ProtocolInfoProto which get metainfo
1026           * about the protocol reuse the connection but need to indicate that
1027           * the actual protocol is different (i.e. the protocol is
1028           * ProtocolInfoProto) since they reuse the connection; in this case
1029           * the declaringClassProtocolName field is set to the ProtocolInfoProto
1030           * </pre>
1031           */
1032          public Builder setDeclaringClassProtocolNameBytes(
1033              com.google.protobuf.ByteString value) {
1034            if (value == null) {
1035        throw new NullPointerException();
1036      }
1037      bitField0_ |= 0x00000002;
1038            declaringClassProtocolName_ = value;
1039            onChanged();
1040            return this;
1041          }
1042
1043          // required uint64 clientProtocolVersion = 3;
1044          private long clientProtocolVersion_ ;
1045          /**
1046           * <code>required uint64 clientProtocolVersion = 3;</code>
1047           *
1048           * <pre>
1049           ** protocol version of class declaring the called method
1050           * </pre>
1051           */
1052          public boolean hasClientProtocolVersion() {
1053            return ((bitField0_ & 0x00000004) == 0x00000004);
1054          }
1055          /**
1056           * <code>required uint64 clientProtocolVersion = 3;</code>
1057           *
1058           * <pre>
1059           ** protocol version of class declaring the called method
1060           * </pre>
1061           */
1062          public long getClientProtocolVersion() {
1063            return clientProtocolVersion_;
1064          }
1065          /**
1066           * <code>required uint64 clientProtocolVersion = 3;</code>
1067           *
1068           * <pre>
1069           ** protocol version of class declaring the called method
1070           * </pre>
1071           */
1072          public Builder setClientProtocolVersion(long value) {
1073            bitField0_ |= 0x00000004;
1074            clientProtocolVersion_ = value;
1075            onChanged();
1076            return this;
1077          }
1078          /**
1079           * <code>required uint64 clientProtocolVersion = 3;</code>
1080           *
1081           * <pre>
1082           ** protocol version of class declaring the called method
1083           * </pre>
1084           */
1085          public Builder clearClientProtocolVersion() {
1086            bitField0_ = (bitField0_ & ~0x00000004);
1087            clientProtocolVersion_ = 0L;
1088            onChanged();
1089            return this;
1090          }
1091
1092          // @@protoc_insertion_point(builder_scope:hadoop.common.RequestHeaderProto)
1093        }
1094
1095        static {
1096          defaultInstance = new RequestHeaderProto(true);
1097          defaultInstance.initFields();
1098        }
1099
1100        // @@protoc_insertion_point(class_scope:hadoop.common.RequestHeaderProto)
1101      }
1102
1103      private static com.google.protobuf.Descriptors.Descriptor
1104        internal_static_hadoop_common_RequestHeaderProto_descriptor;
1105      private static
1106        com.google.protobuf.GeneratedMessage.FieldAccessorTable
1107          internal_static_hadoop_common_RequestHeaderProto_fieldAccessorTable;
1108
1109      public static com.google.protobuf.Descriptors.FileDescriptor
1110          getDescriptor() {
1111        return descriptor;
1112      }
1113      private static com.google.protobuf.Descriptors.FileDescriptor
1114          descriptor;
1115      static {
1116        java.lang.String[] descriptorData = {
1117          "\n\027ProtobufRpcEngine.proto\022\rhadoop.common" +
1118          "\"k\n\022RequestHeaderProto\022\022\n\nmethodName\030\001 \002" +
1119          "(\t\022\"\n\032declaringClassProtocolName\030\002 \002(\t\022\035" +
1120          "\n\025clientProtocolVersion\030\003 \002(\004B<\n\036org.apa" +
1121          "che.hadoop.ipc.protobufB\027ProtobufRpcEngi" +
1122          "neProtos\240\001\001"
1123        };
1124        com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
1125          new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
1126            public com.google.protobuf.ExtensionRegistry assignDescriptors(
1127                com.google.protobuf.Descriptors.FileDescriptor root) {
1128              descriptor = root;
1129              internal_static_hadoop_common_RequestHeaderProto_descriptor =
1130                getDescriptor().getMessageTypes().get(0);
1131              internal_static_hadoop_common_RequestHeaderProto_fieldAccessorTable = new
1132                com.google.protobuf.GeneratedMessage.FieldAccessorTable(
1133                  internal_static_hadoop_common_RequestHeaderProto_descriptor,
1134                  new java.lang.String[] { "MethodName", "DeclaringClassProtocolName", "ClientProtocolVersion", });
1135              return null;
1136            }
1137          };
1138        com.google.protobuf.Descriptors.FileDescriptor
1139          .internalBuildGeneratedFileFrom(descriptorData,
1140            new com.google.protobuf.Descriptors.FileDescriptor[] {
1141            }, assigner);
1142      }
1143
1144      // @@protoc_insertion_point(outer_class_scope)
1145    }


text:
package dbutils

import (
	"fmt"
	"reflect"

	"github.com/cosiner/gomodel"
	"github.com/cosiner/gomodel/dberrs"
	"github.com/cosiner/gomodel/utils"
)

func QueryOneResultById(exec gomodel.Executor, sqlid uint64, ptr interface{}, args ...interface{}) error {
	sc := exec.QueryById(sqlid, args...)
	defer sc.Close()
	return sc.One(ptr)
}

func QueryCountById(exec gomodel.Executor, sqlid uint64, args ...interface{}) (int64, error) {
	var count int64
	err := QueryOneResultById(exec, sqlid, &count, args...)
	return count, err
}

type CondOption struct {
	OtherFields    uint64
	CondFields     []uint64
	CondArgIndexes []int
	Args           []interface{}
}

func (opt CondOption) CondArgs() (uint64, []interface{}) {
	var (
		skipped     int
		otherFields = opt.OtherFields
		args        = opt.Args
		indexes     = opt.CondArgIndexes
	)

	for i, condField := range opt.CondFields {
		var usable bool
		index := indexes[i] - skipped
		switch val := opt.Args[index].(type) {
		case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64:
			usable = val != 0
		case string:
			usable = val != ""
		case bool:
			usable = val
		default:
			panic("unsupported type: " + reflect.TypeOf(args[index]).String())
		}

		if usable {
			otherFields |= condField
		} else {
			args = utils.RemoveSliceItem(args, index)
			skipped++
		}
	}
	return otherFields, args
}

func CondArgs(otherFields uint64, condFields []uint64, condArgIndex []int, args []interface{}) (uint64, []interface{}) {
	opt := (CondOption{
		OtherFields:    otherFields,
		CondFields:     condFields,
		CondArgIndexes: condArgIndex,
		Args:           args,
	})
	return opt.CondArgs()
}

func CheckFieldForIncrBy(field, fields uint64, count int64) error {
	if gomodel.NumFields(field) == 0 || field&fields == 0 {
		return fmt.Errorf("unexpected field type %d", field)
	}

	if count != -1 && count != 1 {
		return fmt.Errorf("unexpected field incrby count %d, must be -1 or 1", count)
	}
	return nil
}

type IncrByFunc func(exec gomodel.Executor, field uint64, whereArgs ...interface{}) error

func FuncForIncrByFieldCount(defaultRunner gomodel.Executor, model gomodel.Model, fields, whereFields uint64, noAffectsError error) IncrByFunc {
	return func(exec gomodel.Executor, field uint64, whereArgs ...interface{}) error {
		var count int64
		switch arg := whereArgs[0].(type) {
		case int:
			count = int64(arg)
		case int8:
			count = int64(arg)
		case int16:
			count = int64(arg)
		case int32:
			count = int64(arg)
		case int64:
			count = int64(arg)
		case uint8:
			count = int64(arg)
		case uint16:
			count = int64(arg)
		case uint32:
			count = int64(arg)
		case uint64:
			count = int64(arg)
		default:
			return fmt.Errorf("count %v must be an integer", arg)
		}
		err := CheckFieldForIncrBy(field, fields, count)
		if err != nil {
			return err
		}

		if exec == nil {
			exec = defaultRunner
		}
		c, err := exec.ArgsIncrBy(model, field, whereFields, whereArgs...)
		return dberrs.NoAffects(c, err, noAffectsError)
	}
}

redpajama_set_name: RedPajamaGithub