mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
- add proto/services/sync_service.proto and generate Go pb + grpc bindings - implement SyncServiceServer (streaming file scan + download) with: - request deduplication, in-memory cache (TTL), chunked streaming - concurrent-safe broadcast to waiters and server-side logging - register SyncSvr in gRPC server and expose sync client in GrpcClient: - add syncClient field, registration and safe getters with reconnection-aware timeouts - integrate gRPC sync into runner: - split syncFiles into syncFilesHTTP (legacy) and syncFilesGRPC - Runner now chooses implementation via config flag and performs streaming scan/download - controller improvements: - add semaphore-based rate limiting for sync scan requests with in-flight counters and logs - misc: - add utils.IsSyncGrpcEnabled() config helper - improve HTTP sync error diagnostics (Content-Type validation, response previews) - update/regenerate many protobuf and gRPC generated files (protoc/protoc-gen-go / protoc-gen-go-grpc version bumps)
122 lines
4.4 KiB
Go
122 lines
4.4 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.5.1
|
|
// - protoc v5.29.2
|
|
// source: services/metric_service.proto
|
|
|
|
package grpc
|
|
|
|
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 (
|
|
MetricService_Send_FullMethodName = "/grpc.MetricService/Send"
|
|
)
|
|
|
|
// MetricServiceClient is the client API for MetricService 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 MetricServiceClient interface {
|
|
Send(ctx context.Context, in *MetricServiceSendRequest, opts ...grpc.CallOption) (*Response, error)
|
|
}
|
|
|
|
type metricServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewMetricServiceClient(cc grpc.ClientConnInterface) MetricServiceClient {
|
|
return &metricServiceClient{cc}
|
|
}
|
|
|
|
func (c *metricServiceClient) Send(ctx context.Context, in *MetricServiceSendRequest, opts ...grpc.CallOption) (*Response, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(Response)
|
|
err := c.cc.Invoke(ctx, MetricService_Send_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// MetricServiceServer is the server API for MetricService service.
|
|
// All implementations must embed UnimplementedMetricServiceServer
|
|
// for forward compatibility.
|
|
type MetricServiceServer interface {
|
|
Send(context.Context, *MetricServiceSendRequest) (*Response, error)
|
|
mustEmbedUnimplementedMetricServiceServer()
|
|
}
|
|
|
|
// UnimplementedMetricServiceServer 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 UnimplementedMetricServiceServer struct{}
|
|
|
|
func (UnimplementedMetricServiceServer) Send(context.Context, *MetricServiceSendRequest) (*Response, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Send not implemented")
|
|
}
|
|
func (UnimplementedMetricServiceServer) mustEmbedUnimplementedMetricServiceServer() {}
|
|
func (UnimplementedMetricServiceServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeMetricServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to MetricServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeMetricServiceServer interface {
|
|
mustEmbedUnimplementedMetricServiceServer()
|
|
}
|
|
|
|
func RegisterMetricServiceServer(s grpc.ServiceRegistrar, srv MetricServiceServer) {
|
|
// If the following call pancis, it indicates UnimplementedMetricServiceServer 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(&MetricService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _MetricService_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(MetricServiceSendRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(MetricServiceServer).Send(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: MetricService_Send_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(MetricServiceServer).Send(ctx, req.(*MetricServiceSendRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// MetricService_ServiceDesc is the grpc.ServiceDesc for MetricService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var MetricService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "grpc.MetricService",
|
|
HandlerType: (*MetricServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Send",
|
|
Handler: _MetricService_Send_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "services/metric_service.proto",
|
|
}
|