mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
endpointCnt is a refcounter used to track how many endpoints use a network, and how many networks references a config-only network. It's stored separately from the network. This is only used to determine if a network can be removed. This commit removes the `endpointCnt` struct and all its references. The refcounter is replaced by two lookups in the newly introduced `networks` and `endpoints` caches added to the `Controller`. Signed-off-by: Albin Kerouanton <albinker@gmail.com>
15 lines
335 B
Go
15 lines
335 B
Go
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
|
|
//go:build go1.22
|
|
|
|
package maputil
|
|
|
|
func FilterValues[K comparable, V any](in map[K]V, fn func(V) bool) []V {
|
|
var out []V
|
|
for _, v := range in {
|
|
if fn(v) {
|
|
out = append(out, v)
|
|
}
|
|
}
|
|
return out
|
|
}
|