grpc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_service_unit_proto protoreflect.FileDescriptor
View Source
var Grpc_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc.grpc",
	HandlerType: (*GrpcServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SimpleRPC",
			Handler:    _Grpc_SimpleRPC_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ClientStreaming",
			Handler:       _Grpc_ClientStreaming_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "ServerStreaming",
			Handler:       _Grpc_ServerStreaming_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "BidirectionalStreaming",
			Handler:       _Grpc_BidirectionalStreaming_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "proto/service-unit.proto",
}

Grpc_ServiceDesc is the grpc.ServiceDesc for Grpc service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterGrpcServer

func RegisterGrpcServer(s grpc.ServiceRegistrar, srv GrpcServer)

Types

type GrpcClient

type GrpcClient interface {
	// Regular RPC
	SimpleRPC(ctx context.Context, in *StreamRequest, opts ...grpc.CallOption) (*StreamResponse, error)
	// Client-side streaming
	ClientStreaming(ctx context.Context, opts ...grpc.CallOption) (Grpc_ClientStreamingClient, error)
	// Server-side streaming
	ServerStreaming(ctx context.Context, in *StreamRequest, opts ...grpc.CallOption) (Grpc_ServerStreamingClient, error)
	// Bidirectional streaming
	BidirectionalStreaming(ctx context.Context, opts ...grpc.CallOption) (Grpc_BidirectionalStreamingClient, error)
}

GrpcClient is the client API for Grpc 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 NewGrpcClient

func NewGrpcClient(cc grpc.ClientConnInterface) GrpcClient

type GrpcServer

type GrpcServer interface {
	// Regular RPC
	SimpleRPC(context.Context, *StreamRequest) (*StreamResponse, error)
	// Client-side streaming
	ClientStreaming(Grpc_ClientStreamingServer) error
	// Server-side streaming
	ServerStreaming(*StreamRequest, Grpc_ServerStreamingServer) error
	// Bidirectional streaming
	BidirectionalStreaming(Grpc_BidirectionalStreamingServer) error
	// contains filtered or unexported methods
}

GrpcServer is the server API for Grpc service. All implementations must embed UnimplementedGrpcServer for forward compatibility

type Grpc_BidirectionalStreamingClient

type Grpc_BidirectionalStreamingClient interface {
	Send(*StreamRequest) error
	Recv() (*StreamResponse, error)
	grpc.ClientStream
}

type Grpc_BidirectionalStreamingServer

type Grpc_BidirectionalStreamingServer interface {
	Send(*StreamResponse) error
	Recv() (*StreamRequest, error)
	grpc.ServerStream
}

type Grpc_ClientStreamingClient

type Grpc_ClientStreamingClient interface {
	Send(*StreamRequest) error
	CloseAndRecv() (*StreamResponse, error)
	grpc.ClientStream
}

type Grpc_ClientStreamingServer

type Grpc_ClientStreamingServer interface {
	SendAndClose(*StreamResponse) error
	Recv() (*StreamRequest, error)
	grpc.ServerStream
}

type Grpc_ServerStreamingClient

type Grpc_ServerStreamingClient interface {
	Recv() (*StreamResponse, error)
	grpc.ClientStream
}

type Grpc_ServerStreamingServer

type Grpc_ServerStreamingServer interface {
	Send(*StreamResponse) error
	grpc.ServerStream
}

type StreamRequest

type StreamRequest struct {
	Route   string `protobuf:"bytes,1,opt,name=route,proto3" json:"route,omitempty"`
	Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

Message definition

func (*StreamRequest) Descriptor deprecated

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

Deprecated: Use StreamRequest.ProtoReflect.Descriptor instead.

func (*StreamRequest) GetPayload

func (x *StreamRequest) GetPayload() string

func (*StreamRequest) GetRoute

func (x *StreamRequest) GetRoute() string

func (*StreamRequest) ProtoMessage

func (*StreamRequest) ProtoMessage()

func (*StreamRequest) ProtoReflect

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

func (*StreamRequest) Reset

func (x *StreamRequest) Reset()

func (*StreamRequest) String

func (x *StreamRequest) String() string

type StreamResponse

type StreamResponse struct {
	Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*StreamResponse) Descriptor deprecated

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

Deprecated: Use StreamResponse.ProtoReflect.Descriptor instead.

func (*StreamResponse) GetPayload

func (x *StreamResponse) GetPayload() string

func (*StreamResponse) ProtoMessage

func (*StreamResponse) ProtoMessage()

func (*StreamResponse) ProtoReflect

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

func (*StreamResponse) Reset

func (x *StreamResponse) Reset()

func (*StreamResponse) String

func (x *StreamResponse) String() string

type UnimplementedGrpcServer

type UnimplementedGrpcServer struct {
}

UnimplementedGrpcServer must be embedded to have forward compatible implementations.

func (UnimplementedGrpcServer) BidirectionalStreaming

func (UnimplementedGrpcServer) ClientStreaming

func (UnimplementedGrpcServer) ServerStreaming

func (UnimplementedGrpcServer) SimpleRPC

type UnsafeGrpcServer

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

UnsafeGrpcServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GrpcServer will result in compilation errors.

Jump to

Keyboard shortcuts

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