- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 39 for resultChan (0.17 sec)
-
staging/src/k8s.io/apimachinery/pkg/watch/watch.go
// must always be called, even if the consumer has not yet called // ResultChan(). // // Only the consumer should call Stop(), not the producer. If the producer // errors and needs to stop the watch prematurely, it should instead send // an error event and close the result channel. Stop() // ResultChan returns a channel which will receive events from the event
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Wed Jun 12 20:06:22 UTC 2024 - 8.1K bytes - Viewed (1) -
staging/src/k8s.io/apimachinery/pkg/watch/streamwatcher_test.go
fr := &fakeReporter{} sw := NewStreamWatcher(fd, fr) evt, ok := <-sw.ResultChan() if !ok { t.Fatalf("unexpected close") } if evt.Type != Error || evt.Object != runtime.Unstructured(nil) { t.Fatalf("unexpected object: %#v", evt) } _, ok = <-sw.ResultChan() if ok { t.Fatalf("unexpected open channel") } sw.Stop() _, ok = <-sw.ResultChan() if ok { t.Fatalf("unexpected open channel") } }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Sat Mar 06 13:42:59 UTC 2021 - 2.5K bytes - Viewed (0) -
staging/src/k8s.io/apiserver/pkg/storage/etcd3/watcher.go
// It's fine to double cancel. wc.cancel() // we need to wait until resultChan wouldn't be used anymore resultChanWG.Wait() close(wc.resultChan) } func (wc *watchChan) Stop() { wc.cancel() } func (wc *watchChan) ResultChan() <-chan watch.Event { return wc.resultChan } func (wc *watchChan) RequestWatchProgress() error {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Mon Sep 25 10:26:38 UTC 2023 - 18.9K bytes - Viewed (0) -
staging/src/k8s.io/apimachinery/pkg/watch/watch_test.go
for _, expect := range table { got, ok := <-w.ResultChan() if !ok { t.Fatalf("closed early") } if e, a := expect.t, got.Type; e != a { t.Fatalf("Expected %v, got %v", e, a) } if a, ok := got.Object.(testType); !ok || a != expect.s { t.Fatalf("Expected %v, got %v", expect.s, a) } } _, stillOpen := <-w.ResultChan() if stillOpen { t.Fatal("Never stopped") } }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Wed Aug 15 11:34:31 UTC 2018 - 3.7K bytes - Viewed (0) -
staging/src/k8s.io/apiserver/pkg/storage/testing/utils.go
case e, ok := <-w.ResultChan(): if ok { var obj string switch e.Object.(type) { case *example.Pod: obj = e.Object.(*example.Pod).Name case *v1.Status: obj = e.Object.(*v1.Status).Message } t.Errorf("ResultChan should have been closed. Event: %s. Object: %s", e.Type, obj) } case <-time.After(wait.ForeverTestTimeout): t.Errorf("time out after waiting 1s on ResultChan") } }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Fri Mar 22 07:26:55 UTC 2024 - 10.3K bytes - Viewed (1) -
staging/src/k8s.io/apiserver/pkg/registry/generic/registry/decorated_watcher.go
func (d *decoratedWatcher) run(ctx context.Context) { var recv, send watch.Event var ok bool defer close(d.resultCh) for { select { case recv, ok = <-d.w.ResultChan(): if !ok { // The underlying channel was closed, cancel our context d.cancel() return } switch recv.Type { case watch.Added, watch.Modified, watch.Deleted, watch.Bookmark:
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Wed Jun 02 19:25:31 UTC 2021 - 2.3K bytes - Viewed (1) -
staging/src/k8s.io/apiserver/pkg/registry/generic/registry/decorated_watcher_test.go
expectPodEvent(t, dw, watch.Deleted) // cancel the passed-in context to simulate request timeout cancel() // expect the decorated channel to be closed select { case e, ok := <-dw.ResultChan(): if ok { t.Errorf("expected result chan closed, got %#v", e) } case <-time.After(wait.ForeverTestTimeout): t.Errorf("timeout after %v", wait.ForeverTestTimeout) }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Wed Jun 02 19:25:31 UTC 2021 - 3.4K bytes - Viewed (0) -
staging/src/k8s.io/apimachinery/pkg/watch/mux_test.go
} w2, err := m.Watch() if err != nil { t.Fatalf("Unable start event watcher: '%v' (will not retry!)", err) } w.Stop() m.Shutdown() if _, open := <-w.ResultChan(); open { t.Errorf("Stop didn't work?") } if _, open := <-w2.ResultChan(); open { t.Errorf("Shutdown didn't work?") } // Extra stops don't hurt things w.Stop() w2.Stop() }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Mon May 16 15:26:25 UTC 2022 - 8K bytes - Viewed (0) -
staging/src/k8s.io/apimachinery/pkg/watch/filter_test.go
}) go func() { for _, item := range table { source.Action(item.Type, item.Object) } source.Stop() }() var got []string for { event, ok := <-filtered.ResultChan() if !ok { break } got = append(got, string(event.Object.(testType))) } if e, a := []string{"foo", "qux", "zoo"}, got; !reflect.DeepEqual(e, a) { t.Errorf("got %v, wanted %v", e, a) } }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Tue Nov 16 11:56:41 UTC 2021 - 2.5K bytes - Viewed (0) -
staging/src/k8s.io/apiserver/pkg/storage/etcd3/watcher_test.go
w := store.watcher.createWatchChan(ctx, "/abc", 0, false, false, storage.Everything) // make resultChan and errChan blocking to ensure ordering. w.resultChan = make(chan watch.Event) w.errChan = make(chan error) // The event flow goes like: // - first we send an error, it should block on resultChan. // - Then we cancel ctx. The blocking on resultChan should be freed up // and run() goroutine should return. var wg sync.WaitGroup
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Wed Apr 24 18:25:29 UTC 2024 - 12.3K bytes - Viewed (1)