Documentation
¶
Index ¶
- Variables
- func RegisterChatServer(s grpc.ServiceRegistrar, srv ChatServer)
- type ChatClient
- type ChatServer
- type Chat_JoinClient
- type Chat_JoinServer
- type Empty
- type Id
- type Message
- func (*Message) Descriptor() ([]byte, []int)deprecated
- func (x *Message) GetId() string
- func (x *Message) GetLamport() uint64
- func (x *Message) GetText() string
- func (*Message) ProtoMessage()
- func (x *Message) ProtoReflect() protoreflect.Message
- func (x *Message) Reset()
- func (x *Message) String() string
- type UnimplementedChatServer
- func (UnimplementedChatServer) Broadcast(context.Context, *Message) (*Empty, error)
- func (UnimplementedChatServer) Join(*User, Chat_JoinServer) error
- func (UnimplementedChatServer) Leave(context.Context, *Id) (*Empty, error)
- func (UnimplementedChatServer) Publish(context.Context, *Message) (*Empty, error)
- type UnsafeChatServer
- type User
Constants ¶
This section is empty.
Variables ¶
var Chat_ServiceDesc = grpc.ServiceDesc{ ServiceName: "proto.Chat", HandlerType: (*ChatServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Broadcast", Handler: _Chat_Broadcast_Handler, }, { MethodName: "Publish", Handler: _Chat_Publish_Handler, }, { MethodName: "Leave", Handler: _Chat_Leave_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Join", Handler: _Chat_Join_Handler, ServerStreams: true, }, }, Metadata: "chat.proto", }
Chat_ServiceDesc is the grpc.ServiceDesc for Chat service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_chat_proto protoreflect.FileDescriptor
Functions ¶
func RegisterChatServer ¶
func RegisterChatServer(s grpc.ServiceRegistrar, srv ChatServer)
Types ¶
type ChatClient ¶
type ChatClient interface { Broadcast(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Empty, error) Join(ctx context.Context, in *User, opts ...grpc.CallOption) (Chat_JoinClient, error) Publish(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Empty, error) Leave(ctx context.Context, in *Id, opts ...grpc.CallOption) (*Empty, error) }
ChatClient is the client API for Chat 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 NewChatClient ¶
func NewChatClient(cc grpc.ClientConnInterface) ChatClient
type ChatServer ¶
type ChatServer interface { Broadcast(context.Context, *Message) (*Empty, error) Join(*User, Chat_JoinServer) error Publish(context.Context, *Message) (*Empty, error) Leave(context.Context, *Id) (*Empty, error) // contains filtered or unexported methods }
ChatServer is the server API for Chat service. All implementations must embed UnimplementedChatServer for forward compatibility
type Chat_JoinClient ¶
type Chat_JoinClient interface { Recv() (*Message, error) grpc.ClientStream }
type Chat_JoinServer ¶
type Chat_JoinServer interface { Send(*Message) error grpc.ServerStream }
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type Id ¶
type Id struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Lamport uint64 `protobuf:"varint,2,opt,name=lamport,proto3" json:"lamport,omitempty"` // contains filtered or unexported fields }
func (*Id) Descriptor
deprecated
func (*Id) GetLamport ¶
func (*Id) ProtoMessage ¶
func (*Id) ProtoMessage()
func (*Id) ProtoReflect ¶
func (x *Id) ProtoReflect() protoreflect.Message
type Message ¶
type Message struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` Lamport uint64 `protobuf:"varint,3,opt,name=lamport,proto3" json:"lamport,omitempty"` // contains filtered or unexported fields }
func (*Message) Descriptor
deprecated
func (*Message) GetLamport ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type UnimplementedChatServer ¶
type UnimplementedChatServer struct { }
UnimplementedChatServer must be embedded to have forward compatible implementations.
func (UnimplementedChatServer) Join ¶
func (UnimplementedChatServer) Join(*User, Chat_JoinServer) error
type UnsafeChatServer ¶
type UnsafeChatServer interface {
// contains filtered or unexported methods
}
UnsafeChatServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ChatServer will result in compilation errors.
type User ¶
type User struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message