summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
authorWataru Ishida <ishida.wataru@lab.ntt.co.jp>2017-05-06 05:47:54 -0400
committerWataru Ishida <ishida.wataru@lab.ntt.co.jp>2017-05-06 09:30:10 -0400
commit86d9587f757fe728996d36c4acfbf7417fda4fb2 (patch)
tree80bab06a054dcfb76a376ae53537bc5afc86f326 /table
parent897adf530cfe0247f3b5d8e60d846cdbdc7c1b88 (diff)
cli: speed up showing a specific defined-set
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r--table/policy.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/table/policy.go b/table/policy.go
index edaf3a3e..2cca91a9 100644
--- a/table/policy.go
+++ b/table/policy.go
@@ -3184,7 +3184,7 @@ func (r *RoutingPolicy) reload(c config.RoutingPolicy) error {
return nil
}
-func (r *RoutingPolicy) GetDefinedSet(typ DefinedType) (*config.DefinedSets, error) {
+func (r *RoutingPolicy) GetDefinedSet(typ DefinedType, name string) (*config.DefinedSets, error) {
r.mu.RLock()
defer r.mu.RUnlock()
@@ -3203,6 +3203,9 @@ func (r *RoutingPolicy) GetDefinedSet(typ DefinedType) (*config.DefinedSets, err
},
}
for _, s := range set {
+ if name != "" && s.Name() != name {
+ continue
+ }
switch s.(type) {
case *PrefixSet:
sets.PrefixSets = append(sets.PrefixSets, *s.(*PrefixSet).ToConfig())