health.pb.go 21 KB

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