WIP: initial commit
This commit is contained in:
312
proto/agent.pb.go
Normal file
312
proto/agent.pb.go
Normal file
@@ -0,0 +1,312 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc v6.31.1
|
||||
// source: gitea.suyono.dev/suyono/go-agent/proto/agent.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type CacheGetRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CacheGetRequest) Reset() {
|
||||
*x = CacheGetRequest{}
|
||||
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CacheGetRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CacheGetRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CacheGetRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CacheGetRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CacheGetRequest) Descriptor() ([]byte, []int) {
|
||||
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CacheGetRequest) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CacheValue struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CacheValue) Reset() {
|
||||
*x = CacheValue{}
|
||||
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CacheValue) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CacheValue) ProtoMessage() {}
|
||||
|
||||
func (x *CacheValue) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CacheValue.ProtoReflect.Descriptor instead.
|
||||
func (*CacheValue) Descriptor() ([]byte, []int) {
|
||||
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CacheValue) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CacheValue) GetValue() string {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CacheValue) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CacheSetRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CacheSetRequest) Reset() {
|
||||
*x = CacheSetRequest{}
|
||||
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CacheSetRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CacheSetRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CacheSetRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CacheSetRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CacheSetRequest) Descriptor() ([]byte, []int) {
|
||||
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *CacheSetRequest) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CacheSetRequest) GetValue() string {
|
||||
if x != nil {
|
||||
return x.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SetStatus struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SetStatus) Reset() {
|
||||
*x = SetStatus{}
|
||||
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SetStatus) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetStatus) ProtoMessage() {}
|
||||
|
||||
func (x *SetStatus) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetStatus.ProtoReflect.Descriptor instead.
|
||||
func (*SetStatus) Descriptor() ([]byte, []int) {
|
||||
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *SetStatus) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SetStatus) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_gitea_suyono_dev_suyono_go_agent_proto_agent_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"2gitea.suyono.dev/suyono/go-agent/proto/agent.proto\x12\x05proto\x1a\x1bgoogle/protobuf/empty.proto\"#\n" +
|
||||
"\x0fCacheGetRequest\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\"T\n" +
|
||||
"\n" +
|
||||
"CacheValue\x12\x16\n" +
|
||||
"\x06status\x18\x01 \x01(\tR\x06status\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value\x12\x18\n" +
|
||||
"\amessage\x18\x03 \x01(\tR\amessage\"9\n" +
|
||||
"\x0fCacheSetRequest\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value\"=\n" +
|
||||
"\tSetStatus\x12\x16\n" +
|
||||
"\x06status\x18\x01 \x01(\tR\x06status\x12\x18\n" +
|
||||
"\amessage\x18\x02 \x01(\tR\amessage2\xa6\x01\n" +
|
||||
"\x05Agent\x120\n" +
|
||||
"\x03Get\x12\x16.proto.CacheGetRequest\x1a\x11.proto.CacheValue\x12/\n" +
|
||||
"\x03Set\x12\x16.proto.CacheSetRequest\x1a\x10.proto.SetStatus\x12:\n" +
|
||||
"\bShutdown\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.EmptyB.Z,gitea.suyono.dev/suyono/go-agent/proto;protob\x06proto3"
|
||||
|
||||
var (
|
||||
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescOnce sync.Once
|
||||
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP() []byte {
|
||||
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescOnce.Do(func() {
|
||||
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc), len(file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc)))
|
||||
})
|
||||
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_goTypes = []any{
|
||||
(*CacheGetRequest)(nil), // 0: proto.CacheGetRequest
|
||||
(*CacheValue)(nil), // 1: proto.CacheValue
|
||||
(*CacheSetRequest)(nil), // 2: proto.CacheSetRequest
|
||||
(*SetStatus)(nil), // 3: proto.SetStatus
|
||||
(*emptypb.Empty)(nil), // 4: google.protobuf.Empty
|
||||
}
|
||||
var file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_depIdxs = []int32{
|
||||
0, // 0: proto.Agent.Get:input_type -> proto.CacheGetRequest
|
||||
2, // 1: proto.Agent.Set:input_type -> proto.CacheSetRequest
|
||||
4, // 2: proto.Agent.Shutdown:input_type -> google.protobuf.Empty
|
||||
1, // 3: proto.Agent.Get:output_type -> proto.CacheValue
|
||||
3, // 4: proto.Agent.Set:output_type -> proto.SetStatus
|
||||
4, // 5: proto.Agent.Shutdown:output_type -> google.protobuf.Empty
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_init() }
|
||||
func file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_init() {
|
||||
if File_gitea_suyono_dev_suyono_go_agent_proto_agent_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc), len(file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_goTypes,
|
||||
DependencyIndexes: file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_depIdxs,
|
||||
MessageInfos: file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes,
|
||||
}.Build()
|
||||
File_gitea_suyono_dev_suyono_go_agent_proto_agent_proto = out.File
|
||||
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_goTypes = nil
|
||||
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_depIdxs = nil
|
||||
}
|
||||
34
proto/agent.proto
Normal file
34
proto/agent.proto
Normal file
@@ -0,0 +1,34 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package proto;
|
||||
|
||||
option go_package="gitea.suyono.dev/suyono/go-agent/proto;proto";
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
message CacheGetRequest {
|
||||
string key = 1;
|
||||
}
|
||||
|
||||
message CacheValue {
|
||||
string status = 1;
|
||||
string value = 2;
|
||||
string message = 3;
|
||||
}
|
||||
|
||||
message CacheSetRequest {
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message SetStatus{
|
||||
string status = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
service Agent {
|
||||
rpc Get(CacheGetRequest) returns (CacheValue);
|
||||
rpc Set(CacheSetRequest) returns (SetStatus);
|
||||
rpc Shutdown(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
}
|
||||
|
||||
198
proto/agent_grpc.pb.go
Normal file
198
proto/agent_grpc.pb.go
Normal file
@@ -0,0 +1,198 @@
|
||||
// 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
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// 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 (
|
||||
Agent_Get_FullMethodName = "/proto.Agent/Get"
|
||||
Agent_Set_FullMethodName = "/proto.Agent/Set"
|
||||
Agent_Shutdown_FullMethodName = "/proto.Agent/Shutdown"
|
||||
)
|
||||
|
||||
// AgentClient is the client API for Agent 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 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)
|
||||
}
|
||||
|
||||
type agentClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewAgentClient(cc grpc.ClientConnInterface) AgentClient {
|
||||
return &agentClient{cc}
|
||||
}
|
||||
|
||||
func (c *agentClient) Get(ctx context.Context, in *CacheGetRequest, opts ...grpc.CallOption) (*CacheValue, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CacheValue)
|
||||
err := c.cc.Invoke(ctx, Agent_Get_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agentClient) Set(ctx context.Context, in *CacheSetRequest, opts ...grpc.CallOption) (*SetStatus, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SetStatus)
|
||||
err := c.cc.Invoke(ctx, Agent_Set_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agentClient) Shutdown(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_Shutdown_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.
|
||||
type AgentServer interface {
|
||||
Get(context.Context, *CacheGetRequest) (*CacheValue, error)
|
||||
Set(context.Context, *CacheSetRequest) (*SetStatus, error)
|
||||
Shutdown(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
|
||||
mustEmbedUnimplementedAgentServer()
|
||||
}
|
||||
|
||||
// UnimplementedAgentServer 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 UnimplementedAgentServer struct{}
|
||||
|
||||
func (UnimplementedAgentServer) Get(context.Context, *CacheGetRequest) (*CacheValue, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedAgentServer) Set(context.Context, *CacheSetRequest) (*SetStatus, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Set not implemented")
|
||||
}
|
||||
func (UnimplementedAgentServer) Shutdown(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Shutdown not implemented")
|
||||
}
|
||||
func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {}
|
||||
func (UnimplementedAgentServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeAgentServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to AgentServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeAgentServer interface {
|
||||
mustEmbedUnimplementedAgentServer()
|
||||
}
|
||||
|
||||
func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) {
|
||||
// If the following call pancis, it indicates UnimplementedAgentServer 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(&Agent_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Agent_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CacheGetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgentServer).Get(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Agent_Get_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgentServer).Get(ctx, req.(*CacheGetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agent_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CacheSetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgentServer).Set(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Agent_Set_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgentServer).Set(ctx, req.(*CacheSetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agent_Shutdown_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).Shutdown(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Agent_Shutdown_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgentServer).Shutdown(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)
|
||||
var Agent_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.Agent",
|
||||
HandlerType: (*AgentServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Get",
|
||||
Handler: _Agent_Get_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Set",
|
||||
Handler: _Agent_Set_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Shutdown",
|
||||
Handler: _Agent_Shutdown_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "gitea.suyono.dev/suyono/go-agent/proto/agent.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user