Files
2026-02-28 05:33:16 +08:00

164 lines
6.0 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v3.19.4
// source: objectstory.proto
package pb
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 (
FileService_Upload_FullMethodName = "/file.FileService/Upload"
FileService_GetFileUrl_FullMethodName = "/file.FileService/GetFileUrl"
)
// FileServiceClient is the client API for FileService 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 FileServiceClient interface {
// 简单上传(适合小文件,或保存元数据)
Upload(ctx context.Context, in *UploadFileMetadataReq, opts ...grpc.CallOption) (*UploadFileResp, error)
// 获取文件访问链接(处理私有文件的鉴权)
GetFileUrl(ctx context.Context, in *GetFileUrlReq, opts ...grpc.CallOption) (*GetFileUrlResp, error)
}
type fileServiceClient struct {
cc grpc.ClientConnInterface
}
func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient {
return &fileServiceClient{cc}
}
func (c *fileServiceClient) Upload(ctx context.Context, in *UploadFileMetadataReq, opts ...grpc.CallOption) (*UploadFileResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UploadFileResp)
err := c.cc.Invoke(ctx, FileService_Upload_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) GetFileUrl(ctx context.Context, in *GetFileUrlReq, opts ...grpc.CallOption) (*GetFileUrlResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetFileUrlResp)
err := c.cc.Invoke(ctx, FileService_GetFileUrl_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// FileServiceServer is the server API for FileService service.
// All implementations must embed UnimplementedFileServiceServer
// for forward compatibility.
type FileServiceServer interface {
// 简单上传(适合小文件,或保存元数据)
Upload(context.Context, *UploadFileMetadataReq) (*UploadFileResp, error)
// 获取文件访问链接(处理私有文件的鉴权)
GetFileUrl(context.Context, *GetFileUrlReq) (*GetFileUrlResp, error)
mustEmbedUnimplementedFileServiceServer()
}
// UnimplementedFileServiceServer 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 UnimplementedFileServiceServer struct{}
func (UnimplementedFileServiceServer) Upload(context.Context, *UploadFileMetadataReq) (*UploadFileResp, error) {
return nil, status.Error(codes.Unimplemented, "method Upload not implemented")
}
func (UnimplementedFileServiceServer) GetFileUrl(context.Context, *GetFileUrlReq) (*GetFileUrlResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetFileUrl not implemented")
}
func (UnimplementedFileServiceServer) mustEmbedUnimplementedFileServiceServer() {}
func (UnimplementedFileServiceServer) testEmbeddedByValue() {}
// UnsafeFileServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FileServiceServer will
// result in compilation errors.
type UnsafeFileServiceServer interface {
mustEmbedUnimplementedFileServiceServer()
}
func RegisterFileServiceServer(s grpc.ServiceRegistrar, srv FileServiceServer) {
// If the following call panics, it indicates UnimplementedFileServiceServer 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(&FileService_ServiceDesc, srv)
}
func _FileService_Upload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadFileMetadataReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).Upload(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_Upload_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).Upload(ctx, req.(*UploadFileMetadataReq))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_GetFileUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetFileUrlReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).GetFileUrl(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: FileService_GetFileUrl_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).GetFileUrl(ctx, req.(*GetFileUrlReq))
}
return interceptor(ctx, in, info, handler)
}
// FileService_ServiceDesc is the grpc.ServiceDesc for FileService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var FileService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "file.FileService",
HandlerType: (*FileServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Upload",
Handler: _FileService_Upload_Handler,
},
{
MethodName: "GetFileUrl",
Handler: _FileService_GetFileUrl_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "objectstory.proto",
}