// Code generated by protoc-gen-go. DO NOT EDIT.
// source: go-grpc-example/3-server_stream_rpc/proto/server_stream.proto

package proto

import (
	context "context"
	fmt "fmt"
	proto "github.com/golang/protobuf/proto"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	math "math"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package

// 定义发送请求信息
type SimpleRequest struct {
	// 定义发送的参数，采用驼峰命名方式，小写加下划线，如：student_name
	// 请求参数
	Data                 string   `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *SimpleRequest) Reset()         { *m = SimpleRequest{} }
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
func (*SimpleRequest) ProtoMessage()    {}
func (*SimpleRequest) Descriptor() ([]byte, []int) {
	return fileDescriptor_d2b76291b5a9393a, []int{0}
}

func (m *SimpleRequest) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_SimpleRequest.Unmarshal(m, b)
}
func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic)
}
func (m *SimpleRequest) XXX_Merge(src proto.Message) {
	xxx_messageInfo_SimpleRequest.Merge(m, src)
}
func (m *SimpleRequest) XXX_Size() int {
	return xxx_messageInfo_SimpleRequest.Size(m)
}
func (m *SimpleRequest) XXX_DiscardUnknown() {
	xxx_messageInfo_SimpleRequest.DiscardUnknown(m)
}

var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo

func (m *SimpleRequest) GetData() string {
	if m != nil {
		return m.Data
	}
	return ""
}

// 定义响应信息
type SimpleResponse struct {
	// 定义接收的参数
	// 参数类型 参数名 标识号(不可重复)
	Code                 int32    `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Value                string   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *SimpleResponse) Reset()         { *m = SimpleResponse{} }
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
func (*SimpleResponse) ProtoMessage()    {}
func (*SimpleResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_d2b76291b5a9393a, []int{1}
}

func (m *SimpleResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_SimpleResponse.Unmarshal(m, b)
}
func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic)
}
func (m *SimpleResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_SimpleResponse.Merge(m, src)
}
func (m *SimpleResponse) XXX_Size() int {
	return xxx_messageInfo_SimpleResponse.Size(m)
}
func (m *SimpleResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_SimpleResponse.DiscardUnknown(m)
}

var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo

func (m *SimpleResponse) GetCode() int32 {
	if m != nil {
		return m.Code
	}
	return 0
}

func (m *SimpleResponse) GetValue() string {
	if m != nil {
		return m.Value
	}
	return ""
}

