// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.27.1
// 	protoc        v3.15.6
// source: proto/mq.proto

package mq

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	sync "sync"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

type PubRequest struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Topic   string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
}

func (x *PubRequest) Reset() {
	*x = PubRequest{}
	if protoimpl.UnsafeEnabled {
		mi := &file_proto_mq_proto_msgTypes[0]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *PubRequest) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*PubRequest) ProtoMessage() {}

func (x *PubRequest) ProtoReflect() protoreflect.Message {
	mi := &file_proto_mq_proto_msgTypes[0]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use PubRequest.ProtoReflect.Descriptor instead.
func (*PubRequest) Descriptor() ([]byte, []int) {
	return file_proto_mq_proto_rawDescGZIP(), []int{0}
}

func (x *PubRequest) GetTopic() string {
	if x != nil {
		return x.Topic
	}
	return ""
}

func (x *PubRequest) GetPayload() []byte {
	if x != nil {
		return x.Payload
	}
	return nil
}

type PubResponse struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields
}

func (x *PubResponse) Reset() {
	*x = PubResponse{}
	if protoimpl.UnsafeEnabled {
		mi := &file_proto_mq_proto_msgTypes[1]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *PubResponse) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*PubResponse) ProtoMessage() {}

func (x *PubResponse) ProtoReflect() protoreflect.Message {
	mi := &file_proto_mq_proto_msgTypes[1]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use PubResponse.ProtoReflect.Descriptor instead.
func (*PubResponse) Descriptor() ([]byte, []int) {
	return file_proto_mq_proto_rawDescGZIP(), []int{1}
}

type SubRequest struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
}

func (x *SubRequest) Reset() {
	*x = SubRequest{}
	if protoimpl.UnsafeEnabled {
		mi := &file_proto_mq_proto_msgTypes[2]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *SubRequest) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*SubRequest) ProtoMessage() {}

func (x *SubRequest) ProtoReflect() protoreflect.Message {
	mi := &file_proto_mq_proto_msgTypes[2]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use SubRequest.ProtoReflect.Descriptor instead.
func (*SubRequest) Descriptor() ([]byte, []int) {
	return file_proto_mq_proto_rawDescGZIP(), []int{2}
}

func (x *SubRequest) GetTopic() string {
	if x != nil {
		return x.Topic
	}
	return ""
}

type SubResponse struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
}

func (x *SubResponse) Reset() {
	*x = SubResponse{}
	if protoimpl.UnsafeEnabled {
		mi := &file_proto_mq_proto_msgTypes[3]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *SubResponse) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*SubResponse) ProtoMessage() {}

func (x *SubResponse) ProtoReflect() protoreflect.Message {
	mi := &file_proto_mq_proto_msgTypes[3]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use SubResponse.ProtoReflect.Descriptor instead.
func (*SubResponse) Descriptor() ([]byte, []int) {
	return file_proto_mq_proto_rawDescGZIP(), []int{3}
}

func (x *SubResponse) GetPayload() []byte {
	if x != nil {
		return x.Payload
	}
	return nil
}

var File_proto_mq_proto protoreflect.FileDescriptor

var file_proto_mq_proto_rawDesc = []byte{
	0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
	0x12, 0x02, 0x6d, 0x71, 0x22, 0x3c, 0x0a, 0x0a, 0x50, 0x75, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65,
	0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28,
	0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c,
	0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f,
	0x61, 0x64, 0x22, 0x0d, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
	0x65, 0x22, 0x22, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
	0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
	0x74, 0x6f, 0x70, 0x69, 0x63, 0x22, 0x27, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x52, 0x65, 0x73, 0x70,
	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18,
	0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x32, 0x5a,
	0x0a, 0x02, 0x4d, 0x51, 0x12, 0x28, 0x0a, 0x03, 0x50, 0x75, 0x62, 0x12, 0x0e, 0x2e, 0x6d, 0x71,
	0x2e, 0x50, 0x75, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x6d, 0x71,
	0x2e, 0x50, 0x75, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2a,
	0x0a, 0x03, 0x53, 0x75, 0x62, 0x12, 0x0e, 0x2e, 0x6d, 0x71, 0x2e, 0x53, 0x75, 0x62, 0x52, 0x65,
	0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x6d, 0x71, 0x2e, 0x53, 0x75, 0x62, 0x52, 0x65,
	0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f,
	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6d, 0x71, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

var (
	file_proto_mq_proto_rawDescOnce sync.Once
	file_proto_mq_proto_rawDescData = file_proto_mq_proto_rawDesc
)

func file_proto_mq_proto_rawDescGZIP() []byte {
	file_proto_mq_proto_rawDescOnce.Do(func() {
		file_proto_mq_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_mq_proto_rawDescData)
	})
	return file_proto_mq_proto_rawDescData
}

var file_proto_mq_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_proto_mq_proto_goTypes = []interface{}{
	(*PubRequest)(nil),  // 0: mq.PubRequest
	(*PubResponse)(nil), // 1: mq.PubResponse
	(*SubRequest)(nil),  // 2: mq.SubRequest
	(*SubResponse)(nil), // 3: mq.SubResponse
}
var file_proto_mq_proto_depIdxs = []int32{
	0, // 0: mq.MQ.Pub:input_type -> mq.PubRequest
	2, // 1: mq.MQ.Sub:input_type -> mq.SubRequest
	1, // 2: mq.MQ.Pub:output_type -> mq.PubResponse
	3, // 3: mq.MQ.Sub:output_type -> mq.SubResponse
	2, // [2:4] is the sub-list for method output_type
	0, // [0:2] is the sub-list for method input_type
	0, // [0:0] is the sub-list for extension type_name
	0, // [0:0] is the sub-list for extension extendee
	0, // [0:0] is the sub-list for field type_name
}

func init() { file_proto_mq_proto_init() }
func file_proto_mq_proto_init() {
	if File_proto_mq_proto != nil {
		return
	}
	if !protoimpl.UnsafeEnabled {
		file_proto_mq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*PubRequest); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_proto_mq_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*PubResponse); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_proto_mq_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*SubRequest); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
		file_proto_mq_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*SubResponse); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: file_proto_mq_proto_rawDesc,
			NumEnums:      0,
			NumMessages:   4,
			NumExtensions: 0,
			NumServices:   1,
		},
		GoTypes:           file_proto_mq_proto_goTypes,
		DependencyIndexes: file_proto_mq_proto_depIdxs,
		MessageInfos:      file_proto_mq_proto_msgTypes,
	}.Build()
	File_proto_mq_proto = out.File
	file_proto_mq_proto_rawDesc = nil
	file_proto_mq_proto_goTypes = nil
	file_proto_mq_proto_depIdxs = nil
}

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6

