[dev] upd Alive model

This commit is contained in:
loveckiy.ivan
2025-11-12 11:50:34 +03:00
parent 2af5e5f466
commit 8785c49d0a
3 changed files with 213 additions and 54 deletions

View File

@@ -22,6 +22,7 @@ const _ = grpc.SupportPackageIsVersion7
//
// 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 PluginClient interface {
Alive(ctx context.Context, in *AliveIn, opts ...grpc.CallOption) (*AliveOut, error)
Exec(ctx context.Context, in *ExecIn, opts ...grpc.CallOption) (*ExecOut, error)
List(ctx context.Context, in *ListIn, opts ...grpc.CallOption) (*ListOut, error)
}
@@ -34,6 +35,15 @@ func NewPluginClient(cc grpc.ClientConnInterface) PluginClient {
return &pluginClient{cc}
}
func (c *pluginClient) Alive(ctx context.Context, in *AliveIn, opts ...grpc.CallOption) (*AliveOut, error) {
out := new(AliveOut)
err := c.cc.Invoke(ctx, "/plugin.Plugin/Alive", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pluginClient) Exec(ctx context.Context, in *ExecIn, opts ...grpc.CallOption) (*ExecOut, error) {
out := new(ExecOut)
err := c.cc.Invoke(ctx, "/plugin.Plugin/Exec", in, out, opts...)
@@ -56,6 +66,7 @@ func (c *pluginClient) List(ctx context.Context, in *ListIn, opts ...grpc.CallOp
// All implementations must embed UnimplementedPluginServer
// for forward compatibility
type PluginServer interface {
Alive(context.Context, *AliveIn) (*AliveOut, error)
Exec(context.Context, *ExecIn) (*ExecOut, error)
List(context.Context, *ListIn) (*ListOut, error)
mustEmbedUnimplementedPluginServer()
@@ -65,6 +76,9 @@ type PluginServer interface {
type UnimplementedPluginServer struct {
}
func (UnimplementedPluginServer) Alive(context.Context, *AliveIn) (*AliveOut, error) {
return nil, status.Errorf(codes.Unimplemented, "method Alive not implemented")
}
func (UnimplementedPluginServer) Exec(context.Context, *ExecIn) (*ExecOut, error) {
return nil, status.Errorf(codes.Unimplemented, "method Exec not implemented")
}
@@ -84,6 +98,24 @@ func RegisterPluginServer(s grpc.ServiceRegistrar, srv PluginServer) {
s.RegisterService(&Plugin_ServiceDesc, srv)
}
func _Plugin_Alive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AliveIn)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PluginServer).Alive(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/plugin.Plugin/Alive",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PluginServer).Alive(ctx, req.(*AliveIn))
}
return interceptor(ctx, in, info, handler)
}
func _Plugin_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ExecIn)
if err := dec(in); err != nil {
@@ -127,6 +159,10 @@ var Plugin_ServiceDesc = grpc.ServiceDesc{
ServiceName: "plugin.Plugin",
HandlerType: (*PluginServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Alive",
Handler: _Plugin_Alive_Handler,
},
{
MethodName: "Exec",
Handler: _Plugin_Exec_Handler,