hw_grpc.pb_test.go 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. // Copyright 2023 EMQ Technologies Co., Ltd.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  15. package service
  16. import (
  17. context "context"
  18. empty "github.com/golang/protobuf/ptypes/empty"
  19. wrappers "github.com/golang/protobuf/ptypes/wrappers"
  20. grpc "google.golang.org/grpc"
  21. codes "google.golang.org/grpc/codes"
  22. status "google.golang.org/grpc/status"
  23. )
  24. // This is a compile-time assertion to ensure that this generated file
  25. // is compatible with the grpc package it is being compiled against.
  26. // Requires gRPC-Go v1.32.0 or later.
  27. const _ = grpc.SupportPackageIsVersion7
  28. // GreeterClient is the client API for Greeter service.
  29. //
  30. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
  31. type GreeterClient interface {
  32. // Sends a greeting
  33. SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
  34. Compute(ctx context.Context, in *InferRequest, opts ...grpc.CallOption) (*Response, error)
  35. // Primitive type param. Not supported for rest json
  36. GetFeature(ctx context.Context, in *wrappers.BytesValue, opts ...grpc.CallOption) (*FeatureResponse, error)
  37. ObjectDetection(ctx context.Context, in *ObjectDetectionRequest, opts ...grpc.CallOption) (*ObjectDetectionResponse, error)
  38. GetStatus(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*wrappers.BoolValue, error)
  39. }
  40. type greeterClient struct {
  41. cc grpc.ClientConnInterface
  42. }
  43. func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {
  44. return &greeterClient{cc}
  45. }
  46. func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
  47. out := new(HelloReply)
  48. err := c.cc.Invoke(ctx, "/helloworld.Greeter/SayHello", in, out, opts...)
  49. if err != nil {
  50. return nil, err
  51. }
  52. return out, nil
  53. }
  54. func (c *greeterClient) Compute(ctx context.Context, in *InferRequest, opts ...grpc.CallOption) (*Response, error) {
  55. out := new(Response)
  56. err := c.cc.Invoke(ctx, "/helloworld.Greeter/Compute", in, out, opts...)
  57. if err != nil {
  58. return nil, err
  59. }
  60. return out, nil
  61. }
  62. func (c *greeterClient) GetFeature(ctx context.Context, in *wrappers.BytesValue, opts ...grpc.CallOption) (*FeatureResponse, error) {
  63. out := new(FeatureResponse)
  64. err := c.cc.Invoke(ctx, "/helloworld.Greeter/get_feature", in, out, opts...)
  65. if err != nil {
  66. return nil, err
  67. }
  68. return out, nil
  69. }
  70. func (c *greeterClient) ObjectDetection(ctx context.Context, in *ObjectDetectionRequest, opts ...grpc.CallOption) (*ObjectDetectionResponse, error) {
  71. out := new(ObjectDetectionResponse)
  72. err := c.cc.Invoke(ctx, "/helloworld.Greeter/object_detection", in, out, opts...)
  73. if err != nil {
  74. return nil, err
  75. }
  76. return out, nil
  77. }
  78. func (c *greeterClient) GetStatus(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*wrappers.BoolValue, error) {
  79. out := new(wrappers.BoolValue)
  80. err := c.cc.Invoke(ctx, "/helloworld.Greeter/getStatus", in, out, opts...)
  81. if err != nil {
  82. return nil, err
  83. }
  84. return out, nil
  85. }
  86. // GreeterServer is the server API for Greeter service.
  87. // All implementations must embed UnimplementedGreeterServer
  88. // for forward compatibility
  89. type GreeterServer interface {
  90. // Sends a greeting
  91. SayHello(context.Context, *HelloRequest) (*HelloReply, error)
  92. Compute(context.Context, *InferRequest) (*Response, error)
  93. // Primitive type param. Not supported for rest json
  94. GetFeature(context.Context, *wrappers.BytesValue) (*FeatureResponse, error)
  95. ObjectDetection(context.Context, *ObjectDetectionRequest) (*ObjectDetectionResponse, error)
  96. GetStatus(context.Context, *empty.Empty) (*wrappers.BoolValue, error)
  97. mustEmbedUnimplementedGreeterServer()
  98. }
  99. // UnimplementedGreeterServer must be embedded to have forward compatible implementations.
  100. type UnimplementedGreeterServer struct {
  101. }
  102. func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) {
  103. return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
  104. }
  105. func (UnimplementedGreeterServer) Compute(context.Context, *InferRequest) (*Response, error) {
  106. return nil, status.Errorf(codes.Unimplemented, "method Compute not implemented")
  107. }
  108. func (UnimplementedGreeterServer) GetFeature(context.Context, *wrappers.BytesValue) (*FeatureResponse, error) {
  109. return nil, status.Errorf(codes.Unimplemented, "method GetFeature not implemented")
  110. }
  111. func (UnimplementedGreeterServer) ObjectDetection(context.Context, *ObjectDetectionRequest) (*ObjectDetectionResponse, error) {
  112. return nil, status.Errorf(codes.Unimplemented, "method ObjectDetection not implemented")
  113. }
  114. func (UnimplementedGreeterServer) GetStatus(context.Context, *empty.Empty) (*wrappers.BoolValue, error) {
  115. return nil, status.Errorf(codes.Unimplemented, "method GetStatus not implemented")
  116. }
  117. func (UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {}
  118. // UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service.
  119. // Use of this interface is not recommended, as added methods to GreeterServer will
  120. // result in compilation errors.
  121. type UnsafeGreeterServer interface {
  122. mustEmbedUnimplementedGreeterServer()
  123. }
  124. func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) {
  125. s.RegisterService(&Greeter_ServiceDesc, srv)
  126. }
  127. func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  128. in := new(HelloRequest)
  129. if err := dec(in); err != nil {
  130. return nil, err
  131. }
  132. if interceptor == nil {
  133. return srv.(GreeterServer).SayHello(ctx, in)
  134. }
  135. info := &grpc.UnaryServerInfo{
  136. Server: srv,
  137. FullMethod: "/helloworld.Greeter/SayHello",
  138. }
  139. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  140. return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
  141. }
  142. return interceptor(ctx, in, info, handler)
  143. }
  144. func _Greeter_Compute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  145. in := new(InferRequest)
  146. if err := dec(in); err != nil {
  147. return nil, err
  148. }
  149. if interceptor == nil {
  150. return srv.(GreeterServer).Compute(ctx, in)
  151. }
  152. info := &grpc.UnaryServerInfo{
  153. Server: srv,
  154. FullMethod: "/helloworld.Greeter/Compute",
  155. }
  156. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  157. return srv.(GreeterServer).Compute(ctx, req.(*InferRequest))
  158. }
  159. return interceptor(ctx, in, info, handler)
  160. }
  161. func _Greeter_GetFeature_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  162. in := new(wrappers.BytesValue)
  163. if err := dec(in); err != nil {
  164. return nil, err
  165. }
  166. if interceptor == nil {
  167. return srv.(GreeterServer).GetFeature(ctx, in)
  168. }
  169. info := &grpc.UnaryServerInfo{
  170. Server: srv,
  171. FullMethod: "/helloworld.Greeter/get_feature",
  172. }
  173. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  174. return srv.(GreeterServer).GetFeature(ctx, req.(*wrappers.BytesValue))
  175. }
  176. return interceptor(ctx, in, info, handler)
  177. }
  178. func _Greeter_ObjectDetection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  179. in := new(ObjectDetectionRequest)
  180. if err := dec(in); err != nil {
  181. return nil, err
  182. }
  183. if interceptor == nil {
  184. return srv.(GreeterServer).ObjectDetection(ctx, in)
  185. }
  186. info := &grpc.UnaryServerInfo{
  187. Server: srv,
  188. FullMethod: "/helloworld.Greeter/object_detection",
  189. }
  190. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  191. return srv.(GreeterServer).ObjectDetection(ctx, req.(*ObjectDetectionRequest))
  192. }
  193. return interceptor(ctx, in, info, handler)
  194. }
  195. func _Greeter_GetStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  196. in := new(empty.Empty)
  197. if err := dec(in); err != nil {
  198. return nil, err
  199. }
  200. if interceptor == nil {
  201. return srv.(GreeterServer).GetStatus(ctx, in)
  202. }
  203. info := &grpc.UnaryServerInfo{
  204. Server: srv,
  205. FullMethod: "/helloworld.Greeter/getStatus",
  206. }
  207. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  208. return srv.(GreeterServer).GetStatus(ctx, req.(*empty.Empty))
  209. }
  210. return interceptor(ctx, in, info, handler)
  211. }
  212. // Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service.
  213. // It's only intended for direct use with grpc.RegisterService,
  214. // and not to be introspected or modified (even as a copy)
  215. var Greeter_ServiceDesc = grpc.ServiceDesc{
  216. ServiceName: "helloworld.Greeter",
  217. HandlerType: (*GreeterServer)(nil),
  218. Methods: []grpc.MethodDesc{
  219. {
  220. MethodName: "SayHello",
  221. Handler: _Greeter_SayHello_Handler,
  222. },
  223. {
  224. MethodName: "Compute",
  225. Handler: _Greeter_Compute_Handler,
  226. },
  227. {
  228. MethodName: "get_feature",
  229. Handler: _Greeter_GetFeature_Handler,
  230. },
  231. {
  232. MethodName: "object_detection",
  233. Handler: _Greeter_ObjectDetection_Handler,
  234. },
  235. {
  236. MethodName: "getStatus",
  237. Handler: _Greeter_GetStatus_Handler,
  238. },
  239. },
  240. Streams: []grpc.StreamDesc{},
  241. Metadata: "hw.proto",
  242. }