Phase 1 to add the server interceptor

This commit is contained in:
iamqizhao
2016-04-18 16:18:34 -07:00
parent dec33edc37
commit 61e92eacc3
13 changed files with 414 additions and 278 deletions

View File

@ -1,12 +1,12 @@
// Code generated by protoc-gen-go.
// source: helloworld.proto
// source: examples/helloworld/helloworld/helloworld.proto
// DO NOT EDIT!
/*
Package helloworld is a generated protocol buffer package.
It is generated from these files:
helloworld.proto
examples/helloworld/helloworld/helloworld.proto
It has these top-level messages:
HelloRequest
@ -61,6 +61,10 @@ func init() {
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.SupportPackageIsVersion2
// Client API for Greeter service
type GreeterClient interface {
@ -96,16 +100,22 @@ func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
s.RegisterService(&_Greeter_serviceDesc, srv)
}
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) {
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HelloRequest)
if err := dec(in); err != nil {
return nil, err
}
out, err := srv.(GreeterServer).SayHello(ctx, in)
if err != nil {
return nil, err
if interceptor == nil {
return srv.(GreeterServer).SayHello(ctx, in)
}
return out, nil
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/helloworld.Greeter/SayHello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Greeter_serviceDesc = grpc.ServiceDesc{
@ -121,17 +131,16 @@ var _Greeter_serviceDesc = grpc.ServiceDesc{
}
var fileDescriptor0 = []byte{
// 181 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9,
0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88,
0x28, 0x29, 0x71, 0xf1, 0x78, 0x80, 0x78, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42,
0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x92,
0x1a, 0x17, 0x17, 0x54, 0x4d, 0x41, 0x4e, 0xa5, 0x90, 0x04, 0x17, 0x7b, 0x6e, 0x6a, 0x71, 0x71,
0x62, 0x3a, 0x4c, 0x11, 0x8c, 0x6b, 0xe4, 0xc9, 0xc5, 0xee, 0x5e, 0x94, 0x9a, 0x5a, 0x92, 0x5a,
0x24, 0x64, 0xc7, 0xc5, 0x11, 0x9c, 0x58, 0x09, 0xd6, 0x25, 0x24, 0xa1, 0x87, 0xe4, 0x02, 0x64,
0xcb, 0xa4, 0xc4, 0xb0, 0xc8, 0x00, 0xad, 0x50, 0x62, 0x70, 0x32, 0xe3, 0x92, 0xce, 0xcc, 0xd7,
0x4b, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0x46, 0x52, 0xeb,
0xc4, 0x0f, 0x56, 0x1c, 0x0e, 0x62, 0x07, 0x80, 0xbc, 0x14, 0xc0, 0xb8, 0x88, 0x89, 0xd9, 0xc3,
0x27, 0x3c, 0x89, 0x0d, 0xec, 0x43, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x0a, 0xdc,
0xe8, 0xf5, 0x00, 0x00, 0x00,
// 175 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xd2, 0x4f, 0xad, 0x48, 0xcc,
0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0xcf, 0x48, 0xcd, 0xc9, 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xc1,
0xce, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88, 0x28, 0xc9, 0x70, 0xf1, 0x78,
0x80, 0x78, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x3c, 0x5c, 0x2c, 0x79, 0x89, 0xb9,
0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4a, 0xb2, 0x5c, 0x5c, 0x50, 0xd9, 0x82, 0x9c, 0x4a,
0x21, 0x7e, 0x2e, 0xf6, 0xdc, 0xd4, 0xe2, 0xe2, 0xc4, 0x74, 0xa8, 0xb4, 0x91, 0x27, 0x17, 0xbb,
0x7b, 0x51, 0x6a, 0x6a, 0x49, 0x6a, 0x91, 0x90, 0x1d, 0x17, 0x47, 0x70, 0x62, 0x25, 0x58, 0xb1,
0x90, 0x84, 0x1e, 0x92, 0x95, 0xc8, 0xa6, 0x4b, 0x89, 0x61, 0x91, 0x01, 0x9a, 0xac, 0xc4, 0xe0,
0x64, 0xc0, 0x25, 0x9d, 0x99, 0xaf, 0x97, 0x5e, 0x54, 0x90, 0xac, 0x07, 0xf3, 0x0e, 0x92, 0x5a,
0x27, 0x7e, 0xb0, 0xe2, 0x70, 0x10, 0x3b, 0x00, 0xe4, 0x87, 0x00, 0xc6, 0x24, 0x36, 0xb0, 0x67,
0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x20, 0x7e, 0x28, 0x45, 0xff, 0x00, 0x00, 0x00,
}

View File

@ -32,7 +32,6 @@ syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
package helloworld;

View File

@ -1,12 +1,12 @@
// Code generated by protoc-gen-go.
// source: route_guide.proto
// source: examples/route_guide/routeguide/route_guide.proto
// DO NOT EDIT!
/*
Package routeguide is a generated protocol buffer package.
It is generated from these files:
route_guide.proto
examples/route_guide/routeguide/route_guide.proto
It has these top-level messages:
Point
@ -152,6 +152,10 @@ func init() {
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.SupportPackageIsVersion2
// Client API for RouteGuide service
type RouteGuideClient interface {
@ -328,16 +332,22 @@ func RegisterRouteGuideServer(s *grpc.Server, srv RouteGuideServer) {
s.RegisterService(&_RouteGuide_serviceDesc, srv)
}
func _RouteGuide_GetFeature_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) {
func _RouteGuide_GetFeature_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Point)
if err := dec(in); err != nil {
return nil, err
}
out, err := srv.(RouteGuideServer).GetFeature(ctx, in)
if err != nil {
return nil, err
if interceptor == nil {
return srv.(RouteGuideServer).GetFeature(ctx, in)
}
return out, nil
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/routeguide.RouteGuide/GetFeature",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RouteGuideServer).GetFeature(ctx, req.(*Point))
}
return interceptor(ctx, in, info, handler)
}
func _RouteGuide_ListFeatures_Handler(srv interface{}, stream grpc.ServerStream) error {
@ -443,31 +453,29 @@ var _RouteGuide_serviceDesc = grpc.ServiceDesc{
}
var fileDescriptor0 = []byte{
// 412 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x53, 0xd1, 0x6a, 0xa3, 0x40,
0x14, 0xcd, 0x98, 0x64, 0xb3, 0x5e, 0x5d, 0x96, 0xcc, 0xb2, 0x20, 0xd9, 0x85, 0xb6, 0xf6, 0x25,
0x2f, 0x95, 0x90, 0x42, 0x1e, 0x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0x5e, 0x37, 0x03, 0x00, 0x00,
// 374 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x52, 0x5d, 0x4b, 0xeb, 0x40,
0x10, 0x6d, 0x7a, 0xdb, 0xdb, 0x9b, 0x69, 0x2e, 0xb5, 0x5b, 0x0b, 0xa5, 0x22, 0x48, 0x7c, 0xe9,
0x83, 0xc4, 0x5a, 0xc1, 0x27, 0x51, 0xac, 0x60, 0x11, 0x44, 0x8a, 0xfe, 0x80, 0xb2, 0x4d, 0xc6,
0x74, 0x21, 0xc9, 0x86, 0x64, 0x03, 0xfa, 0x03, 0xfc, 0xdf, 0xee, 0x47, 0x6a, 0x53, 0x6d, 0xdf,
0x96, 0x33, 0xe7, 0xcc, 0x9c, 0x39, 0x3b, 0x70, 0x81, 0xef, 0x34, 0x4e, 0x23, 0xcc, 0xcf, 0x33,
0x5e, 0x08, 0x5c, 0x84, 0x05, 0x0b, 0xd0, 0xbc, 0x2b, 0x4f, 0x03, 0x7b, 0x69, 0xc6, 0x05, 0x27,
0xb0, 0xa9, 0xba, 0x67, 0xd0, 0x9c, 0x73, 0x96, 0x08, 0x72, 0x00, 0xff, 0x22, 0x2a, 0x98, 0x28,
0x02, 0x1c, 0x58, 0x27, 0xd6, 0xa8, 0x49, 0xba, 0x60, 0x47, 0x3c, 0x09, 0x0d, 0x54, 0x57, 0x90,
0xfb, 0x08, 0xf6, 0x0b, 0xfa, 0x82, 0x26, 0x61, 0x84, 0xe4, 0x18, 0xea, 0x11, 0xd7, 0xdc, 0xf6,
0xa4, 0xeb, 0x6d, 0x7a, 0x7a, 0xa6, 0xa1, 0x2c, 0xaf, 0x98, 0xd6, 0xed, 0x2a, 0xbb, 0xd7, 0xd0,
0x7a, 0x40, 0x2a, 0x8a, 0x0c, 0x89, 0x03, 0x8d, 0x84, 0xc6, 0x66, 0xac, 0x4d, 0x4e, 0xa5, 0x11,
0xee, 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5, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x13,
0xe7, 0xb8, 0xdf, 0x02, 0x00, 0x00,
}

View File

@ -32,7 +32,6 @@ syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.routeguide";
option java_outer_classname = "RouteGuideProto";
option objc_class_prefix = "RTG";
package routeguide;