Redis cache

This commit is contained in:
2025-03-29 02:24:15 +08:00
parent f3f9ebb5af
commit 1651328a74
26 changed files with 786 additions and 636 deletions

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.28.3
// - protoc v5.29.3
// source: allocator.proto
package proto
@@ -21,6 +21,7 @@ const _ = grpc.SupportPackageIsVersion9
const (
AllocatorService_AllocMessageQueue_FullMethodName = "/proto.AllocatorService/AllocMessageQueue"
AllocatorService_AllocKv_FullMethodName = "/proto.AllocatorService/AllocKv"
AllocatorService_AllocCache_FullMethodName = "/proto.AllocatorService/AllocCache"
)
// AllocatorServiceClient is the client API for AllocatorService service.
@@ -29,6 +30,7 @@ const (
type AllocatorServiceClient interface {
AllocMessageQueue(ctx context.Context, in *AllocMqRequest, opts ...grpc.CallOption) (*AllocMqResponse, error)
AllocKv(ctx context.Context, in *AllocKvRequest, opts ...grpc.CallOption) (*AllocKvResponse, error)
AllocCache(ctx context.Context, in *AllocCacheRequest, opts ...grpc.CallOption) (*AllocCacheResponse, error)
}
type allocatorServiceClient struct {
@@ -59,12 +61,23 @@ func (c *allocatorServiceClient) AllocKv(ctx context.Context, in *AllocKvRequest
return out, nil
}
func (c *allocatorServiceClient) AllocCache(ctx context.Context, in *AllocCacheRequest, opts ...grpc.CallOption) (*AllocCacheResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AllocCacheResponse)
err := c.cc.Invoke(ctx, AllocatorService_AllocCache_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AllocatorServiceServer is the server API for AllocatorService service.
// All implementations must embed UnimplementedAllocatorServiceServer
// for forward compatibility.
type AllocatorServiceServer interface {
AllocMessageQueue(context.Context, *AllocMqRequest) (*AllocMqResponse, error)
AllocKv(context.Context, *AllocKvRequest) (*AllocKvResponse, error)
AllocCache(context.Context, *AllocCacheRequest) (*AllocCacheResponse, error)
mustEmbedUnimplementedAllocatorServiceServer()
}
@@ -81,6 +94,9 @@ func (UnimplementedAllocatorServiceServer) AllocMessageQueue(context.Context, *A
func (UnimplementedAllocatorServiceServer) AllocKv(context.Context, *AllocKvRequest) (*AllocKvResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AllocKv not implemented")
}
func (UnimplementedAllocatorServiceServer) AllocCache(context.Context, *AllocCacheRequest) (*AllocCacheResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AllocCache not implemented")
}
func (UnimplementedAllocatorServiceServer) mustEmbedUnimplementedAllocatorServiceServer() {}
func (UnimplementedAllocatorServiceServer) testEmbeddedByValue() {}
@@ -138,6 +154,24 @@ func _AllocatorService_AllocKv_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _AllocatorService_AllocCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AllocCacheRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AllocatorServiceServer).AllocCache(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AllocatorService_AllocCache_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AllocatorServiceServer).AllocCache(ctx, req.(*AllocCacheRequest))
}
return interceptor(ctx, in, info, handler)
}
// AllocatorService_ServiceDesc is the grpc.ServiceDesc for AllocatorService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -153,6 +187,10 @@ var AllocatorService_ServiceDesc = grpc.ServiceDesc{
MethodName: "AllocKv",
Handler: _AllocatorService_AllocKv_Handler,
},
{
MethodName: "AllocCache",
Handler: _AllocatorService_AllocCache_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "allocator.proto",