Files
schedule_converter/proto/runner/runner_grpc.pb.go
lafay 74438c1f7f refactor: 重构代码架构并使用 Modern Go 特性
- 重命名模块 jwts -> schedule_converter
- 新增 service 包,统一业务逻辑层
- 新增 pkg/logger 包,使用 slog 结构化日志
- 新增 pkg/errors 包,统一错误处理
- 拆分 captcha 包,图片识别移至 service/recognizer
- 清理 models 包,只保留数据结构定义
- 消除 grpc/handler.go 中的重复代码
- 简化 main.go,使用 slog 和 context
- 配置支持单例模式和结构化配置
- 使用 any 替代 interface{}
- 使用 sync.Map 替代 map + RWMutex
2026-03-16 13:40:53 +08:00

126 lines
4.9 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.19.4
// source: proto/runner/runner.proto
package runner
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 (
RunnerHub_Connect_FullMethodName = "/runner.RunnerHub/Connect"
)
// RunnerHubClient is the client API for RunnerHub 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.
//
// RunnerHub 服务 - 由 Backend 服务器实现
// Runner 作为客户端主动连接,建立双向流通信
type RunnerHubClient interface {
// Connect 建立双向流连接
// Runner 通过此连接注册、接收任务、返回结果
Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StreamMessage, StreamMessage], error)
}
type runnerHubClient struct {
cc grpc.ClientConnInterface
}
func NewRunnerHubClient(cc grpc.ClientConnInterface) RunnerHubClient {
return &runnerHubClient{cc}
}
func (c *runnerHubClient) Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StreamMessage, StreamMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &RunnerHub_ServiceDesc.Streams[0], RunnerHub_Connect_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[StreamMessage, StreamMessage]{ClientStream: stream}
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 RunnerHub_ConnectClient = grpc.BidiStreamingClient[StreamMessage, StreamMessage]
// RunnerHubServer is the server API for RunnerHub service.
// All implementations must embed UnimplementedRunnerHubServer
// for forward compatibility.
//
// RunnerHub 服务 - 由 Backend 服务器实现
// Runner 作为客户端主动连接,建立双向流通信
type RunnerHubServer interface {
// Connect 建立双向流连接
// Runner 通过此连接注册、接收任务、返回结果
Connect(grpc.BidiStreamingServer[StreamMessage, StreamMessage]) error
mustEmbedUnimplementedRunnerHubServer()
}
// UnimplementedRunnerHubServer 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 UnimplementedRunnerHubServer struct{}
func (UnimplementedRunnerHubServer) Connect(grpc.BidiStreamingServer[StreamMessage, StreamMessage]) error {
return status.Errorf(codes.Unimplemented, "method Connect not implemented")
}
func (UnimplementedRunnerHubServer) mustEmbedUnimplementedRunnerHubServer() {}
func (UnimplementedRunnerHubServer) testEmbeddedByValue() {}
// UnsafeRunnerHubServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RunnerHubServer will
// result in compilation errors.
type UnsafeRunnerHubServer interface {
mustEmbedUnimplementedRunnerHubServer()
}
func RegisterRunnerHubServer(s grpc.ServiceRegistrar, srv RunnerHubServer) {
// If the following call pancis, it indicates UnimplementedRunnerHubServer 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(&RunnerHub_ServiceDesc, srv)
}
func _RunnerHub_Connect_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(RunnerHubServer).Connect(&grpc.GenericServerStream[StreamMessage, StreamMessage]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type RunnerHub_ConnectServer = grpc.BidiStreamingServer[StreamMessage, StreamMessage]
// RunnerHub_ServiceDesc is the grpc.ServiceDesc for RunnerHub service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var RunnerHub_ServiceDesc = grpc.ServiceDesc{
ServiceName: "runner.RunnerHub",
HandlerType: (*RunnerHubServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "Connect",
Handler: _RunnerHub_Connect_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "proto/runner/runner.proto",
}