// MQClient is the client API for MQ service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type MQClient interface {
	Pub(ctx context.Context, in *PubRequest, opts ...grpc.CallOption) (*PubResponse, error)
	Sub(ctx context.Context, in *SubRequest, opts ...grpc.CallOption) (MQ_SubClient, error)
}

type mQClient struct {
	cc grpc.ClientConnInterface
}

func NewMQClient(cc grpc.ClientConnInterface) MQClient {
	return &mQClient{cc}
}

func (c *mQClient) Pub(ctx context.Context, in *PubRequest, opts ...grpc.CallOption) (*PubResponse, error) {
	out := new(PubResponse)
	err := c.cc.Invoke(ctx, "/mq.MQ/Pub", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *mQClient) Sub(ctx context.Context, in *SubRequest, opts ...grpc.CallOption) (MQ_SubClient, error) {
	stream, err := c.cc.NewStream(ctx, &_MQ_serviceDesc.Streams[0], "/mq.MQ/Sub", opts...)
	if err != nil {
		return nil, err
	}
	x := &mQSubClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

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

type mQSubClient struct {
	grpc.ClientStream
}

func (x *mQSubClient) Recv() (*SubResponse, error) {
	m := new(SubResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// MQServer is the server API for MQ service.
type MQServer interface {
	Pub(context.Context, *PubRequest) (*PubResponse, error)
	Sub(*SubRequest, MQ_SubServer) error
}

// UnimplementedMQServer can be embedded to have forward compatible implementations.
type UnimplementedMQServer struct {
}

func (*UnimplementedMQServer) Pub(context.Context, *PubRequest) (*PubResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Pub not implemented")
}
func (*UnimplementedMQServer) Sub(*SubRequest, MQ_SubServer) error {
	return status.Errorf(codes.Unimplemented, "method Sub not implemented")
}

func RegisterMQServer(s *grpc.Server, srv MQServer) {
	s.RegisterService(&_MQ_serviceDesc, srv)
}

func _MQ_Pub_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PubRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(MQServer).Pub(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/mq.MQ/Pub",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(MQServer).Pub(ctx, req.(*PubRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _MQ_Sub_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(SubRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(MQServer).Sub(m, &mQSubServer{stream})
}

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

type mQSubServer struct {
	grpc.ServerStream
}

func (x *mQSubServer) Send(m *SubResponse) error {
	return x.ServerStream.SendMsg(m)
}

var _MQ_serviceDesc = grpc.ServiceDesc{
	ServiceName: "mq.MQ",
	HandlerType: (*MQServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Pub",
			Handler:    _MQ_Pub_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Sub",
			Handler:       _MQ_Sub_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "proto/mq.proto",
}
