diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-21 10:57:28 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-21 10:58:00 +0900 |
commit | 706ccc9d71b3bd7b0555bf657dc80268b79222df (patch) | |
tree | 6629d100f6d7c81acb41fc7e9893ba4f5fb4eae1 /api | |
parent | 116ca18c598de459d09e7f64d19f61e53a900f75 (diff) |
api: change ModPath() return value to Error from stream Error
cut useless grpc communication and improve performance
simple performance test result.
rib.20150617.2000 is taken from http://archive.routeviews.org/
[before]
$ time gomrt -i rib.20150617.2000
gomrt -i /vagrant/rib.20150617.2000 45.96s user 171.73s system 86% cpu
4:11.87 total
[after]
$ time gomrt -i rib.20150617.2000
gomrt -i /vagrant/rib.20150617.2000 11.95s user 76.17s system 74% cpu
1:58.38 total
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api')
-rw-r--r-- | api/gobgp.pb.go | 12 | ||||
-rw-r--r-- | api/gobgp.proto | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go index 060aaa68..7d01de14 100644 --- a/api/gobgp.pb.go +++ b/api/gobgp.pb.go @@ -1384,7 +1384,7 @@ func (c *grpcClient) ModPath(ctx context.Context, opts ...grpc.CallOption) (Grpc type Grpc_ModPathClient interface { Send(*ModPathArguments) error - Recv() (*Error, error) + CloseAndRecv() (*Error, error) grpc.ClientStream } @@ -1396,7 +1396,10 @@ func (x *grpcModPathClient) Send(m *ModPathArguments) error { return x.ClientStream.SendMsg(m) } -func (x *grpcModPathClient) Recv() (*Error, error) { +func (x *grpcModPathClient) CloseAndRecv() (*Error, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } m := new(Error) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err @@ -1706,7 +1709,7 @@ func _Grpc_ModPath_Handler(srv interface{}, stream grpc.ServerStream) error { } type Grpc_ModPathServer interface { - Send(*Error) error + SendAndClose(*Error) error Recv() (*ModPathArguments, error) grpc.ServerStream } @@ -1715,7 +1718,7 @@ type grpcModPathServer struct { grpc.ServerStream } -func (x *grpcModPathServer) Send(m *Error) error { +func (x *grpcModPathServer) SendAndClose(m *Error) error { return x.ServerStream.SendMsg(m) } @@ -1888,7 +1891,6 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{ { StreamName: "ModPath", Handler: _Grpc_ModPath_Handler, - ServerStreams: true, ClientStreams: true, }, { diff --git a/api/gobgp.proto b/api/gobgp.proto index b4beb1c2..e54eacca 100644 --- a/api/gobgp.proto +++ b/api/gobgp.proto @@ -31,7 +31,7 @@ service Grpc { rpc Shutdown(Arguments) returns (Error) {} rpc Enable(Arguments) returns (Error) {} rpc Disable(Arguments) returns (Error) {} - rpc ModPath(stream ModPathArguments) returns (stream Error) {} + rpc ModPath(stream ModPathArguments) returns (Error) {} rpc GetNeighborPolicy(Arguments) returns (ApplyPolicy) {} rpc ModNeighborPolicy(stream PolicyArguments) returns (stream Error) {} rpc GetPolicyRoutePolicies(PolicyArguments) returns (stream PolicyDefinition) {} |