mirror of
https://github.com/LazarenkoA/Ox.git
synced 2025-11-23 21:33:13 +02:00
278 lines
10 KiB
Go
278 lines
10 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.5.1
|
|
// - protoc v6.32.0
|
|
// source: worker.proto
|
|
|
|
package gen
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
Worker_SetTestScript_FullMethodName = "/Worker/SetTestScript"
|
|
Worker_GetTestScript_FullMethodName = "/Worker/GetTestScript"
|
|
Worker_Start_FullMethodName = "/Worker/Start"
|
|
Worker_Stop_FullMethodName = "/Worker/Stop"
|
|
Worker_ObserverChangeState_FullMethodName = "/Worker/ObserverChangeState"
|
|
)
|
|
|
|
// WorkerClient is the client API for Worker service.
|
|
//
|
|
// 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.
|
|
type WorkerClient interface {
|
|
SetTestScript(ctx context.Context, in *TestScript, opts ...grpc.CallOption) (*Empty, error)
|
|
GetTestScript(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TestScript, error)
|
|
Start(ctx context.Context, in *StartResp, opts ...grpc.CallOption) (*Empty, error)
|
|
Stop(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
|
ObserverChangeState(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StatusInfo], error)
|
|
}
|
|
|
|
type workerClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewWorkerClient(cc grpc.ClientConnInterface) WorkerClient {
|
|
return &workerClient{cc}
|
|
}
|
|
|
|
func (c *workerClient) SetTestScript(ctx context.Context, in *TestScript, opts ...grpc.CallOption) (*Empty, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(Empty)
|
|
err := c.cc.Invoke(ctx, Worker_SetTestScript_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *workerClient) GetTestScript(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TestScript, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(TestScript)
|
|
err := c.cc.Invoke(ctx, Worker_GetTestScript_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *workerClient) Start(ctx context.Context, in *StartResp, opts ...grpc.CallOption) (*Empty, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(Empty)
|
|
err := c.cc.Invoke(ctx, Worker_Start_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *workerClient) Stop(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(Empty)
|
|
err := c.cc.Invoke(ctx, Worker_Stop_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *workerClient) ObserverChangeState(ctx context.Context, in *Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StatusInfo], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &Worker_ServiceDesc.Streams[0], Worker_ObserverChangeState_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[Empty, StatusInfo]{ClientStream: stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Worker_ObserverChangeStateClient = grpc.ServerStreamingClient[StatusInfo]
|
|
|
|
// WorkerServer is the server API for Worker service.
|
|
// All implementations must embed UnimplementedWorkerServer
|
|
// for forward compatibility.
|
|
type WorkerServer interface {
|
|
SetTestScript(context.Context, *TestScript) (*Empty, error)
|
|
GetTestScript(context.Context, *Empty) (*TestScript, error)
|
|
Start(context.Context, *StartResp) (*Empty, error)
|
|
Stop(context.Context, *Empty) (*Empty, error)
|
|
ObserverChangeState(*Empty, grpc.ServerStreamingServer[StatusInfo]) error
|
|
mustEmbedUnimplementedWorkerServer()
|
|
}
|
|
|
|
// UnimplementedWorkerServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedWorkerServer struct{}
|
|
|
|
func (UnimplementedWorkerServer) SetTestScript(context.Context, *TestScript) (*Empty, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method SetTestScript not implemented")
|
|
}
|
|
func (UnimplementedWorkerServer) GetTestScript(context.Context, *Empty) (*TestScript, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method GetTestScript not implemented")
|
|
}
|
|
func (UnimplementedWorkerServer) Start(context.Context, *StartResp) (*Empty, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Start not implemented")
|
|
}
|
|
func (UnimplementedWorkerServer) Stop(context.Context, *Empty) (*Empty, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented")
|
|
}
|
|
func (UnimplementedWorkerServer) ObserverChangeState(*Empty, grpc.ServerStreamingServer[StatusInfo]) error {
|
|
return status.Errorf(codes.Unimplemented, "method ObserverChangeState not implemented")
|
|
}
|
|
func (UnimplementedWorkerServer) mustEmbedUnimplementedWorkerServer() {}
|
|
func (UnimplementedWorkerServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeWorkerServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to WorkerServer will
|
|
// result in compilation errors.
|
|
type UnsafeWorkerServer interface {
|
|
mustEmbedUnimplementedWorkerServer()
|
|
}
|
|
|
|
func RegisterWorkerServer(s grpc.ServiceRegistrar, srv WorkerServer) {
|
|
// If the following call pancis, it indicates UnimplementedWorkerServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&Worker_ServiceDesc, srv)
|
|
}
|
|
|
|
func _Worker_SetTestScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(TestScript)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(WorkerServer).SetTestScript(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Worker_SetTestScript_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(WorkerServer).SetTestScript(ctx, req.(*TestScript))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Worker_GetTestScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(Empty)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(WorkerServer).GetTestScript(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Worker_GetTestScript_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(WorkerServer).GetTestScript(ctx, req.(*Empty))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Worker_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(StartResp)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(WorkerServer).Start(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Worker_Start_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(WorkerServer).Start(ctx, req.(*StartResp))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Worker_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(Empty)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(WorkerServer).Stop(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Worker_Stop_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(WorkerServer).Stop(ctx, req.(*Empty))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Worker_ObserverChangeState_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(Empty)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(WorkerServer).ObserverChangeState(m, &grpc.GenericServerStream[Empty, StatusInfo]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Worker_ObserverChangeStateServer = grpc.ServerStreamingServer[StatusInfo]
|
|
|
|
// Worker_ServiceDesc is the grpc.ServiceDesc for Worker service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var Worker_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "Worker",
|
|
HandlerType: (*WorkerServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "SetTestScript",
|
|
Handler: _Worker_SetTestScript_Handler,
|
|
},
|
|
{
|
|
MethodName: "GetTestScript",
|
|
Handler: _Worker_GetTestScript_Handler,
|
|
},
|
|
{
|
|
MethodName: "Start",
|
|
Handler: _Worker_Start_Handler,
|
|
},
|
|
{
|
|
MethodName: "Stop",
|
|
Handler: _Worker_Stop_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "ObserverChangeState",
|
|
Handler: _Worker_ObserverChangeState_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "worker.proto",
|
|
}
|