WIP: implemented Ping, implemented Set and Shutdown in agent, and added umask

This commit is contained in:
2025-06-23 16:43:53 +10:00
parent cfdfcb6ed5
commit b22529be7b
10 changed files with 243 additions and 60 deletions

View File

@@ -1,8 +1,8 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.31.1
// source: gitea.suyono.dev/suyono/go-agent/proto/agent.proto
// - protoc v5.29.3
// source: agent.proto
package proto
@@ -23,6 +23,7 @@ const (
Agent_Get_FullMethodName = "/proto.Agent/Get"
Agent_Set_FullMethodName = "/proto.Agent/Set"
Agent_Shutdown_FullMethodName = "/proto.Agent/Shutdown"
Agent_Ping_FullMethodName = "/proto.Agent/Ping"
)
// AgentClient is the client API for Agent service.
@@ -32,6 +33,7 @@ type AgentClient interface {
Get(ctx context.Context, in *CacheGetRequest, opts ...grpc.CallOption) (*CacheValue, error)
Set(ctx context.Context, in *CacheSetRequest, opts ...grpc.CallOption) (*SetStatus, error)
Shutdown(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
Ping(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type agentClient struct {
@@ -72,6 +74,16 @@ func (c *agentClient) Shutdown(ctx context.Context, in *emptypb.Empty, opts ...g
return out, nil
}
func (c *agentClient) Ping(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, Agent_Ping_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AgentServer is the server API for Agent service.
// All implementations must embed UnimplementedAgentServer
// for forward compatibility.
@@ -79,6 +91,7 @@ type AgentServer interface {
Get(context.Context, *CacheGetRequest) (*CacheValue, error)
Set(context.Context, *CacheSetRequest) (*SetStatus, error)
Shutdown(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
Ping(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
mustEmbedUnimplementedAgentServer()
}
@@ -98,6 +111,9 @@ func (UnimplementedAgentServer) Set(context.Context, *CacheSetRequest) (*SetStat
func (UnimplementedAgentServer) Shutdown(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Shutdown not implemented")
}
func (UnimplementedAgentServer) Ping(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {}
func (UnimplementedAgentServer) testEmbeddedByValue() {}
@@ -173,6 +189,24 @@ func _Agent_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
func _Agent_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServer).Ping(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Agent_Ping_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServer).Ping(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
// Agent_ServiceDesc is the grpc.ServiceDesc for Agent service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -192,7 +226,11 @@ var Agent_ServiceDesc = grpc.ServiceDesc{
MethodName: "Shutdown",
Handler: _Agent_Shutdown_Handler,
},
{
MethodName: "Ping",
Handler: _Agent_Ping_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "gitea.suyono.dev/suyono/go-agent/proto/agent.proto",
Metadata: "agent.proto",
}