github.com/emcfarlane/larking@v0.0.0-20220605172417-1704b45ee6c3/apipb/workerpb/worker_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // versions: 3 // - protoc-gen-go-grpc v1.2.0 4 // - protoc v3.19.4 5 // source: apipb/workerpb/worker.proto 6 7 package workerpb 8 9 import ( 10 context "context" 11 grpc "google.golang.org/grpc" 12 codes "google.golang.org/grpc/codes" 13 status "google.golang.org/grpc/status" 14 ) 15 16 // This is a compile-time assertion to ensure that this generated file 17 // is compatible with the grpc package it is being compiled against. 18 // Requires gRPC-Go v1.32.0 or later. 19 const _ = grpc.SupportPackageIsVersion7 20 21 // WorkerClient is the client API for Worker service. 22 // 23 // 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. 24 type WorkerClient interface { 25 RunOnThread(ctx context.Context, opts ...grpc.CallOption) (Worker_RunOnThreadClient, error) 26 RunThread(ctx context.Context, in *RunThreadRequest, opts ...grpc.CallOption) (*Output, error) 27 TestThread(ctx context.Context, in *TestThreadRequest, opts ...grpc.CallOption) (*Output, error) 28 } 29 30 type workerClient struct { 31 cc grpc.ClientConnInterface 32 } 33 34 func NewWorkerClient(cc grpc.ClientConnInterface) WorkerClient { 35 return &workerClient{cc} 36 } 37 38 func (c *workerClient) RunOnThread(ctx context.Context, opts ...grpc.CallOption) (Worker_RunOnThreadClient, error) { 39 stream, err := c.cc.NewStream(ctx, &Worker_ServiceDesc.Streams[0], "/larking.api.worker.Worker/RunOnThread", opts...) 40 if err != nil { 41 return nil, err 42 } 43 x := &workerRunOnThreadClient{stream} 44 return x, nil 45 } 46 47 type Worker_RunOnThreadClient interface { 48 Send(*Command) error 49 Recv() (*Result, error) 50 grpc.ClientStream 51 } 52 53 type workerRunOnThreadClient struct { 54 grpc.ClientStream 55 } 56 57 func (x *workerRunOnThreadClient) Send(m *Command) error { 58 return x.ClientStream.SendMsg(m) 59 } 60 61 func (x *workerRunOnThreadClient) Recv() (*Result, error) { 62 m := new(Result) 63 if err := x.ClientStream.RecvMsg(m); err != nil { 64 return nil, err 65 } 66 return m, nil 67 } 68 69 func (c *workerClient) RunThread(ctx context.Context, in *RunThreadRequest, opts ...grpc.CallOption) (*Output, error) { 70 out := new(Output) 71 err := c.cc.Invoke(ctx, "/larking.api.worker.Worker/RunThread", in, out, opts...) 72 if err != nil { 73 return nil, err 74 } 75 return out, nil 76 } 77 78 func (c *workerClient) TestThread(ctx context.Context, in *TestThreadRequest, opts ...grpc.CallOption) (*Output, error) { 79 out := new(Output) 80 err := c.cc.Invoke(ctx, "/larking.api.worker.Worker/TestThread", in, out, opts...) 81 if err != nil { 82 return nil, err 83 } 84 return out, nil 85 } 86 87 // WorkerServer is the server API for Worker service. 88 // All implementations must embed UnimplementedWorkerServer 89 // for forward compatibility 90 type WorkerServer interface { 91 RunOnThread(Worker_RunOnThreadServer) error 92 RunThread(context.Context, *RunThreadRequest) (*Output, error) 93 TestThread(context.Context, *TestThreadRequest) (*Output, error) 94 mustEmbedUnimplementedWorkerServer() 95 } 96 97 // UnimplementedWorkerServer must be embedded to have forward compatible implementations. 98 type UnimplementedWorkerServer struct { 99 } 100 101 func (UnimplementedWorkerServer) RunOnThread(Worker_RunOnThreadServer) error { 102 return status.Errorf(codes.Unimplemented, "method RunOnThread not implemented") 103 } 104 func (UnimplementedWorkerServer) RunThread(context.Context, *RunThreadRequest) (*Output, error) { 105 return nil, status.Errorf(codes.Unimplemented, "method RunThread not implemented") 106 } 107 func (UnimplementedWorkerServer) TestThread(context.Context, *TestThreadRequest) (*Output, error) { 108 return nil, status.Errorf(codes.Unimplemented, "method TestThread not implemented") 109 } 110 func (UnimplementedWorkerServer) mustEmbedUnimplementedWorkerServer() {} 111 112 // UnsafeWorkerServer may be embedded to opt out of forward compatibility for this service. 113 // Use of this interface is not recommended, as added methods to WorkerServer will 114 // result in compilation errors. 115 type UnsafeWorkerServer interface { 116 mustEmbedUnimplementedWorkerServer() 117 } 118 119 func RegisterWorkerServer(s grpc.ServiceRegistrar, srv WorkerServer) { 120 s.RegisterService(&Worker_ServiceDesc, srv) 121 } 122 123 func _Worker_RunOnThread_Handler(srv interface{}, stream grpc.ServerStream) error { 124 return srv.(WorkerServer).RunOnThread(&workerRunOnThreadServer{stream}) 125 } 126 127 type Worker_RunOnThreadServer interface { 128 Send(*Result) error 129 Recv() (*Command, error) 130 grpc.ServerStream 131 } 132 133 type workerRunOnThreadServer struct { 134 grpc.ServerStream 135 } 136 137 func (x *workerRunOnThreadServer) Send(m *Result) error { 138 return x.ServerStream.SendMsg(m) 139 } 140 141 func (x *workerRunOnThreadServer) Recv() (*Command, error) { 142 m := new(Command) 143 if err := x.ServerStream.RecvMsg(m); err != nil { 144 return nil, err 145 } 146 return m, nil 147 } 148 149 func _Worker_RunThread_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 150 in := new(RunThreadRequest) 151 if err := dec(in); err != nil { 152 return nil, err 153 } 154 if interceptor == nil { 155 return srv.(WorkerServer).RunThread(ctx, in) 156 } 157 info := &grpc.UnaryServerInfo{ 158 Server: srv, 159 FullMethod: "/larking.api.worker.Worker/RunThread", 160 } 161 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 162 return srv.(WorkerServer).RunThread(ctx, req.(*RunThreadRequest)) 163 } 164 return interceptor(ctx, in, info, handler) 165 } 166 167 func _Worker_TestThread_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 168 in := new(TestThreadRequest) 169 if err := dec(in); err != nil { 170 return nil, err 171 } 172 if interceptor == nil { 173 return srv.(WorkerServer).TestThread(ctx, in) 174 } 175 info := &grpc.UnaryServerInfo{ 176 Server: srv, 177 FullMethod: "/larking.api.worker.Worker/TestThread", 178 } 179 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 180 return srv.(WorkerServer).TestThread(ctx, req.(*TestThreadRequest)) 181 } 182 return interceptor(ctx, in, info, handler) 183 } 184 185 // Worker_ServiceDesc is the grpc.ServiceDesc for Worker service. 186 // It's only intended for direct use with grpc.RegisterService, 187 // and not to be introspected or modified (even as a copy) 188 var Worker_ServiceDesc = grpc.ServiceDesc{ 189 ServiceName: "larking.api.worker.Worker", 190 HandlerType: (*WorkerServer)(nil), 191 Methods: []grpc.MethodDesc{ 192 { 193 MethodName: "RunThread", 194 Handler: _Worker_RunThread_Handler, 195 }, 196 { 197 MethodName: "TestThread", 198 Handler: _Worker_TestThread_Handler, 199 }, 200 }, 201 Streams: []grpc.StreamDesc{ 202 { 203 StreamName: "RunOnThread", 204 Handler: _Worker_RunOnThread_Handler, 205 ServerStreams: true, 206 ClientStreams: true, 207 }, 208 }, 209 Metadata: "apipb/workerpb/worker.proto", 210 }