Codebase list golang-github-go-kit-kit / 78ef6c8
moved protobuf package for test inside the grpc test folder Bas van Beek 7 years ago
10 changed file(s) with 190 addition(s) and 190 deletion(s). Raw diff Collapse all Expand all
66
77 "github.com/go-kit/kit/endpoint"
88 grpctransport "github.com/go-kit/kit/transport/grpc"
9 pb "github.com/go-kit/kit/transport/grpc/_pb"
9 "github.com/go-kit/kit/transport/grpc/_grpc_test/pb"
1010 )
1111
1212 type clientBinding struct {
0 package pb
1
2 //go:generate protoc test.proto --go_out=plugins=grpc:.
0 // Code generated by protoc-gen-go.
1 // source: test.proto
2 // DO NOT EDIT!
3
4 /*
5 Package pb is a generated protocol buffer package.
6
7 It is generated from these files:
8 test.proto
9
10 It has these top-level messages:
11 TestRequest
12 TestResponse
13 */
14 package pb
15
16 import proto "github.com/golang/protobuf/proto"
17 import fmt "fmt"
18 import math "math"
19
20 import (
21 context "golang.org/x/net/context"
22 grpc "google.golang.org/grpc"
23 )
24
25 // Reference imports to suppress errors if they are not otherwise used.
26 var _ = proto.Marshal
27 var _ = fmt.Errorf
28 var _ = math.Inf
29
30 // This is a compile-time assertion to ensure that this generated file
31 // is compatible with the proto package it is being compiled against.
32 // A compilation error at this line likely means your copy of the
33 // proto package needs to be updated.
34 const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
35
36 type TestRequest struct {
37 A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"`
38 B int64 `protobuf:"varint,2,opt,name=b" json:"b,omitempty"`
39 }
40
41 func (m *TestRequest) Reset() { *m = TestRequest{} }
42 func (m *TestRequest) String() string { return proto.CompactTextString(m) }
43 func (*TestRequest) ProtoMessage() {}
44 func (*TestRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
45
46 func (m *TestRequest) GetA() string {
47 if m != nil {
48 return m.A
49 }
50 return ""
51 }
52
53 func (m *TestRequest) GetB() int64 {
54 if m != nil {
55 return m.B
56 }
57 return 0
58 }
59
60 type TestResponse struct {
61 V string `protobuf:"bytes,1,opt,name=v" json:"v,omitempty"`
62 }
63
64 func (m *TestResponse) Reset() { *m = TestResponse{} }
65 func (m *TestResponse) String() string { return proto.CompactTextString(m) }
66 func (*TestResponse) ProtoMessage() {}
67 func (*TestResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
68
69 func (m *TestResponse) GetV() string {
70 if m != nil {
71 return m.V
72 }
73 return ""
74 }
75
76 func init() {
77 proto.RegisterType((*TestRequest)(nil), "pb.TestRequest")
78 proto.RegisterType((*TestResponse)(nil), "pb.TestResponse")
79 }
80
81 // Reference imports to suppress errors if they are not otherwise used.
82 var _ context.Context
83 var _ grpc.ClientConn
84
85 // This is a compile-time assertion to ensure that this generated file
86 // is compatible with the grpc package it is being compiled against.
87 const _ = grpc.SupportPackageIsVersion4
88
89 // Client API for Test service
90
91 type TestClient interface {
92 Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error)
93 }
94
95 type testClient struct {
96 cc *grpc.ClientConn
97 }
98
99 func NewTestClient(cc *grpc.ClientConn) TestClient {
100 return &testClient{cc}
101 }
102
103 func (c *testClient) Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) {
104 out := new(TestResponse)
105 err := grpc.Invoke(ctx, "/pb.Test/Test", in, out, c.cc, opts...)
106 if err != nil {
107 return nil, err
108 }
109 return out, nil
110 }
111
112 // Server API for Test service
113
114 type TestServer interface {
115 Test(context.Context, *TestRequest) (*TestResponse, error)
116 }
117
118 func RegisterTestServer(s *grpc.Server, srv TestServer) {
119 s.RegisterService(&_Test_serviceDesc, srv)
120 }
121
122 func _Test_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
123 in := new(TestRequest)
124 if err := dec(in); err != nil {
125 return nil, err
126 }
127 if interceptor == nil {
128 return srv.(TestServer).Test(ctx, in)
129 }
130 info := &grpc.UnaryServerInfo{
131 Server: srv,
132 FullMethod: "/pb.Test/Test",
133 }
134 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
135 return srv.(TestServer).Test(ctx, req.(*TestRequest))
136 }
137 return interceptor(ctx, in, info, handler)
138 }
139
140 var _Test_serviceDesc = grpc.ServiceDesc{
141 ServiceName: "pb.Test",
142 HandlerType: (*TestServer)(nil),
143 Methods: []grpc.MethodDesc{
144 {
145 MethodName: "Test",
146 Handler: _Test_Test_Handler,
147 },
148 },
149 Streams: []grpc.StreamDesc{},
150 Metadata: "test.proto",
151 }
152
153 func init() { proto.RegisterFile("test.proto", fileDescriptor0) }
154
155 var fileDescriptor0 = []byte{
156 // 129 bytes of a gzipped FileDescriptorProto
157 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e,
158 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0xd2, 0xe4, 0xe2, 0x0e, 0x49,
159 0x2d, 0x2e, 0x09, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xe2, 0xe1, 0x62, 0x4c, 0x94, 0x60,
160 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x62, 0x4c, 0x04, 0xf1, 0x92, 0x24, 0x98, 0x14, 0x18, 0x35, 0x98,
161 0x83, 0x18, 0x93, 0x94, 0x64, 0xb8, 0x78, 0x20, 0x4a, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x41,
162 0xb2, 0x65, 0x30, 0xb5, 0x65, 0x46, 0xc6, 0x5c, 0x2c, 0x20, 0x59, 0x21, 0x6d, 0x28, 0xcd, 0xaf,
163 0x57, 0x90, 0xa4, 0x87, 0x64, 0xb4, 0x94, 0x00, 0x42, 0x00, 0x62, 0x80, 0x12, 0x43, 0x12, 0x1b,
164 0xd8, 0x21, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0xfc, 0xd8, 0xf1, 0x96, 0x00, 0x00,
165 0x00,
166 }
0 syntax = "proto3";
1
2 package pb;
3
4 service Test {
5 rpc Test (TestRequest) returns (TestResponse) {}
6 }
7
8 message TestRequest {
9 string a = 1;
10 int64 b = 2;
11 }
12
13 message TestResponse {
14 string v = 1;
15 }
22 import (
33 "context"
44
5 pb "github.com/go-kit/kit/transport/grpc/_pb"
5 "github.com/go-kit/kit/transport/grpc/_grpc_test/pb"
66 )
77
88 func encodeRequest(ctx context.Context, req interface{}) (interface{}, error) {
77
88 "github.com/go-kit/kit/endpoint"
99 grpctransport "github.com/go-kit/kit/transport/grpc"
10 pb "github.com/go-kit/kit/transport/grpc/_pb"
10 "github.com/go-kit/kit/transport/grpc/_grpc_test/pb"
1111 )
1212
1313 type service struct{}
+0
-3
transport/grpc/_pb/generate.go less more
0 package pb
1
2 //go:generate protoc test.proto --go_out=plugins=grpc:.
+0
-167
transport/grpc/_pb/test.pb.go less more
0 // Code generated by protoc-gen-go.
1 // source: test.proto
2 // DO NOT EDIT!
3
4 /*
5 Package pb is a generated protocol buffer package.
6
7 It is generated from these files:
8 test.proto
9
10 It has these top-level messages:
11 TestRequest
12 TestResponse
13 */
14 package pb
15
16 import proto "github.com/golang/protobuf/proto"
17 import fmt "fmt"
18 import math "math"
19
20 import (
21 context "golang.org/x/net/context"
22 grpc "google.golang.org/grpc"
23 )
24
25 // Reference imports to suppress errors if they are not otherwise used.
26 var _ = proto.Marshal
27 var _ = fmt.Errorf
28 var _ = math.Inf
29
30 // This is a compile-time assertion to ensure that this generated file
31 // is compatible with the proto package it is being compiled against.
32 // A compilation error at this line likely means your copy of the
33 // proto package needs to be updated.
34 const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
35
36 type TestRequest struct {
37 A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"`
38 B int64 `protobuf:"varint,2,opt,name=b" json:"b,omitempty"`
39 }
40
41 func (m *TestRequest) Reset() { *m = TestRequest{} }
42 func (m *TestRequest) String() string { return proto.CompactTextString(m) }
43 func (*TestRequest) ProtoMessage() {}
44 func (*TestRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
45
46 func (m *TestRequest) GetA() string {
47 if m != nil {
48 return m.A
49 }
50 return ""
51 }
52
53 func (m *TestRequest) GetB() int64 {
54 if m != nil {
55 return m.B
56 }
57 return 0
58 }
59
60 type TestResponse struct {
61 V string `protobuf:"bytes,1,opt,name=v" json:"v,omitempty"`
62 }
63
64 func (m *TestResponse) Reset() { *m = TestResponse{} }
65 func (m *TestResponse) String() string { return proto.CompactTextString(m) }
66 func (*TestResponse) ProtoMessage() {}
67 func (*TestResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
68
69 func (m *TestResponse) GetV() string {
70 if m != nil {
71 return m.V
72 }
73 return ""
74 }
75
76 func init() {
77 proto.RegisterType((*TestRequest)(nil), "pb.TestRequest")
78 proto.RegisterType((*TestResponse)(nil), "pb.TestResponse")
79 }
80
81 // Reference imports to suppress errors if they are not otherwise used.
82 var _ context.Context
83 var _ grpc.ClientConn
84
85 // This is a compile-time assertion to ensure that this generated file
86 // is compatible with the grpc package it is being compiled against.
87 const _ = grpc.SupportPackageIsVersion4
88
89 // Client API for Test service
90
91 type TestClient interface {
92 Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error)
93 }
94
95 type testClient struct {
96 cc *grpc.ClientConn
97 }
98
99 func NewTestClient(cc *grpc.ClientConn) TestClient {
100 return &testClient{cc}
101 }
102
103 func (c *testClient) Test(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) {
104 out := new(TestResponse)
105 err := grpc.Invoke(ctx, "/pb.Test/Test", in, out, c.cc, opts...)
106 if err != nil {
107 return nil, err
108 }
109 return out, nil
110 }
111
112 // Server API for Test service
113
114 type TestServer interface {
115 Test(context.Context, *TestRequest) (*TestResponse, error)
116 }
117
118 func RegisterTestServer(s *grpc.Server, srv TestServer) {
119 s.RegisterService(&_Test_serviceDesc, srv)
120 }
121
122 func _Test_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
123 in := new(TestRequest)
124 if err := dec(in); err != nil {
125 return nil, err
126 }
127 if interceptor == nil {
128 return srv.(TestServer).Test(ctx, in)
129 }
130 info := &grpc.UnaryServerInfo{
131 Server: srv,
132 FullMethod: "/pb.Test/Test",
133 }
134 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
135 return srv.(TestServer).Test(ctx, req.(*TestRequest))
136 }
137 return interceptor(ctx, in, info, handler)
138 }
139
140 var _Test_serviceDesc = grpc.ServiceDesc{
141 ServiceName: "pb.Test",
142 HandlerType: (*TestServer)(nil),
143 Methods: []grpc.MethodDesc{
144 {
145 MethodName: "Test",
146 Handler: _Test_Test_Handler,
147 },
148 },
149 Streams: []grpc.StreamDesc{},
150 Metadata: "test.proto",
151 }
152
153 func init() { proto.RegisterFile("test.proto", fileDescriptor0) }
154
155 var fileDescriptor0 = []byte{
156 // 129 bytes of a gzipped FileDescriptorProto
157 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e,
158 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0xd2, 0xe4, 0xe2, 0x0e, 0x49,
159 0x2d, 0x2e, 0x09, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xe2, 0xe1, 0x62, 0x4c, 0x94, 0x60,
160 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x62, 0x4c, 0x04, 0xf1, 0x92, 0x24, 0x98, 0x14, 0x18, 0x35, 0x98,
161 0x83, 0x18, 0x93, 0x94, 0x64, 0xb8, 0x78, 0x20, 0x4a, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x41,
162 0xb2, 0x65, 0x30, 0xb5, 0x65, 0x46, 0xc6, 0x5c, 0x2c, 0x20, 0x59, 0x21, 0x6d, 0x28, 0xcd, 0xaf,
163 0x57, 0x90, 0xa4, 0x87, 0x64, 0xb4, 0x94, 0x00, 0x42, 0x00, 0x62, 0x80, 0x12, 0x43, 0x12, 0x1b,
164 0xd8, 0x21, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0xfc, 0xd8, 0xf1, 0x96, 0x00, 0x00,
165 0x00,
166 }
+0
-16
transport/grpc/_pb/test.proto less more
0 syntax = "proto3";
1
2 package pb;
3
4 service Test {
5 rpc Test (TestRequest) returns (TestResponse) {}
6 }
7
8 message TestRequest {
9 string a = 1;
10 int64 b = 2;
11 }
12
13 message TestResponse {
14 string v = 1;
15 }
88 "google.golang.org/grpc"
99
1010 test "github.com/go-kit/kit/transport/grpc/_grpc_test"
11 pb "github.com/go-kit/kit/transport/grpc/_pb"
11 "github.com/go-kit/kit/transport/grpc/_grpc_test/pb"
1212 )
1313
1414 const (