proto

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Service_DownloadFile_FullMethodName           = "/collision.servicepb.Service/DownloadFile"
	Service_UploadFile_FullMethodName             = "/collision.servicepb.Service/UploadFile"
	Service_UploadMultipleFiles_FullMethodName    = "/collision.servicepb.Service/UploadMultipleFiles"
	Service_UploadToAnotherService_FullMethodName = "/collision.servicepb.Service/UploadToAnotherService"
)

Variables

View Source
var File_service_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "collision.servicepb.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "DownloadFile",
			Handler:       _Service_DownloadFile_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "UploadFile",
			Handler:       _Service_UploadFile_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "UploadMultipleFiles",
			Handler:       _Service_UploadMultipleFiles_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "UploadToAnotherService",
			Handler:       _Service_UploadToAnotherService_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "service.proto",
}

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)

Functions

func RegisterServiceHandler

func RegisterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterServiceHandler registers the http handlers for service Service to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterServiceHandlerClient

func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceClient) error

RegisterServiceHandlerClient registers the http handlers for service Service to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ServiceClient" to call the correct interceptors.

func RegisterServiceHandlerFromEndpoint

func RegisterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterServiceHandlerFromEndpoint is same as RegisterServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterServiceHandlerServer

func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceServer) error

RegisterServiceHandlerServer registers the http handlers for service Service to "mux". UnaryRPC :call ServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterServiceHandlerFromEndpoint instead.

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type DownloadFileRequest

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

func (*DownloadFileRequest) Descriptor deprecated

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

Deprecated: Use DownloadFileRequest.ProtoReflect.Descriptor instead.

func (*DownloadFileRequest) ProtoMessage

func (*DownloadFileRequest) ProtoMessage()

func (*DownloadFileRequest) ProtoReflect

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

func (*DownloadFileRequest) Reset

func (x *DownloadFileRequest) Reset()

func (*DownloadFileRequest) String

func (x *DownloadFileRequest) String() string

type ServiceClient

type ServiceClient interface {
	// download file
	DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (Service_DownloadFileClient, error)
	// upload file
	UploadFile(ctx context.Context, opts ...grpc.CallOption) (Service_UploadFileClient, error)
	// upload multiple files
	UploadMultipleFiles(ctx context.Context, opts ...grpc.CallOption) (Service_UploadMultipleFilesClient, error)
	// upload with stream to another service
	UploadToAnotherService(ctx context.Context, opts ...grpc.CallOption) (Service_UploadToAnotherServiceClient, error)
}

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.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	// download file
	DownloadFile(*DownloadFileRequest, Service_DownloadFileServer) error
	// upload file
	UploadFile(Service_UploadFileServer) error
	// upload multiple files
	UploadMultipleFiles(Service_UploadMultipleFilesServer) error
	// upload with stream to another service
	UploadToAnotherService(Service_UploadToAnotherServiceServer) error
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type Service_DownloadFileClient

type Service_DownloadFileClient interface {
	Recv() (*httpbody.HttpBody, error)
	grpc.ClientStream
}

type Service_DownloadFileServer

type Service_DownloadFileServer interface {
	Send(*httpbody.HttpBody) error
	grpc.ServerStream
}

type Service_UploadFileClient

type Service_UploadFileClient interface {
	Send(*httpbody.HttpBody) error
	CloseAndRecv() (*emptypb.Empty, error)
	grpc.ClientStream
}

type Service_UploadFileServer

type Service_UploadFileServer interface {
	SendAndClose(*emptypb.Empty) error
	Recv() (*httpbody.HttpBody, error)
	grpc.ServerStream
}

type Service_UploadMultipleFilesClient

type Service_UploadMultipleFilesClient interface {
	Send(*httpbody.HttpBody) error
	CloseAndRecv() (*emptypb.Empty, error)
	grpc.ClientStream
}

type Service_UploadMultipleFilesServer

type Service_UploadMultipleFilesServer interface {
	SendAndClose(*emptypb.Empty) error
	Recv() (*httpbody.HttpBody, error)
	grpc.ServerStream
}

type Service_UploadToAnotherServiceClient added in v0.1.1

type Service_UploadToAnotherServiceClient interface {
	Send(*httpbody.HttpBody) error
	CloseAndRecv() (*emptypb.Empty, error)
	grpc.ClientStream
}

type Service_UploadToAnotherServiceServer added in v0.1.1

type Service_UploadToAnotherServiceServer interface {
	SendAndClose(*emptypb.Empty) error
	Recv() (*httpbody.HttpBody, error)
	grpc.ServerStream
}

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) DownloadFile

func (UnimplementedServiceServer) UploadFile

func (UnimplementedServiceServer) UploadMultipleFiles

func (UnimplementedServiceServer) UploadToAnotherService added in v0.1.1

type UnsafeServiceServer

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

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.

Jump to

Keyboard shortcuts

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