// 定义流式响应信息
type StreamResponse struct {
	// 流式响应数据
	StreamValue          string   `protobuf:"bytes,1,opt,name=stream_value,json=streamValue,proto3" json:"stream_value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *StreamResponse) Reset()         { *m = StreamResponse{} }
func (m *StreamResponse) String() string { return proto.CompactTextString(m) }
func (*StreamResponse) ProtoMessage()    {}
func (*StreamResponse) Descriptor() ([]byte, []int) {
	return fileDescriptor_d2b76291b5a9393a, []int{2}
}

func (m *StreamResponse) XXX_Unmarshal(b []byte) error {
	return xxx_messageInfo_StreamResponse.Unmarshal(m, b)
}
func (m *StreamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	return xxx_messageInfo_StreamResponse.Marshal(b, m, deterministic)
}
func (m *StreamResponse) XXX_Merge(src proto.Message) {
	xxx_messageInfo_StreamResponse.Merge(m, src)
}
func (m *StreamResponse) XXX_Size() int {
	return xxx_messageInfo_StreamResponse.Size(m)
}
func (m *StreamResponse) XXX_DiscardUnknown() {
	xxx_messageInfo_StreamResponse.DiscardUnknown(m)
}

var xxx_messageInfo_StreamResponse proto.InternalMessageInfo

func (m *StreamResponse) GetStreamValue() string {
	if m != nil {
		return m.StreamValue
	}
	return ""
}

func init() {
	proto.RegisterType((*SimpleRequest)(nil), "proto.SimpleRequest")
	proto.RegisterType((*SimpleResponse)(nil), "proto.SimpleResponse")
	proto.RegisterType((*StreamResponse)(nil), "proto.StreamResponse")
}

func init() {
	proto.RegisterFile("go-grpc-example/3-server_stream_rpc/proto/server_stream.proto", fileDescriptor_d2b76291b5a9393a)
}

var fileDescriptor_d2b76291b5a9393a = []byte{
	// 228 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8e, 0xb1, 0x4a, 0xc5, 0x30,
	0x14, 0x86, 0x6f, 0xc4, 0x08, 0xf7, 0x78, 0xed, 0x10, 0x2a, 0x14, 0x27, 0x8d, 0x8b, 0x4b, 0x5b,
	0xb1, 0xe0, 0x20, 0xfa, 0x06, 0x4e, 0x29, 0xb8, 0x96, 0xd8, 0x1e, 0x4a, 0xa1, 0x35, 0x31, 0x49,
	0x8b, 0x0f, 0xe0, 0x83, 0x4b, 0x4f, 0x54, 0xa8, 0x8b, 0x53, 0x4e, 0xfe, 0xfc, 0x5f, 0xce, 0x07,
	0x4f, 0xbd, 0xc9, 0x7b, 0x67, 0xdb, 0x1c, 0x3f, 0xf4, 0x64, 0x47, 0x2c, 0xab, 0xdc, 0xa3, 0x5b,
	0xd0, 0x35, 0x3e, 0x38, 0xd4, 0x53, 0xe3, 0x6c, 0x5b, 0x5a, 0x67, 0x82, 0x29, 0x37, 0x79, 0x41,
	0x99, 0xe0, 0x74, 0xc8, 0x6b, 0x38, 0xab, 0x87, 0x15, 0x57, 0xf8, 0x3e, 0xa3, 0x0f, 0x42, 0xc0,
	0x71, 0xa7, 0x83, 0xce, 0xd8, 0x25, 0xbb, 0xd9, 0x2b, 0x9a, 0xe5, 0x03, 0x24, 0x3f, 0x25, 0x6f,
	0xcd, 0x9b, 0xc7, 0xb5, 0xd5, 0x9a, 0x0e, 0xa9, 0xc5, 0x15, 0xcd, 0x22, 0x05, 0xbe, 0xe8, 0x71,
	0xc6, 0xec, 0x88, 0xd0, 0x78, 0x91, 0x15, 0x24, 0x35, 0xed, 0xfd, 0x65, 0xaf, 0xe0, 0xf0, 0x6d,
	0x18, 0xeb, 0x71, 0xd3, 0x69, 0xcc, 0x5e, 0xd6, 0xe8, 0xee, 0x93, 0xc1, 0x21, 0x52, 0x35, 0xa9,
	0x8b, 0x7b, 0xe0, 0xca, 0xcc, 0x01, 0x45, 0x1a, 0xf5, 0x8b, 0x8d, 0xf4, 0xc5, 0xf9, 0x9f, 0x34,
	0x6e, 0x92, 0x3b, 0xf1, 0x08, 0xfb, 0xe7, 0xc1, 0x07, 0xfa, 0xf5, 0x3f, 0x76, 0x63, 0x29, 0x77,
	0xb7, 0xec, 0xf5, 0x84, 0x5e, 0xaa, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4f, 0xd3, 0x96, 0xd7,
	0x6b, 0x01, 0x00, 0x00,
}

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

// 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.SupportPackageIsVersion4

// StreamServerClient is the client API for StreamServer service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type StreamServerClient interface {
	Route(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
	// 服务端流式rpc，在响应数据前添加stream
	ListValue(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (StreamServer_ListValueClient, error)
}

type streamServerClient struct {
	cc *grpc.ClientConn
}

func NewStreamServerClient(cc *grpc.ClientConn) StreamServerClient {
	return &streamServerClient{cc}
}

func (c *streamServerClient) Route(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
	out := new(SimpleResponse)
	err := c.cc.Invoke(ctx, "/proto.StreamServer/Route", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *streamServerClient) ListValue(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (StreamServer_ListValueClient, error) {
	stream, err := c.cc.NewStream(ctx, &_StreamServer_serviceDesc.Streams[0], "/proto.StreamServer/ListValue", opts...)
	if err != nil {
		return nil, err
	}
	x := &streamServerListValueClient{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 StreamServer_ListValueClient interface {
	Recv() (*StreamResponse, error)
	grpc.ClientStream
}

type streamServerListValueClient struct {
	grpc.ClientStream
}

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

// StreamServerServer is the server API for StreamServer service.
type StreamServerServer interface {
	Route(context.Context, *SimpleRequest) (*SimpleResponse, error)
	// 服务端流式rpc，在响应数据前添加stream
	ListValue(*SimpleRequest, StreamServer_ListValueServer) error
}

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

func (*UnimplementedStreamServerServer) Route(ctx context.Context, req *SimpleRequest) (*SimpleResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Route not implemented")
}
func (*UnimplementedStreamServerServer) ListValue(req *SimpleRequest, srv StreamServer_ListValueServer) error {
	return status.Errorf(codes.Unimplemented, "method ListValue not implemented")
}

func RegisterStreamServerServer(s *grpc.Server, srv StreamServerServer) {
	s.RegisterService(&_StreamServer_serviceDesc, srv)
}

func _StreamServer_Route_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SimpleRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(StreamServerServer).Route(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/proto.StreamServer/Route",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(StreamServerServer).Route(ctx, req.(*SimpleRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _StreamServer_ListValue_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(SimpleRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(StreamServerServer).ListValue(m, &streamServerListValueServer{stream})
}

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

type streamServerListValueServer struct {
	grpc.ServerStream
}

func (x *streamServerListValueServer) Send(m *StreamResponse) error {
	return x.ServerStream.SendMsg(m)
}

var _StreamServer_serviceDesc = grpc.ServiceDesc{
	ServiceName: "proto.StreamServer",
	HandlerType: (*StreamServerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Route",
			Handler:    _StreamServer_Route_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ListValue",
			Handler:       _StreamServer_ListValue_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "go-grpc-example/3-server_stream_rpc/proto/server_stream.proto",
}
