Skip to content

Commit

Permalink
return som e helper functions
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
  • Loading branch information
NikitaSkrynnik committed Aug 6, 2024
1 parent 45ebe0a commit cad57e0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/api/networkservice/connection_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,14 @@ func (x *Connection) GetNextPathSegment() *PathSegment {
}
return x.GetPath().GetPathSegments()[x.GetPath().GetIndex()+1]
}

// FilterMapOnManagerScopeSelector - Filters out of map[string]*Connection Connections not matching the selector
func FilterMapOnManagerScopeSelector(c map[string]*Connection, selector *MonitorScopeSelector) map[string]*Connection {
rv := make(map[string]*Connection)
for k, v := range c {
if v != nil && v.MatchesMonitorScopeSelector(selector) {
rv[k] = v
}
}
return rv
}

0 comments on commit cad57e0

Please sign in to comment.