file

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileService_UploadFile_FullMethodName           = "/file.FileService/UploadFile"
	FileService_AuthorizedUploadFile_FullMethodName = "/file.FileService/AuthorizedUploadFile"
)
View Source
const EndpointFileServiceAuthorizedUploadFile = "/file.FileService/AuthorizedUploadFile"
View Source
const EndpointFileServiceUploadFile = "/file.FileService/UploadFile"
View Source
const HandlerFileService = "file.FileService"

HandlerFileService is the name of a service, it's here to static type/reference.

Variables

View Source
var FileService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "file.FileService",
	HandlerType: (*FileServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "UploadFile",
			Handler:       _FileService_UploadFile_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "AuthorizedUploadFile",
			Handler:       _FileService_AuthorizedUploadFile_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "file/file.proto",
}

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)

View Source
var File_file_file_proto protoreflect.FileDescriptor

Functions

func RegisterFileServiceHandler

func RegisterFileServiceHandler(handler any) server.RegistrationFunc

RegisterFileServiceHandler will return a registration function that can be provided to entrypoints as a handler registration.

Types

type DRPCFileServiceDescription

type DRPCFileServiceDescription struct{}

func (DRPCFileServiceDescription) Method

func (DRPCFileServiceDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool)

func (DRPCFileServiceDescription) NumMethods

func (DRPCFileServiceDescription) NumMethods() int

type DRPCFileServiceServer

type DRPCFileServiceServer interface {
	UploadFile(DRPCFileService_UploadFileStream) error
	AuthorizedUploadFile(DRPCFileService_AuthorizedUploadFileStream) error
}

type DRPCFileServiceUnimplementedServer

type DRPCFileServiceUnimplementedServer struct{}

func (*DRPCFileServiceUnimplementedServer) AuthorizedUploadFile

func (*DRPCFileServiceUnimplementedServer) UploadFile

type DRPCFileService_AuthorizedUploadFileStream

type DRPCFileService_AuthorizedUploadFileStream interface {
	drpc.Stream
	SendAndClose(*UploadResponse) error
	Recv() (*FileChunk, error)
}

type DRPCFileService_UploadFileStream

type DRPCFileService_UploadFileStream interface {
	drpc.Stream
	SendAndClose(*UploadResponse) error
	Recv() (*FileChunk, error)
}

type FileChunk

type FileChunk struct {

	// File metadata (only sent in the first chunk)
	Filename    string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
	ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	// The actual chunk of data
	Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*FileChunk) Descriptor deprecated

func (*FileChunk) Descriptor() ([]byte, []int)

Deprecated: Use FileChunk.ProtoReflect.Descriptor instead.

func (*FileChunk) GetContentType

func (x *FileChunk) GetContentType() string

func (*FileChunk) GetData

func (x *FileChunk) GetData() []byte

func (*FileChunk) GetFilename

func (x *FileChunk) GetFilename() string

func (*FileChunk) ProtoMessage

func (*FileChunk) ProtoMessage()

func (*FileChunk) ProtoReflect

func (x *FileChunk) ProtoReflect() protoreflect.Message

func (*FileChunk) Reset

func (x *FileChunk) Reset()

func (*FileChunk) String

func (x *FileChunk) String() string

type FileServiceAuthorizedUploadFileStream

type FileServiceAuthorizedUploadFileStream interface {
	Send(*UploadResponse) error
	Recv() (*FileChunk, error)
	Context() context.Context
	Close() error
	CloseSend(*UploadResponse) error
}

FileServiceAuthorizedUploadFileStream defines the streaming interface for AuthorizedUploadFile

type FileServiceClient

type FileServiceClient struct {
	// contains filtered or unexported fields
}

FileServiceClient is the client for file.FileService

func NewFileServiceClient

func NewFileServiceClient(client client.Client) *FileServiceClient

NewFileServiceClient creates a new client for file.FileService

func (*FileServiceClient) AuthorizedUploadFile

func (c *FileServiceClient) AuthorizedUploadFile(ctx context.Context, service string, opts ...client.CallOption) (client.StreamIface[*FileChunk, *UploadResponse], error)

AuthorizedUploadFile creates a client-streaming connection to AuthorizedUploadFile.

func (*FileServiceClient) UploadFile

UploadFile creates a client-streaming connection to UploadFile.

type FileServiceHandler

type FileServiceHandler interface {
	UploadFile(stream FileServiceUploadFileStream) error

	AuthorizedUploadFile(stream FileServiceAuthorizedUploadFileStream) error
}

FileServiceHandler is the Handler for file.FileService

type FileServiceServer

type FileServiceServer interface {
	// Client streaming RPC for file upload
	UploadFile(grpc.ClientStreamingServer[FileChunk, UploadResponse]) error
	AuthorizedUploadFile(grpc.ClientStreamingServer[FileChunk, UploadResponse]) error
}

FileServiceServer is the server API for FileService service. All implementations should embed UnimplementedFileServiceServer for forward compatibility.

type FileServiceUploadFileStream

type FileServiceUploadFileStream interface {
	Send(*UploadResponse) error
	Recv() (*FileChunk, error)
	Context() context.Context
	Close() error
	CloseSend(*UploadResponse) error
}

FileServiceUploadFileStream defines the streaming interface for UploadFile

type FileService_AuthorizedUploadFileServer

type FileService_AuthorizedUploadFileServer = grpc.ClientStreamingServer[FileChunk, UploadResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type FileService_UploadFileServer

type FileService_UploadFileServer = grpc.ClientStreamingServer[FileChunk, UploadResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type UnimplementedFileServiceServer

type UnimplementedFileServiceServer struct{}

UnimplementedFileServiceServer should 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.

func (UnimplementedFileServiceServer) AuthorizedUploadFile

func (UnimplementedFileServiceServer) UploadFile

type UnsafeFileServiceServer

type UnsafeFileServiceServer interface {
	// contains filtered or unexported methods
}

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 UploadResponse

type UploadResponse struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`             // ID of the uploaded file
	Size     int64  `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`        // Total size received
	Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"` // Name of the file
	Success  bool   `protobuf:"varint,4,opt,name=success,proto3" json:"success,omitempty"`  // Whether upload succeeded
	// contains filtered or unexported fields
}

func (*UploadResponse) Descriptor deprecated

func (*UploadResponse) Descriptor() ([]byte, []int)

Deprecated: Use UploadResponse.ProtoReflect.Descriptor instead.

func (*UploadResponse) GetFilename

func (x *UploadResponse) GetFilename() string

func (*UploadResponse) GetId

func (x *UploadResponse) GetId() string

func (*UploadResponse) GetSize

func (x *UploadResponse) GetSize() int64

func (*UploadResponse) GetSuccess

func (x *UploadResponse) GetSuccess() bool

func (*UploadResponse) ProtoMessage

func (*UploadResponse) ProtoMessage()

func (*UploadResponse) ProtoReflect

func (x *UploadResponse) ProtoReflect() protoreflect.Message

func (*UploadResponse) Reset

func (x *UploadResponse) Reset()

func (*UploadResponse) String

func (x *UploadResponse) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL