203 lines
5.8 KiB
Go
203 lines
5.8 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.2.0
|
|
// - protoc (unknown)
|
|
// source: fileserver/api.proto
|
|
|
|
package fileserver
|
|
|
|
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.32.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion7
|
|
|
|
// ServiceClient is the client API for Service 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 ServiceClient interface {
|
|
UploadFile(ctx context.Context, opts ...grpc.CallOption) (Service_UploadFileClient, error)
|
|
DownloadFile(ctx context.Context, in *FileInfo, opts ...grpc.CallOption) (Service_DownloadFileClient, error)
|
|
}
|
|
|
|
type serviceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
|
|
return &serviceClient{cc}
|
|
}
|
|
|
|
func (c *serviceClient) UploadFile(ctx context.Context, opts ...grpc.CallOption) (Service_UploadFileClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, &Service_ServiceDesc.Streams[0], "/fileserver.Service/UploadFile", opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &serviceUploadFileClient{stream}
|
|
return x, nil
|
|
}
|
|
|
|
type Service_UploadFileClient interface {
|
|
Send(*FileStream) error
|
|
CloseAndRecv() (*FileInfo, error)
|
|
grpc.ClientStream
|
|
}
|
|
|
|
type serviceUploadFileClient struct {
|
|
grpc.ClientStream
|
|
}
|
|
|
|
func (x *serviceUploadFileClient) Send(m *FileStream) error {
|
|
return x.ClientStream.SendMsg(m)
|
|
}
|
|
|
|
func (x *serviceUploadFileClient) CloseAndRecv() (*FileInfo, error) {
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
m := new(FileInfo)
|
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (c *serviceClient) DownloadFile(ctx context.Context, in *FileInfo, opts ...grpc.CallOption) (Service_DownloadFileClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, &Service_ServiceDesc.Streams[1], "/fileserver.Service/DownloadFile", opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &serviceDownloadFileClient{stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
type Service_DownloadFileClient interface {
|
|
Recv() (*FileStream, error)
|
|
grpc.ClientStream
|
|
}
|
|
|
|
type serviceDownloadFileClient struct {
|
|
grpc.ClientStream
|
|
}
|
|
|
|
func (x *serviceDownloadFileClient) Recv() (*FileStream, error) {
|
|
m := new(FileStream)
|
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// ServiceServer is the server API for Service service.
|
|
// All implementations must embed UnimplementedServiceServer
|
|
// for forward compatibility
|
|
type ServiceServer interface {
|
|
UploadFile(Service_UploadFileServer) error
|
|
DownloadFile(*FileInfo, Service_DownloadFileServer) error
|
|
mustEmbedUnimplementedServiceServer()
|
|
}
|
|
|
|
// UnimplementedServiceServer must be embedded to have forward compatible implementations.
|
|
type UnimplementedServiceServer struct {
|
|
}
|
|
|
|
func (UnimplementedServiceServer) UploadFile(Service_UploadFileServer) error {
|
|
return status.Errorf(codes.Unimplemented, "method UploadFile not implemented")
|
|
}
|
|
func (UnimplementedServiceServer) DownloadFile(*FileInfo, Service_DownloadFileServer) error {
|
|
return status.Errorf(codes.Unimplemented, "method DownloadFile not implemented")
|
|
}
|
|
func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {}
|
|
|
|
// UnsafeServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to ServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeServiceServer interface {
|
|
mustEmbedUnimplementedServiceServer()
|
|
}
|
|
|
|
func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer) {
|
|
s.RegisterService(&Service_ServiceDesc, srv)
|
|
}
|
|
|
|
func _Service_UploadFile_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
return srv.(ServiceServer).UploadFile(&serviceUploadFileServer{stream})
|
|
}
|
|
|
|
type Service_UploadFileServer interface {
|
|
SendAndClose(*FileInfo) error
|
|
Recv() (*FileStream, error)
|
|
grpc.ServerStream
|
|
}
|
|
|
|
type serviceUploadFileServer struct {
|
|
grpc.ServerStream
|
|
}
|
|
|
|
func (x *serviceUploadFileServer) SendAndClose(m *FileInfo) error {
|
|
return x.ServerStream.SendMsg(m)
|
|
}
|
|
|
|
func (x *serviceUploadFileServer) Recv() (*FileStream, error) {
|
|
m := new(FileStream)
|
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func _Service_DownloadFile_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(FileInfo)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(ServiceServer).DownloadFile(m, &serviceDownloadFileServer{stream})
|
|
}
|
|
|
|
type Service_DownloadFileServer interface {
|
|
Send(*FileStream) error
|
|
grpc.ServerStream
|
|
}
|
|
|
|
type serviceDownloadFileServer struct {
|
|
grpc.ServerStream
|
|
}
|
|
|
|
func (x *serviceDownloadFileServer) Send(m *FileStream) error {
|
|
return x.ServerStream.SendMsg(m)
|
|
}
|
|
|
|
// Service_ServiceDesc is the grpc.ServiceDesc for Service service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var Service_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "fileserver.Service",
|
|
HandlerType: (*ServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "UploadFile",
|
|
Handler: _Service_UploadFile_Handler,
|
|
ClientStreams: true,
|
|
},
|
|
{
|
|
StreamName: "DownloadFile",
|
|
Handler: _Service_DownloadFile_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "fileserver/api.proto",
|
|
}
|