initial import
This commit is contained in:
190
example/rpc/remote/stream/greet.pb.go
Normal file
190
example/rpc/remote/stream/greet.pb.go
Normal file
@@ -0,0 +1,190 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: greet.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package stream is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
greet.proto
|
||||
|
||||
It has these top-level messages:
|
||||
StreamReq
|
||||
StreamResp
|
||||
*/
|
||||
package stream
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// 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.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type StreamReq struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StreamReq) Reset() { *m = StreamReq{} }
|
||||
func (m *StreamReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamReq) ProtoMessage() {}
|
||||
func (*StreamReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *StreamReq) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type StreamResp struct {
|
||||
Greet string `protobuf:"bytes,1,opt,name=greet" json:"greet,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StreamResp) Reset() { *m = StreamResp{} }
|
||||
func (m *StreamResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamResp) ProtoMessage() {}
|
||||
func (*StreamResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *StreamResp) GetGreet() string {
|
||||
if m != nil {
|
||||
return m.Greet
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StreamReq)(nil), "stream.StreamReq")
|
||||
proto.RegisterType((*StreamResp)(nil), "stream.StreamResp")
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
// Client API for StreamGreeter service
|
||||
|
||||
type StreamGreeterClient interface {
|
||||
Greet(ctx context.Context, opts ...grpc.CallOption) (StreamGreeter_GreetClient, error)
|
||||
}
|
||||
|
||||
type streamGreeterClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewStreamGreeterClient(cc *grpc.ClientConn) StreamGreeterClient {
|
||||
return &streamGreeterClient{cc}
|
||||
}
|
||||
|
||||
func (c *streamGreeterClient) Greet(ctx context.Context, opts ...grpc.CallOption) (StreamGreeter_GreetClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_StreamGreeter_serviceDesc.Streams[0], c.cc, "/stream.StreamGreeter/greet", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &streamGreeterGreetClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type StreamGreeter_GreetClient interface {
|
||||
Send(*StreamReq) error
|
||||
Recv() (*StreamResp, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type streamGreeterGreetClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *streamGreeterGreetClient) Send(m *StreamReq) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *streamGreeterGreetClient) Recv() (*StreamResp, error) {
|
||||
m := new(StreamResp)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for StreamGreeter service
|
||||
|
||||
type StreamGreeterServer interface {
|
||||
Greet(StreamGreeter_GreetServer) error
|
||||
}
|
||||
|
||||
func RegisterStreamGreeterServer(s *grpc.Server, srv StreamGreeterServer) {
|
||||
s.RegisterService(&_StreamGreeter_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _StreamGreeter_Greet_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(StreamGreeterServer).Greet(&streamGreeterGreetServer{stream})
|
||||
}
|
||||
|
||||
type StreamGreeter_GreetServer interface {
|
||||
Send(*StreamResp) error
|
||||
Recv() (*StreamReq, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type streamGreeterGreetServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *streamGreeterGreetServer) Send(m *StreamResp) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *streamGreeterGreetServer) Recv() (*StreamReq, error) {
|
||||
m := new(StreamReq)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
var _StreamGreeter_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "stream.StreamGreeter",
|
||||
HandlerType: (*StreamGreeterServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "greet",
|
||||
Handler: _StreamGreeter_Greet_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "greet.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("greet.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 128 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4e, 0x2f, 0x4a, 0x4d,
|
||||
0x2d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2b, 0x2e, 0x29, 0x4a, 0x4d, 0xcc, 0x55,
|
||||
0x92, 0xe7, 0xe2, 0x0c, 0x06, 0xb3, 0x82, 0x52, 0x0b, 0x85, 0x84, 0xb8, 0x58, 0xf2, 0x12, 0x73,
|
||||
0x53, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0xc0, 0x6c, 0x25, 0x25, 0x2e, 0x2e, 0x98, 0x82,
|
||||
0xe2, 0x02, 0x21, 0x11, 0x2e, 0x56, 0xb0, 0x29, 0x50, 0x25, 0x10, 0x8e, 0x91, 0x33, 0x17, 0x2f,
|
||||
0x44, 0x8d, 0x3b, 0x88, 0x9b, 0x5a, 0x24, 0x64, 0x04, 0x55, 0x26, 0x24, 0xa8, 0x07, 0xb1, 0x47,
|
||||
0x0f, 0x6e, 0x89, 0x94, 0x10, 0xba, 0x50, 0x71, 0x81, 0x06, 0xa3, 0x01, 0x63, 0x12, 0x1b, 0xd8,
|
||||
0x61, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x34, 0x15, 0xe8, 0xa7, 0x00, 0x00, 0x00,
|
||||
}
|
||||
15
example/rpc/remote/stream/greet.proto
Normal file
15
example/rpc/remote/stream/greet.proto
Normal file
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package stream;
|
||||
|
||||
message StreamReq {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message StreamResp {
|
||||
string greet = 1;
|
||||
}
|
||||
|
||||
service StreamGreeter {
|
||||
rpc greet(stream StreamReq) returns (stream StreamResp);
|
||||
}
|
||||
Reference in New Issue
Block a user