github.com/kaisenlinux/docker@v0.0.0-20230510090727-ea55db55fac7/swarmkit/api/health.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: github.com/docker/swarmkit/api/health.proto 3 4 package api 5 6 import ( 7 context "context" 8 fmt "fmt" 9 raftselector "github.com/docker/swarmkit/manager/raftselector" 10 _ "github.com/docker/swarmkit/protobuf/plugin" 11 _ "github.com/gogo/protobuf/gogoproto" 12 proto "github.com/gogo/protobuf/proto" 13 grpc "google.golang.org/grpc" 14 codes "google.golang.org/grpc/codes" 15 metadata "google.golang.org/grpc/metadata" 16 peer "google.golang.org/grpc/peer" 17 status "google.golang.org/grpc/status" 18 io "io" 19 math "math" 20 reflect "reflect" 21 strings "strings" 22 rafttime "time" 23 ) 24 25 // Reference imports to suppress errors if they are not otherwise used. 26 var _ = proto.Marshal 27 var _ = fmt.Errorf 28 var _ = math.Inf 29 30 // This is a compile-time assertion to ensure that this generated file 31 // is compatible with the proto package it is being compiled against. 32 // A compilation error at this line likely means your copy of the 33 // proto package needs to be updated. 34 const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package 35 36 type HealthCheckResponse_ServingStatus int32 37 38 const ( 39 HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 40 HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 41 HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 42 ) 43 44 var HealthCheckResponse_ServingStatus_name = map[int32]string{ 45 0: "UNKNOWN", 46 1: "SERVING", 47 2: "NOT_SERVING", 48 } 49 50 var HealthCheckResponse_ServingStatus_value = map[string]int32{ 51 "UNKNOWN": 0, 52 "SERVING": 1, 53 "NOT_SERVING": 2, 54 } 55 56 func (x HealthCheckResponse_ServingStatus) String() string { 57 return proto.EnumName(HealthCheckResponse_ServingStatus_name, int32(x)) 58 } 59 60 func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { 61 return fileDescriptor_288522a148aed5ad, []int{1, 0} 62 } 63 64 type HealthCheckRequest struct { 65 Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` 66 } 67 68 func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } 69 func (*HealthCheckRequest) ProtoMessage() {} 70 func (*HealthCheckRequest) Descriptor() ([]byte, []int) { 71 return fileDescriptor_288522a148aed5ad, []int{0} 72 } 73 func (m *HealthCheckRequest) XXX_Unmarshal(b []byte) error { 74 return m.Unmarshal(b) 75 } 76 func (m *HealthCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 77 if deterministic { 78 return xxx_messageInfo_HealthCheckRequest.Marshal(b, m, deterministic) 79 } else { 80 b = b[:cap(b)] 81 n, err := m.MarshalTo(b) 82 if err != nil { 83 return nil, err 84 } 85 return b[:n], nil 86 } 87 } 88 func (m *HealthCheckRequest) XXX_Merge(src proto.Message) { 89 xxx_messageInfo_HealthCheckRequest.Merge(m, src) 90 } 91 func (m *HealthCheckRequest) XXX_Size() int { 92 return m.Size() 93 } 94 func (m *HealthCheckRequest) XXX_DiscardUnknown() { 95 xxx_messageInfo_HealthCheckRequest.DiscardUnknown(m) 96 } 97 98 var xxx_messageInfo_HealthCheckRequest proto.InternalMessageInfo 99 100 type HealthCheckResponse struct { 101 Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=docker.swarmkit.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` 102 } 103 104 func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } 105 func (*HealthCheckResponse) ProtoMessage() {} 106 func (*HealthCheckResponse) Descriptor() ([]byte, []int) { 107 return fileDescriptor_288522a148aed5ad, []int{1} 108 } 109 func (m *HealthCheckResponse) XXX_Unmarshal(b []byte) error { 110 return m.Unmarshal(b) 111 } 112 func (m *HealthCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 113 if deterministic { 114 return xxx_messageInfo_HealthCheckResponse.Marshal(b, m, deterministic) 115 } else { 116 b = b[:cap(b)] 117 n, err := m.MarshalTo(b) 118 if err != nil { 119 return nil, err 120 } 121 return b[:n], nil 122 } 123 } 124 func (m *HealthCheckResponse) XXX_Merge(src proto.Message) { 125 xxx_messageInfo_HealthCheckResponse.Merge(m, src) 126 } 127 func (m *HealthCheckResponse) XXX_Size() int { 128 return m.Size() 129 } 130 func (m *HealthCheckResponse) XXX_DiscardUnknown() { 131 xxx_messageInfo_HealthCheckResponse.DiscardUnknown(m) 132 } 133 134 var xxx_messageInfo_HealthCheckResponse proto.InternalMessageInfo 135 136 func init() { 137 proto.RegisterEnum("docker.swarmkit.v1.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value) 138 proto.RegisterType((*HealthCheckRequest)(nil), "docker.swarmkit.v1.HealthCheckRequest") 139 proto.RegisterType((*HealthCheckResponse)(nil), "docker.swarmkit.v1.HealthCheckResponse") 140 } 141 142 func init() { 143 proto.RegisterFile("github.com/docker/swarmkit/api/health.proto", fileDescriptor_288522a148aed5ad) 144 } 145 146 var fileDescriptor_288522a148aed5ad = []byte{ 147 // 328 bytes of a gzipped FileDescriptorProto 148 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4e, 0xcf, 0x2c, 0xc9, 149 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xc9, 0x4f, 0xce, 0x4e, 0x2d, 0xd2, 0x2f, 0x2e, 150 0x4f, 0x2c, 0xca, 0xcd, 0xce, 0x2c, 0xd1, 0x4f, 0x2c, 0xc8, 0xd4, 0xcf, 0x48, 0x4d, 0xcc, 0x29, 151 0xc9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xa8, 0xd0, 0x83, 0xa9, 0xd0, 0x2b, 152 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x4b, 0xeb, 0x83, 0x58, 0x10, 0x95, 0x52, 0xe6, 153 0x78, 0x8c, 0x05, 0xab, 0x48, 0x2a, 0x4d, 0xd3, 0x2f, 0xc8, 0x29, 0x4d, 0xcf, 0xcc, 0x83, 0x52, 154 0x10, 0x8d, 0x4a, 0x7a, 0x5c, 0x42, 0x1e, 0x60, 0x2b, 0x9d, 0x33, 0x52, 0x93, 0xb3, 0x83, 0x52, 155 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0x24, 0xb8, 0xd8, 0x8b, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 156 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x60, 0x5c, 0xa5, 0x05, 0x8c, 0x5c, 0xc2, 0x28, 0x1a, 157 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0x7c, 0xb9, 0xd8, 0x8a, 0x4b, 0x12, 0x4b, 0x4a, 0x8b, 158 0xc1, 0x1a, 0xf8, 0x8c, 0x4c, 0xf5, 0x30, 0xdd, 0xae, 0x87, 0x45, 0xa3, 0x5e, 0x30, 0xc8, 0xe0, 159 0xbc, 0xf4, 0x60, 0xb0, 0xe6, 0x20, 0xa8, 0x21, 0x4a, 0x56, 0x5c, 0xbc, 0x28, 0x12, 0x42, 0xdc, 160 0x5c, 0xec, 0xa1, 0x7e, 0xde, 0x7e, 0xfe, 0xe1, 0x7e, 0x02, 0x0c, 0x20, 0x4e, 0xb0, 0x6b, 0x50, 161 0x98, 0xa7, 0x9f, 0xbb, 0x00, 0xa3, 0x10, 0x3f, 0x17, 0xb7, 0x9f, 0x7f, 0x48, 0x3c, 0x4c, 0x80, 162 0xc9, 0xa8, 0x92, 0x8b, 0x0d, 0x62, 0x91, 0x50, 0x3e, 0x17, 0x2b, 0xd8, 0x32, 0x21, 0x35, 0x82, 163 0xae, 0x01, 0xfb, 0x5b, 0x4a, 0x9d, 0x48, 0x57, 0x2b, 0x89, 0x9e, 0x5a, 0xf7, 0x6e, 0x06, 0x13, 164 0x3f, 0x17, 0x2f, 0x58, 0xa1, 0x6e, 0x6e, 0x62, 0x5e, 0x62, 0x7a, 0x6a, 0x91, 0x93, 0xca, 0x89, 165 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31, 0x34, 0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 166 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 167 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, 0x70, 0xd0, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 168 0xc9, 0xe8, 0xd3, 0x02, 0x0c, 0x02, 0x00, 0x00, 169 } 170 171 type authenticatedWrapperHealthServer struct { 172 local HealthServer 173 authorize func(context.Context, []string) error 174 } 175 176 func NewAuthenticatedWrapperHealthServer(local HealthServer, authorize func(context.Context, []string) error) HealthServer { 177 return &authenticatedWrapperHealthServer{ 178 local: local, 179 authorize: authorize, 180 } 181 } 182 183 func (p *authenticatedWrapperHealthServer) Check(ctx context.Context, r *HealthCheckRequest) (*HealthCheckResponse, error) { 184 185 if err := p.authorize(ctx, []string{"swarm-manager"}); err != nil { 186 return nil, err 187 } 188 return p.local.Check(ctx, r) 189 } 190 191 func (m *HealthCheckRequest) Copy() *HealthCheckRequest { 192 if m == nil { 193 return nil 194 } 195 o := &HealthCheckRequest{} 196 o.CopyFrom(m) 197 return o 198 } 199 200 func (m *HealthCheckRequest) CopyFrom(src interface{}) { 201 202 o := src.(*HealthCheckRequest) 203 *m = *o 204 } 205 206 func (m *HealthCheckResponse) Copy() *HealthCheckResponse { 207 if m == nil { 208 return nil 209 } 210 o := &HealthCheckResponse{} 211 o.CopyFrom(m) 212 return o 213 } 214 215 func (m *HealthCheckResponse) CopyFrom(src interface{}) { 216 217 o := src.(*HealthCheckResponse) 218 *m = *o 219 } 220 221 // Reference imports to suppress errors if they are not otherwise used. 222 var _ context.Context 223 var _ grpc.ClientConn 224 225 // This is a compile-time assertion to ensure that this generated file 226 // is compatible with the grpc package it is being compiled against. 227 const _ = grpc.SupportPackageIsVersion4 228 229 // HealthClient is the client API for Health service. 230 // 231 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 232 type HealthClient interface { 233 Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) 234 } 235 236 type healthClient struct { 237 cc *grpc.ClientConn 238 } 239 240 func NewHealthClient(cc *grpc.ClientConn) HealthClient { 241 return &healthClient{cc} 242 } 243 244 func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { 245 out := new(HealthCheckResponse) 246 err := c.cc.Invoke(ctx, "/docker.swarmkit.v1.Health/Check", in, out, opts...) 247 if err != nil { 248 return nil, err 249 } 250 return out, nil 251 } 252 253 // HealthServer is the server API for Health service. 254 type HealthServer interface { 255 Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) 256 } 257 258 func RegisterHealthServer(s *grpc.Server, srv HealthServer) { 259 s.RegisterService(&_Health_serviceDesc, srv) 260 } 261 262 func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 263 in := new(HealthCheckRequest) 264 if err := dec(in); err != nil { 265 return nil, err 266 } 267 if interceptor == nil { 268 return srv.(HealthServer).Check(ctx, in) 269 } 270 info := &grpc.UnaryServerInfo{ 271 Server: srv, 272 FullMethod: "/docker.swarmkit.v1.Health/Check", 273 } 274 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 275 return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest)) 276 } 277 return interceptor(ctx, in, info, handler) 278 } 279 280 var _Health_serviceDesc = grpc.ServiceDesc{ 281 ServiceName: "docker.swarmkit.v1.Health", 282 HandlerType: (*HealthServer)(nil), 283 Methods: []grpc.MethodDesc{ 284 { 285 MethodName: "Check", 286 Handler: _Health_Check_Handler, 287 }, 288 }, 289 Streams: []grpc.StreamDesc{}, 290 Metadata: "github.com/docker/swarmkit/api/health.proto", 291 } 292 293 func (m *HealthCheckRequest) Marshal() (dAtA []byte, err error) { 294 size := m.Size() 295 dAtA = make([]byte, size) 296 n, err := m.MarshalTo(dAtA) 297 if err != nil { 298 return nil, err 299 } 300 return dAtA[:n], nil 301 } 302 303 func (m *HealthCheckRequest) MarshalTo(dAtA []byte) (int, error) { 304 var i int 305 _ = i 306 var l int 307 _ = l 308 if len(m.Service) > 0 { 309 dAtA[i] = 0xa 310 i++ 311 i = encodeVarintHealth(dAtA, i, uint64(len(m.Service))) 312 i += copy(dAtA[i:], m.Service) 313 } 314 return i, nil 315 } 316 317 func (m *HealthCheckResponse) Marshal() (dAtA []byte, err error) { 318 size := m.Size() 319 dAtA = make([]byte, size) 320 n, err := m.MarshalTo(dAtA) 321 if err != nil { 322 return nil, err 323 } 324 return dAtA[:n], nil 325 } 326 327 func (m *HealthCheckResponse) MarshalTo(dAtA []byte) (int, error) { 328 var i int 329 _ = i 330 var l int 331 _ = l 332 if m.Status != 0 { 333 dAtA[i] = 0x8 334 i++ 335 i = encodeVarintHealth(dAtA, i, uint64(m.Status)) 336 } 337 return i, nil 338 } 339 340 func encodeVarintHealth(dAtA []byte, offset int, v uint64) int { 341 for v >= 1<<7 { 342 dAtA[offset] = uint8(v&0x7f | 0x80) 343 v >>= 7 344 offset++ 345 } 346 dAtA[offset] = uint8(v) 347 return offset + 1 348 } 349 350 type raftProxyHealthServer struct { 351 local HealthServer 352 connSelector raftselector.ConnProvider 353 localCtxMods, remoteCtxMods []func(context.Context) (context.Context, error) 354 } 355 356 func NewRaftProxyHealthServer(local HealthServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) HealthServer { 357 redirectChecker := func(ctx context.Context) (context.Context, error) { 358 p, ok := peer.FromContext(ctx) 359 if !ok { 360 return ctx, status.Errorf(codes.InvalidArgument, "remote addr is not found in context") 361 } 362 addr := p.Addr.String() 363 md, ok := metadata.FromIncomingContext(ctx) 364 if ok && len(md["redirect"]) != 0 { 365 return ctx, status.Errorf(codes.ResourceExhausted, "more than one redirect to leader from: %s", md["redirect"]) 366 } 367 if !ok { 368 md = metadata.New(map[string]string{}) 369 } 370 md["redirect"] = append(md["redirect"], addr) 371 return metadata.NewOutgoingContext(ctx, md), nil 372 } 373 remoteMods := []func(context.Context) (context.Context, error){redirectChecker} 374 remoteMods = append(remoteMods, remoteCtxMod) 375 376 var localMods []func(context.Context) (context.Context, error) 377 if localCtxMod != nil { 378 localMods = []func(context.Context) (context.Context, error){localCtxMod} 379 } 380 381 return &raftProxyHealthServer{ 382 local: local, 383 connSelector: connSelector, 384 localCtxMods: localMods, 385 remoteCtxMods: remoteMods, 386 } 387 } 388 func (p *raftProxyHealthServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) { 389 var err error 390 for _, mod := range ctxMods { 391 ctx, err = mod(ctx) 392 if err != nil { 393 return ctx, err 394 } 395 } 396 return ctx, nil 397 } 398 func (p *raftProxyHealthServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) { 399 ticker := rafttime.NewTicker(500 * rafttime.Millisecond) 400 defer ticker.Stop() 401 for { 402 select { 403 case <-ticker.C: 404 conn, err := p.connSelector.LeaderConn(ctx) 405 if err != nil { 406 return nil, err 407 } 408 409 client := NewHealthClient(conn) 410 411 resp, err := client.Check(ctx, &HealthCheckRequest{Service: "Raft"}) 412 if err != nil || resp.Status != HealthCheckResponse_SERVING { 413 continue 414 } 415 return conn, nil 416 case <-ctx.Done(): 417 return nil, ctx.Err() 418 } 419 } 420 } 421 422 func (p *raftProxyHealthServer) Check(ctx context.Context, r *HealthCheckRequest) (*HealthCheckResponse, error) { 423 424 conn, err := p.connSelector.LeaderConn(ctx) 425 if err != nil { 426 if err == raftselector.ErrIsLeader { 427 ctx, err = p.runCtxMods(ctx, p.localCtxMods) 428 if err != nil { 429 return nil, err 430 } 431 return p.local.Check(ctx, r) 432 } 433 return nil, err 434 } 435 modCtx, err := p.runCtxMods(ctx, p.remoteCtxMods) 436 if err != nil { 437 return nil, err 438 } 439 440 resp, err := NewHealthClient(conn).Check(modCtx, r) 441 if err != nil { 442 if !strings.Contains(err.Error(), "is closing") && !strings.Contains(err.Error(), "the connection is unavailable") && !strings.Contains(err.Error(), "connection error") { 443 return resp, err 444 } 445 conn, err := p.pollNewLeaderConn(ctx) 446 if err != nil { 447 if err == raftselector.ErrIsLeader { 448 return p.local.Check(ctx, r) 449 } 450 return nil, err 451 } 452 return NewHealthClient(conn).Check(modCtx, r) 453 } 454 return resp, err 455 } 456 457 func (m *HealthCheckRequest) Size() (n int) { 458 if m == nil { 459 return 0 460 } 461 var l int 462 _ = l 463 l = len(m.Service) 464 if l > 0 { 465 n += 1 + l + sovHealth(uint64(l)) 466 } 467 return n 468 } 469 470 func (m *HealthCheckResponse) Size() (n int) { 471 if m == nil { 472 return 0 473 } 474 var l int 475 _ = l 476 if m.Status != 0 { 477 n += 1 + sovHealth(uint64(m.Status)) 478 } 479 return n 480 } 481 482 func sovHealth(x uint64) (n int) { 483 for { 484 n++ 485 x >>= 7 486 if x == 0 { 487 break 488 } 489 } 490 return n 491 } 492 func sozHealth(x uint64) (n int) { 493 return sovHealth(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 494 } 495 func (this *HealthCheckRequest) String() string { 496 if this == nil { 497 return "nil" 498 } 499 s := strings.Join([]string{`&HealthCheckRequest{`, 500 `Service:` + fmt.Sprintf("%v", this.Service) + `,`, 501 `}`, 502 }, "") 503 return s 504 } 505 func (this *HealthCheckResponse) String() string { 506 if this == nil { 507 return "nil" 508 } 509 s := strings.Join([]string{`&HealthCheckResponse{`, 510 `Status:` + fmt.Sprintf("%v", this.Status) + `,`, 511 `}`, 512 }, "") 513 return s 514 } 515 func valueToStringHealth(v interface{}) string { 516 rv := reflect.ValueOf(v) 517 if rv.IsNil() { 518 return "nil" 519 } 520 pv := reflect.Indirect(rv).Interface() 521 return fmt.Sprintf("*%v", pv) 522 } 523 func (m *HealthCheckRequest) Unmarshal(dAtA []byte) error { 524 l := len(dAtA) 525 iNdEx := 0 526 for iNdEx < l { 527 preIndex := iNdEx 528 var wire uint64 529 for shift := uint(0); ; shift += 7 { 530 if shift >= 64 { 531 return ErrIntOverflowHealth 532 } 533 if iNdEx >= l { 534 return io.ErrUnexpectedEOF 535 } 536 b := dAtA[iNdEx] 537 iNdEx++ 538 wire |= uint64(b&0x7F) << shift 539 if b < 0x80 { 540 break 541 } 542 } 543 fieldNum := int32(wire >> 3) 544 wireType := int(wire & 0x7) 545 if wireType == 4 { 546 return fmt.Errorf("proto: HealthCheckRequest: wiretype end group for non-group") 547 } 548 if fieldNum <= 0 { 549 return fmt.Errorf("proto: HealthCheckRequest: illegal tag %d (wire type %d)", fieldNum, wire) 550 } 551 switch fieldNum { 552 case 1: 553 if wireType != 2 { 554 return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) 555 } 556 var stringLen uint64 557 for shift := uint(0); ; shift += 7 { 558 if shift >= 64 { 559 return ErrIntOverflowHealth 560 } 561 if iNdEx >= l { 562 return io.ErrUnexpectedEOF 563 } 564 b := dAtA[iNdEx] 565 iNdEx++ 566 stringLen |= uint64(b&0x7F) << shift 567 if b < 0x80 { 568 break 569 } 570 } 571 intStringLen := int(stringLen) 572 if intStringLen < 0 { 573 return ErrInvalidLengthHealth 574 } 575 postIndex := iNdEx + intStringLen 576 if postIndex < 0 { 577 return ErrInvalidLengthHealth 578 } 579 if postIndex > l { 580 return io.ErrUnexpectedEOF 581 } 582 m.Service = string(dAtA[iNdEx:postIndex]) 583 iNdEx = postIndex 584 default: 585 iNdEx = preIndex 586 skippy, err := skipHealth(dAtA[iNdEx:]) 587 if err != nil { 588 return err 589 } 590 if skippy < 0 { 591 return ErrInvalidLengthHealth 592 } 593 if (iNdEx + skippy) < 0 { 594 return ErrInvalidLengthHealth 595 } 596 if (iNdEx + skippy) > l { 597 return io.ErrUnexpectedEOF 598 } 599 iNdEx += skippy 600 } 601 } 602 603 if iNdEx > l { 604 return io.ErrUnexpectedEOF 605 } 606 return nil 607 } 608 func (m *HealthCheckResponse) Unmarshal(dAtA []byte) error { 609 l := len(dAtA) 610 iNdEx := 0 611 for iNdEx < l { 612 preIndex := iNdEx 613 var wire uint64 614 for shift := uint(0); ; shift += 7 { 615 if shift >= 64 { 616 return ErrIntOverflowHealth 617 } 618 if iNdEx >= l { 619 return io.ErrUnexpectedEOF 620 } 621 b := dAtA[iNdEx] 622 iNdEx++ 623 wire |= uint64(b&0x7F) << shift 624 if b < 0x80 { 625 break 626 } 627 } 628 fieldNum := int32(wire >> 3) 629 wireType := int(wire & 0x7) 630 if wireType == 4 { 631 return fmt.Errorf("proto: HealthCheckResponse: wiretype end group for non-group") 632 } 633 if fieldNum <= 0 { 634 return fmt.Errorf("proto: HealthCheckResponse: illegal tag %d (wire type %d)", fieldNum, wire) 635 } 636 switch fieldNum { 637 case 1: 638 if wireType != 0 { 639 return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) 640 } 641 m.Status = 0 642 for shift := uint(0); ; shift += 7 { 643 if shift >= 64 { 644 return ErrIntOverflowHealth 645 } 646 if iNdEx >= l { 647 return io.ErrUnexpectedEOF 648 } 649 b := dAtA[iNdEx] 650 iNdEx++ 651 m.Status |= HealthCheckResponse_ServingStatus(b&0x7F) << shift 652 if b < 0x80 { 653 break 654 } 655 } 656 default: 657 iNdEx = preIndex 658 skippy, err := skipHealth(dAtA[iNdEx:]) 659 if err != nil { 660 return err 661 } 662 if skippy < 0 { 663 return ErrInvalidLengthHealth 664 } 665 if (iNdEx + skippy) < 0 { 666 return ErrInvalidLengthHealth 667 } 668 if (iNdEx + skippy) > l { 669 return io.ErrUnexpectedEOF 670 } 671 iNdEx += skippy 672 } 673 } 674 675 if iNdEx > l { 676 return io.ErrUnexpectedEOF 677 } 678 return nil 679 } 680 func skipHealth(dAtA []byte) (n int, err error) { 681 l := len(dAtA) 682 iNdEx := 0 683 for iNdEx < l { 684 var wire uint64 685 for shift := uint(0); ; shift += 7 { 686 if shift >= 64 { 687 return 0, ErrIntOverflowHealth 688 } 689 if iNdEx >= l { 690 return 0, io.ErrUnexpectedEOF 691 } 692 b := dAtA[iNdEx] 693 iNdEx++ 694 wire |= (uint64(b) & 0x7F) << shift 695 if b < 0x80 { 696 break 697 } 698 } 699 wireType := int(wire & 0x7) 700 switch wireType { 701 case 0: 702 for shift := uint(0); ; shift += 7 { 703 if shift >= 64 { 704 return 0, ErrIntOverflowHealth 705 } 706 if iNdEx >= l { 707 return 0, io.ErrUnexpectedEOF 708 } 709 iNdEx++ 710 if dAtA[iNdEx-1] < 0x80 { 711 break 712 } 713 } 714 return iNdEx, nil 715 case 1: 716 iNdEx += 8 717 return iNdEx, nil 718 case 2: 719 var length int 720 for shift := uint(0); ; shift += 7 { 721 if shift >= 64 { 722 return 0, ErrIntOverflowHealth 723 } 724 if iNdEx >= l { 725 return 0, io.ErrUnexpectedEOF 726 } 727 b := dAtA[iNdEx] 728 iNdEx++ 729 length |= (int(b) & 0x7F) << shift 730 if b < 0x80 { 731 break 732 } 733 } 734 if length < 0 { 735 return 0, ErrInvalidLengthHealth 736 } 737 iNdEx += length 738 if iNdEx < 0 { 739 return 0, ErrInvalidLengthHealth 740 } 741 return iNdEx, nil 742 case 3: 743 for { 744 var innerWire uint64 745 var start int = iNdEx 746 for shift := uint(0); ; shift += 7 { 747 if shift >= 64 { 748 return 0, ErrIntOverflowHealth 749 } 750 if iNdEx >= l { 751 return 0, io.ErrUnexpectedEOF 752 } 753 b := dAtA[iNdEx] 754 iNdEx++ 755 innerWire |= (uint64(b) & 0x7F) << shift 756 if b < 0x80 { 757 break 758 } 759 } 760 innerWireType := int(innerWire & 0x7) 761 if innerWireType == 4 { 762 break 763 } 764 next, err := skipHealth(dAtA[start:]) 765 if err != nil { 766 return 0, err 767 } 768 iNdEx = start + next 769 if iNdEx < 0 { 770 return 0, ErrInvalidLengthHealth 771 } 772 } 773 return iNdEx, nil 774 case 4: 775 return iNdEx, nil 776 case 5: 777 iNdEx += 4 778 return iNdEx, nil 779 default: 780 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 781 } 782 } 783 panic("unreachable") 784 } 785 786 var ( 787 ErrInvalidLengthHealth = fmt.Errorf("proto: negative length found during unmarshaling") 788 ErrIntOverflowHealth = fmt.Errorf("proto: integer overflow") 789 )