proto

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_ysgrpc_proto_MQ_proto protoreflect.FileDescriptor
View Source
var File_ysgrpc_proto_helloworld_proto protoreflect.FileDescriptor
View Source
var Greeter_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.Greeter",
	HandlerType: (*GreeterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SayHello",
			Handler:    _Greeter_SayHello_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "ysgrpc/proto/helloworld.proto",
}

Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter 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 MQ_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.MQ",
	HandlerType: (*MQServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Pub",
			Handler:    _MQ_Pub_Handler,
		},
		{
			MethodName: "UnSub",
			Handler:    _MQ_UnSub_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Sub",
			Handler:       _MQ_Sub_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "ysgrpc/proto/MQ.proto",
}

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

Functions

func RegisterGreeterServer

func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)

func RegisterMQServer

func RegisterMQServer(s grpc.ServiceRegistrar, srv MQServer)

Types

type GreeterClient

type GreeterClient interface {
	// Sends a greeting
	SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
}

GreeterClient is the client API for Greeter 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 NewGreeterClient

func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient

type GreeterServer

type GreeterServer interface {
	// Sends a greeting
	SayHello(context.Context, *HelloRequest) (*HelloReply, error)
	// contains filtered or unexported methods
}

GreeterServer is the server API for Greeter service. All implementations must embed UnimplementedGreeterServer for forward compatibility

type HelloReply

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

The response message containing the greetings

func (*HelloReply) Descriptor deprecated

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

Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.

func (*HelloReply) GetMessage

func (x *HelloReply) GetMessage() string

func (*HelloReply) ProtoMessage

func (*HelloReply) ProtoMessage()

func (*HelloReply) ProtoReflect

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

func (*HelloReply) Reset

func (x *HelloReply) Reset()

func (*HelloReply) String

func (x *HelloReply) String() string

type HelloRequest

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

The request message containing the user's name.

func (*HelloRequest) Descriptor deprecated

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

Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.

func (*HelloRequest) GetName

func (x *HelloRequest) GetName() string

func (*HelloRequest) ProtoMessage

func (*HelloRequest) ProtoMessage()

func (*HelloRequest) ProtoReflect

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

func (*HelloRequest) Reset

func (x *HelloRequest) Reset()

func (*HelloRequest) String

func (x *HelloRequest) String() string

type MQClient

type MQClient interface {
	// 订阅消息
	Sub(ctx context.Context, in *SubRequest, opts ...grpc.CallOption) (MQ_SubClient, error)
	// 发布消息
	Pub(ctx context.Context, in *Message, opts ...grpc.CallOption) (*PubReply, error)
	// 取消订阅
	UnSub(ctx context.Context, in *UnSubRequest, opts ...grpc.CallOption) (*Message, error)
}

MQClient is the client API for MQ 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 NewMQClient

func NewMQClient(cc grpc.ClientConnInterface) MQClient

type MQServer

type MQServer interface {
	// 订阅消息
	Sub(*SubRequest, MQ_SubServer) error
	// 发布消息
	Pub(context.Context, *Message) (*PubReply, error)
	// 取消订阅
	UnSub(context.Context, *UnSubRequest) (*Message, error)
	// contains filtered or unexported methods
}

MQServer is the server API for MQ service. All implementations must embed UnimplementedMQServer for forward compatibility

type MQ_SubClient

type MQ_SubClient interface {
	Recv() (*Message, error)
	grpc.ClientStream
}

type MQ_SubServer

type MQ_SubServer interface {
	Send(*Message) error
	grpc.ServerStream
}

type Message

type Message struct {
	Topic   string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`     // 话题
	Message []byte `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 要发送的数据
	// contains filtered or unexported fields
}

消息结构

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetMessage

func (x *Message) GetMessage() []byte

func (*Message) GetTopic

func (x *Message) GetTopic() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type PubReply

type PubReply struct {
	Num int32 `protobuf:"varint,1,opt,name=num,proto3" json:"num,omitempty"` // 已转发的人数
	// contains filtered or unexported fields
}

发布返回信息

func (*PubReply) Descriptor deprecated

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

Deprecated: Use PubReply.ProtoReflect.Descriptor instead.

func (*PubReply) GetNum

func (x *PubReply) GetNum() int32

func (*PubReply) ProtoMessage

func (*PubReply) ProtoMessage()

func (*PubReply) ProtoReflect

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

func (*PubReply) Reset

func (x *PubReply) Reset()

func (*PubReply) String

func (x *PubReply) String() string

type SubRequest

type SubRequest struct {
	Topics string `protobuf:"bytes,1,opt,name=topics,proto3" json:"topics,omitempty"` // 话题使用 , 分隔不同的话题
	// contains filtered or unexported fields
}

订阅消息只包括 topic 信息

func (*SubRequest) Descriptor deprecated

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

Deprecated: Use SubRequest.ProtoReflect.Descriptor instead.

func (*SubRequest) GetTopics

func (x *SubRequest) GetTopics() string

func (*SubRequest) ProtoMessage

func (*SubRequest) ProtoMessage()

func (*SubRequest) ProtoReflect

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

func (*SubRequest) Reset

func (x *SubRequest) Reset()

func (*SubRequest) String

func (x *SubRequest) String() string

type UnSubRequest

type UnSubRequest struct {
	Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

取消订阅的请求西悉尼

func (*UnSubRequest) Descriptor deprecated

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

Deprecated: Use UnSubRequest.ProtoReflect.Descriptor instead.

func (*UnSubRequest) GetId

func (x *UnSubRequest) GetId() int32

func (*UnSubRequest) ProtoMessage

func (*UnSubRequest) ProtoMessage()

func (*UnSubRequest) ProtoReflect

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

func (*UnSubRequest) Reset

func (x *UnSubRequest) Reset()

func (*UnSubRequest) String

func (x *UnSubRequest) String() string

type UnimplementedGreeterServer

type UnimplementedGreeterServer struct {
}

UnimplementedGreeterServer must be embedded to have forward compatible implementations.

func (UnimplementedGreeterServer) SayHello

type UnimplementedMQServer

type UnimplementedMQServer struct {
}

UnimplementedMQServer must be embedded to have forward compatible implementations.

func (UnimplementedMQServer) Pub

func (UnimplementedMQServer) Sub

func (UnimplementedMQServer) UnSub

type UnsafeGreeterServer

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

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

type UnsafeMQServer

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

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

Jump to

Keyboard shortcuts

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