mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: bump k8s.io/api in /api in the k8s-dependencies group
Bumps the k8s-dependencies group in /api with 1 update: [k8s.io/api](https://github.com/kubernetes/api). Updates `k8s.io/api` from 0.32.3 to 0.33.0 - [Commits](https://github.com/kubernetes/api/compare/v0.32.3...v0.33.0) --- updated-dependencies: - dependency-name: k8s.io/api dependency-version: 0.33.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: k8s-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
05e3827a4f
commit
af12c6bf1b
37
api/vendor/k8s.io/apimachinery/pkg/watch/watch.go
generated
vendored
37
api/vendor/k8s.io/apimachinery/pkg/watch/watch.go
generated
vendored
@ -23,6 +23,7 @@ import (
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
// Interface can be implemented by anything that knows how to watch and report changes.
|
||||
@ -103,21 +104,34 @@ func (w emptyWatch) ResultChan() <-chan Event {
|
||||
|
||||
// FakeWatcher lets you test anything that consumes a watch.Interface; threadsafe.
|
||||
type FakeWatcher struct {
|
||||
logger klog.Logger
|
||||
result chan Event
|
||||
stopped bool
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
var _ Interface = &FakeWatcher{}
|
||||
|
||||
// Contextual logging: NewFakeWithOptions and a logger in the FakeOptions should be used instead in code which supports contextual logging.
|
||||
func NewFake() *FakeWatcher {
|
||||
return NewFakeWithOptions(FakeOptions{})
|
||||
}
|
||||
|
||||
// Contextual logging: NewFakeWithOptions and a logger in the FakeOptions should be used instead in code which supports contextual logging.
|
||||
func NewFakeWithChanSize(size int, blocking bool) *FakeWatcher {
|
||||
return NewFakeWithOptions(FakeOptions{ChannelSize: size})
|
||||
}
|
||||
|
||||
func NewFakeWithOptions(options FakeOptions) *FakeWatcher {
|
||||
return &FakeWatcher{
|
||||
result: make(chan Event),
|
||||
logger: ptr.Deref(options.Logger, klog.Background()),
|
||||
result: make(chan Event, options.ChannelSize),
|
||||
}
|
||||
}
|
||||
|
||||
func NewFakeWithChanSize(size int, blocking bool) *FakeWatcher {
|
||||
return &FakeWatcher{
|
||||
result: make(chan Event, size),
|
||||
}
|
||||
type FakeOptions struct {
|
||||
Logger *klog.Logger
|
||||
ChannelSize int
|
||||
}
|
||||
|
||||
// Stop implements Interface.Stop().
|
||||
@ -125,7 +139,7 @@ func (f *FakeWatcher) Stop() {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
if !f.stopped {
|
||||
klog.V(4).Infof("Stopping fake watcher.")
|
||||
f.logger.V(4).Info("Stopping fake watcher")
|
||||
close(f.result)
|
||||
f.stopped = true
|
||||
}
|
||||
@ -176,13 +190,22 @@ func (f *FakeWatcher) Action(action EventType, obj runtime.Object) {
|
||||
|
||||
// RaceFreeFakeWatcher lets you test anything that consumes a watch.Interface; threadsafe.
|
||||
type RaceFreeFakeWatcher struct {
|
||||
logger klog.Logger
|
||||
result chan Event
|
||||
Stopped bool
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
var _ Interface = &RaceFreeFakeWatcher{}
|
||||
|
||||
// Contextual logging: RaceFreeFakeWatcherWithLogger should be used instead of NewRaceFreeFake in code which supports contextual logging.
|
||||
func NewRaceFreeFake() *RaceFreeFakeWatcher {
|
||||
return NewRaceFreeFakeWithLogger(klog.Background())
|
||||
}
|
||||
|
||||
func NewRaceFreeFakeWithLogger(logger klog.Logger) *RaceFreeFakeWatcher {
|
||||
return &RaceFreeFakeWatcher{
|
||||
logger: logger,
|
||||
result: make(chan Event, DefaultChanSize),
|
||||
}
|
||||
}
|
||||
@ -192,7 +215,7 @@ func (f *RaceFreeFakeWatcher) Stop() {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
if !f.Stopped {
|
||||
klog.V(4).Infof("Stopping fake watcher.")
|
||||
f.logger.V(4).Info("Stopping fake watcher")
|
||||
close(f.result)
|
||||
f.Stopped = true
|
||||
}
|
||||
|
Reference in New Issue
Block a user