mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
e204d863a5
* Update Kubernetes to v1.22.1 * Update dependent modules to track with upstream Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
31 lines
528 B
Go
31 lines
528 B
Go
// Copyright 2020 The Kubernetes Authors.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package resource
|
|
|
|
import "sigs.k8s.io/kustomize/kyaml/resid"
|
|
|
|
type IdSet struct {
|
|
ids map[resid.ResId]bool
|
|
}
|
|
|
|
func MakeIdSet(slice []*Resource) *IdSet {
|
|
set := make(map[resid.ResId]bool)
|
|
for _, r := range slice {
|
|
id := r.CurId()
|
|
if _, ok := set[id]; !ok {
|
|
set[id] = true
|
|
}
|
|
}
|
|
return &IdSet{ids: set}
|
|
}
|
|
|
|
func (s IdSet) Contains(id resid.ResId) bool {
|
|
_, ok := s.ids[id]
|
|
return ok
|
|
}
|
|
|
|
func (s IdSet) Size() int {
|
|
return len(s.ids)
|
|
}
|