go.uber.org/yarpc@v1.72.1/encoding/protobuf/internal/testpb/test.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: encoding/protobuf/internal/testpb/test.proto 3 4 // Copyright (c) 2022 Uber Technologies, Inc. 5 // 6 // Permission is hereby granted, free of charge, to any person obtaining a copy 7 // of this software and associated documentation files (the "Software"), to deal 8 // in the Software without restriction, including without limitation the rights 9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 // copies of the Software, and to permit persons to whom the Software is 11 // furnished to do so, subject to the following conditions: 12 // 13 // The above copyright notice and this permission notice shall be included in 14 // all copies or substantial portions of the Software. 15 // 16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 // THE SOFTWARE. 23 24 package testpb 25 26 import ( 27 context "context" 28 fmt "fmt" 29 proto "github.com/gogo/protobuf/proto" 30 grpc "google.golang.org/grpc" 31 codes "google.golang.org/grpc/codes" 32 status "google.golang.org/grpc/status" 33 io "io" 34 math "math" 35 math_bits "math/bits" 36 reflect "reflect" 37 strings "strings" 38 ) 39 40 // Reference imports to suppress errors if they are not otherwise used. 41 var _ = proto.Marshal 42 var _ = fmt.Errorf 43 var _ = math.Inf 44 45 // This is a compile-time assertion to ensure that this generated file 46 // is compatible with the proto package it is being compiled against. 47 // A compilation error at this line likely means your copy of the 48 // proto package needs to be updated. 49 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 50 51 type TestMessage struct { 52 Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` 53 } 54 55 func (m *TestMessage) Reset() { *m = TestMessage{} } 56 func (*TestMessage) ProtoMessage() {} 57 func (*TestMessage) Descriptor() ([]byte, []int) { 58 return fileDescriptor_fc320162ebaf2b25, []int{0} 59 } 60 func (m *TestMessage) XXX_Unmarshal(b []byte) error { 61 return m.Unmarshal(b) 62 } 63 func (m *TestMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 64 if deterministic { 65 return xxx_messageInfo_TestMessage.Marshal(b, m, deterministic) 66 } else { 67 b = b[:cap(b)] 68 n, err := m.MarshalToSizedBuffer(b) 69 if err != nil { 70 return nil, err 71 } 72 return b[:n], nil 73 } 74 } 75 func (m *TestMessage) XXX_Merge(src proto.Message) { 76 xxx_messageInfo_TestMessage.Merge(m, src) 77 } 78 func (m *TestMessage) XXX_Size() int { 79 return m.Size() 80 } 81 func (m *TestMessage) XXX_DiscardUnknown() { 82 xxx_messageInfo_TestMessage.DiscardUnknown(m) 83 } 84 85 var xxx_messageInfo_TestMessage proto.InternalMessageInfo 86 87 func (m *TestMessage) GetValue() string { 88 if m != nil { 89 return m.Value 90 } 91 return "" 92 } 93 94 func init() { 95 proto.RegisterType((*TestMessage)(nil), "uber.yarpc.encoding.protobuf.TestMessage") 96 } 97 98 func init() { 99 proto.RegisterFile("encoding/protobuf/internal/testpb/test.proto", fileDescriptor_fc320162ebaf2b25) 100 } 101 102 var fileDescriptor_fc320162ebaf2b25 = []byte{ 103 // 226 bytes of a gzipped FileDescriptorProto 104 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x49, 0xcd, 0x4b, 0xce, 105 0x4f, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0xcf, 0xcc, 106 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x2f, 0x49, 0x2d, 0x2e, 0x29, 0x48, 0x02, 0x53, 0x7a, 107 0x60, 0x59, 0x21, 0x99, 0xd2, 0xa4, 0xd4, 0x22, 0xbd, 0xca, 0xc4, 0xa2, 0x82, 0x64, 0x3d, 0x98, 108 0x46, 0x3d, 0x98, 0x46, 0x25, 0x65, 0x2e, 0xee, 0x90, 0xd4, 0xe2, 0x12, 0xdf, 0xd4, 0xe2, 0xe2, 109 0xc4, 0xf4, 0x54, 0x21, 0x11, 0x2e, 0xd6, 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, 0x05, 0x46, 110 0x0d, 0xce, 0x20, 0x08, 0xc7, 0xe8, 0x24, 0x23, 0x17, 0x0b, 0x48, 0x95, 0x50, 0x2c, 0x17, 0x6b, 111 0x68, 0x5e, 0x62, 0x51, 0xa5, 0x90, 0xa6, 0x1e, 0x3e, 0x53, 0xf5, 0x90, 0x8c, 0x94, 0x22, 0x5e, 112 0xa9, 0x50, 0x12, 0x17, 0x9b, 0x4b, 0x69, 0x41, 0x4e, 0x6a, 0x05, 0x6d, 0xcc, 0xd7, 0x60, 0x34, 113 0x60, 0x74, 0xb2, 0xb9, 0xf0, 0x50, 0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x0f, 0x0f, 0xe5, 0x18, 114 0x1b, 0x1e, 0xc9, 0x31, 0xae, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 115 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xbe, 0x78, 0x24, 0xc7, 0xf0, 0xe1, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 116 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xc5, 0x06, 0x09, 0xd7, 0x24, 117 0x36, 0xb0, 0xb9, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x19, 0x33, 0xd9, 0x83, 0x01, 118 0x00, 0x00, 119 } 120 121 func (this *TestMessage) Equal(that interface{}) bool { 122 if that == nil { 123 return this == nil 124 } 125 126 that1, ok := that.(*TestMessage) 127 if !ok { 128 that2, ok := that.(TestMessage) 129 if ok { 130 that1 = &that2 131 } else { 132 return false 133 } 134 } 135 if that1 == nil { 136 return this == nil 137 } else if this == nil { 138 return false 139 } 140 if this.Value != that1.Value { 141 return false 142 } 143 return true 144 } 145 func (this *TestMessage) GoString() string { 146 if this == nil { 147 return "nil" 148 } 149 s := make([]string, 0, 5) 150 s = append(s, "&testpb.TestMessage{") 151 s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") 152 s = append(s, "}") 153 return strings.Join(s, "") 154 } 155 func valueToGoStringTest(v interface{}, typ string) string { 156 rv := reflect.ValueOf(v) 157 if rv.IsNil() { 158 return "nil" 159 } 160 pv := reflect.Indirect(rv).Interface() 161 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 162 } 163 164 // Reference imports to suppress errors if they are not otherwise used. 165 var _ context.Context 166 var _ grpc.ClientConn 167 168 // This is a compile-time assertion to ensure that this generated file 169 // is compatible with the grpc package it is being compiled against. 170 const _ = grpc.SupportPackageIsVersion4 171 172 // TestClient is the client API for Test service. 173 // 174 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 175 type TestClient interface { 176 Unary(ctx context.Context, in *TestMessage, opts ...grpc.CallOption) (*TestMessage, error) 177 Duplex(ctx context.Context, opts ...grpc.CallOption) (Test_DuplexClient, error) 178 } 179 180 type testClient struct { 181 cc *grpc.ClientConn 182 } 183 184 func NewTestClient(cc *grpc.ClientConn) TestClient { 185 return &testClient{cc} 186 } 187 188 func (c *testClient) Unary(ctx context.Context, in *TestMessage, opts ...grpc.CallOption) (*TestMessage, error) { 189 out := new(TestMessage) 190 err := c.cc.Invoke(ctx, "/uber.yarpc.encoding.protobuf.Test/Unary", in, out, opts...) 191 if err != nil { 192 return nil, err 193 } 194 return out, nil 195 } 196 197 func (c *testClient) Duplex(ctx context.Context, opts ...grpc.CallOption) (Test_DuplexClient, error) { 198 stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[0], "/uber.yarpc.encoding.protobuf.Test/Duplex", opts...) 199 if err != nil { 200 return nil, err 201 } 202 x := &testDuplexClient{stream} 203 return x, nil 204 } 205 206 type Test_DuplexClient interface { 207 Send(*TestMessage) error 208 Recv() (*TestMessage, error) 209 grpc.ClientStream 210 } 211 212 type testDuplexClient struct { 213 grpc.ClientStream 214 } 215 216 func (x *testDuplexClient) Send(m *TestMessage) error { 217 return x.ClientStream.SendMsg(m) 218 } 219 220 func (x *testDuplexClient) Recv() (*TestMessage, error) { 221 m := new(TestMessage) 222 if err := x.ClientStream.RecvMsg(m); err != nil { 223 return nil, err 224 } 225 return m, nil 226 } 227 228 // TestServer is the server API for Test service. 229 type TestServer interface { 230 Unary(context.Context, *TestMessage) (*TestMessage, error) 231 Duplex(Test_DuplexServer) error 232 } 233 234 // UnimplementedTestServer can be embedded to have forward compatible implementations. 235 type UnimplementedTestServer struct { 236 } 237 238 func (*UnimplementedTestServer) Unary(ctx context.Context, req *TestMessage) (*TestMessage, error) { 239 return nil, status.Errorf(codes.Unimplemented, "method Unary not implemented") 240 } 241 func (*UnimplementedTestServer) Duplex(srv Test_DuplexServer) error { 242 return status.Errorf(codes.Unimplemented, "method Duplex not implemented") 243 } 244 245 func RegisterTestServer(s *grpc.Server, srv TestServer) { 246 s.RegisterService(&_Test_serviceDesc, srv) 247 } 248 249 func _Test_Unary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 250 in := new(TestMessage) 251 if err := dec(in); err != nil { 252 return nil, err 253 } 254 if interceptor == nil { 255 return srv.(TestServer).Unary(ctx, in) 256 } 257 info := &grpc.UnaryServerInfo{ 258 Server: srv, 259 FullMethod: "/uber.yarpc.encoding.protobuf.Test/Unary", 260 } 261 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 262 return srv.(TestServer).Unary(ctx, req.(*TestMessage)) 263 } 264 return interceptor(ctx, in, info, handler) 265 } 266 267 func _Test_Duplex_Handler(srv interface{}, stream grpc.ServerStream) error { 268 return srv.(TestServer).Duplex(&testDuplexServer{stream}) 269 } 270 271 type Test_DuplexServer interface { 272 Send(*TestMessage) error 273 Recv() (*TestMessage, error) 274 grpc.ServerStream 275 } 276 277 type testDuplexServer struct { 278 grpc.ServerStream 279 } 280 281 func (x *testDuplexServer) Send(m *TestMessage) error { 282 return x.ServerStream.SendMsg(m) 283 } 284 285 func (x *testDuplexServer) Recv() (*TestMessage, error) { 286 m := new(TestMessage) 287 if err := x.ServerStream.RecvMsg(m); err != nil { 288 return nil, err 289 } 290 return m, nil 291 } 292 293 var _Test_serviceDesc = grpc.ServiceDesc{ 294 ServiceName: "uber.yarpc.encoding.protobuf.Test", 295 HandlerType: (*TestServer)(nil), 296 Methods: []grpc.MethodDesc{ 297 { 298 MethodName: "Unary", 299 Handler: _Test_Unary_Handler, 300 }, 301 }, 302 Streams: []grpc.StreamDesc{ 303 { 304 StreamName: "Duplex", 305 Handler: _Test_Duplex_Handler, 306 ServerStreams: true, 307 ClientStreams: true, 308 }, 309 }, 310 Metadata: "encoding/protobuf/internal/testpb/test.proto", 311 } 312 313 func (m *TestMessage) Marshal() (dAtA []byte, err error) { 314 size := m.Size() 315 dAtA = make([]byte, size) 316 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 317 if err != nil { 318 return nil, err 319 } 320 return dAtA[:n], nil 321 } 322 323 func (m *TestMessage) MarshalTo(dAtA []byte) (int, error) { 324 size := m.Size() 325 return m.MarshalToSizedBuffer(dAtA[:size]) 326 } 327 328 func (m *TestMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { 329 i := len(dAtA) 330 _ = i 331 var l int 332 _ = l 333 if len(m.Value) > 0 { 334 i -= len(m.Value) 335 copy(dAtA[i:], m.Value) 336 i = encodeVarintTest(dAtA, i, uint64(len(m.Value))) 337 i-- 338 dAtA[i] = 0xa 339 } 340 return len(dAtA) - i, nil 341 } 342 343 func encodeVarintTest(dAtA []byte, offset int, v uint64) int { 344 offset -= sovTest(v) 345 base := offset 346 for v >= 1<<7 { 347 dAtA[offset] = uint8(v&0x7f | 0x80) 348 v >>= 7 349 offset++ 350 } 351 dAtA[offset] = uint8(v) 352 return base 353 } 354 func (m *TestMessage) Size() (n int) { 355 if m == nil { 356 return 0 357 } 358 var l int 359 _ = l 360 l = len(m.Value) 361 if l > 0 { 362 n += 1 + l + sovTest(uint64(l)) 363 } 364 return n 365 } 366 367 func sovTest(x uint64) (n int) { 368 return (math_bits.Len64(x|1) + 6) / 7 369 } 370 func sozTest(x uint64) (n int) { 371 return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 372 } 373 func (this *TestMessage) String() string { 374 if this == nil { 375 return "nil" 376 } 377 s := strings.Join([]string{`&TestMessage{`, 378 `Value:` + fmt.Sprintf("%v", this.Value) + `,`, 379 `}`, 380 }, "") 381 return s 382 } 383 func valueToStringTest(v interface{}) string { 384 rv := reflect.ValueOf(v) 385 if rv.IsNil() { 386 return "nil" 387 } 388 pv := reflect.Indirect(rv).Interface() 389 return fmt.Sprintf("*%v", pv) 390 } 391 func (m *TestMessage) Unmarshal(dAtA []byte) error { 392 l := len(dAtA) 393 iNdEx := 0 394 for iNdEx < l { 395 preIndex := iNdEx 396 var wire uint64 397 for shift := uint(0); ; shift += 7 { 398 if shift >= 64 { 399 return ErrIntOverflowTest 400 } 401 if iNdEx >= l { 402 return io.ErrUnexpectedEOF 403 } 404 b := dAtA[iNdEx] 405 iNdEx++ 406 wire |= uint64(b&0x7F) << shift 407 if b < 0x80 { 408 break 409 } 410 } 411 fieldNum := int32(wire >> 3) 412 wireType := int(wire & 0x7) 413 if wireType == 4 { 414 return fmt.Errorf("proto: TestMessage: wiretype end group for non-group") 415 } 416 if fieldNum <= 0 { 417 return fmt.Errorf("proto: TestMessage: illegal tag %d (wire type %d)", fieldNum, wire) 418 } 419 switch fieldNum { 420 case 1: 421 if wireType != 2 { 422 return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) 423 } 424 var stringLen uint64 425 for shift := uint(0); ; shift += 7 { 426 if shift >= 64 { 427 return ErrIntOverflowTest 428 } 429 if iNdEx >= l { 430 return io.ErrUnexpectedEOF 431 } 432 b := dAtA[iNdEx] 433 iNdEx++ 434 stringLen |= uint64(b&0x7F) << shift 435 if b < 0x80 { 436 break 437 } 438 } 439 intStringLen := int(stringLen) 440 if intStringLen < 0 { 441 return ErrInvalidLengthTest 442 } 443 postIndex := iNdEx + intStringLen 444 if postIndex < 0 { 445 return ErrInvalidLengthTest 446 } 447 if postIndex > l { 448 return io.ErrUnexpectedEOF 449 } 450 m.Value = string(dAtA[iNdEx:postIndex]) 451 iNdEx = postIndex 452 default: 453 iNdEx = preIndex 454 skippy, err := skipTest(dAtA[iNdEx:]) 455 if err != nil { 456 return err 457 } 458 if skippy < 0 { 459 return ErrInvalidLengthTest 460 } 461 if (iNdEx + skippy) < 0 { 462 return ErrInvalidLengthTest 463 } 464 if (iNdEx + skippy) > l { 465 return io.ErrUnexpectedEOF 466 } 467 iNdEx += skippy 468 } 469 } 470 471 if iNdEx > l { 472 return io.ErrUnexpectedEOF 473 } 474 return nil 475 } 476 func skipTest(dAtA []byte) (n int, err error) { 477 l := len(dAtA) 478 iNdEx := 0 479 depth := 0 480 for iNdEx < l { 481 var wire uint64 482 for shift := uint(0); ; shift += 7 { 483 if shift >= 64 { 484 return 0, ErrIntOverflowTest 485 } 486 if iNdEx >= l { 487 return 0, io.ErrUnexpectedEOF 488 } 489 b := dAtA[iNdEx] 490 iNdEx++ 491 wire |= (uint64(b) & 0x7F) << shift 492 if b < 0x80 { 493 break 494 } 495 } 496 wireType := int(wire & 0x7) 497 switch wireType { 498 case 0: 499 for shift := uint(0); ; shift += 7 { 500 if shift >= 64 { 501 return 0, ErrIntOverflowTest 502 } 503 if iNdEx >= l { 504 return 0, io.ErrUnexpectedEOF 505 } 506 iNdEx++ 507 if dAtA[iNdEx-1] < 0x80 { 508 break 509 } 510 } 511 case 1: 512 iNdEx += 8 513 case 2: 514 var length int 515 for shift := uint(0); ; shift += 7 { 516 if shift >= 64 { 517 return 0, ErrIntOverflowTest 518 } 519 if iNdEx >= l { 520 return 0, io.ErrUnexpectedEOF 521 } 522 b := dAtA[iNdEx] 523 iNdEx++ 524 length |= (int(b) & 0x7F) << shift 525 if b < 0x80 { 526 break 527 } 528 } 529 if length < 0 { 530 return 0, ErrInvalidLengthTest 531 } 532 iNdEx += length 533 case 3: 534 depth++ 535 case 4: 536 if depth == 0 { 537 return 0, ErrUnexpectedEndOfGroupTest 538 } 539 depth-- 540 case 5: 541 iNdEx += 4 542 default: 543 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 544 } 545 if iNdEx < 0 { 546 return 0, ErrInvalidLengthTest 547 } 548 if depth == 0 { 549 return iNdEx, nil 550 } 551 } 552 return 0, io.ErrUnexpectedEOF 553 } 554 555 var ( 556 ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling") 557 ErrIntOverflowTest = fmt.Errorf("proto: integer overflow") 558 ErrUnexpectedEndOfGroupTest = fmt.Errorf("proto: unexpected end of group") 559 )