From 691d80e5d160b82c8b4dd1d83c959ecdffad318f Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 10 May 2018 09:00:50 +0900 Subject: make Path objects in rib read-only Now you can read Path objects in rib safely. Nobody modifies them. GetRib() API doesn't need to clone the objects. With full routes, this avoid allocating temporary huge memory. Signed-off-by: FUJITA Tomonori --- client/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/client.go') diff --git a/client/client.go b/client/client.go index c31ac2b3..d2f56cd8 100644 --- a/client/client.go +++ b/client/client.go @@ -354,7 +354,7 @@ type AddPathByStreamClient struct { func (c *AddPathByStreamClient) Send(paths ...*table.Path) error { ps := make([]*api.Path, 0, len(paths)) for _, p := range paths { - ps = append(ps, api.ToPathApi(p)) + ps = append(ps, api.ToPathApi(p, nil)) } return c.stream.Send(&api.InjectMrtRequest{ Resource: api.Resource_GLOBAL, @@ -385,7 +385,7 @@ func (cli *Client) addPath(vrfID string, pathList []*table.Path) ([]byte, error) r, err := cli.cli.AddPath(context.Background(), &api.AddPathRequest{ Resource: resource, VrfId: vrfID, - Path: api.ToPathApi(path), + Path: api.ToPathApi(path, nil), }) if err != nil { return nil, err -- cgit v1.2.3