Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 34 for resultChan (0.19 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. cni/pkg/install/cniconfig_test.go

    			defer cancel()
    			resultChan, errChan := make(chan string, 1), make(chan error, 1)
    			go func(resultChan chan string, errChan chan error, ctx context.Context, cniConfName, mountedCNINetDir string, chained bool) {
    				result, err := getCNIConfigFilepath(ctx, cniConfName, mountedCNINetDir, chained)
    				if err != nil {
    					errChan <- err
    					return
    				}
    				resultChan <- result
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 21 18:32:01 UTC 2024
    - 15.4K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apimachinery/pkg/watch/filter.go

    		f:        f,
    	}
    	go fw.loop()
    	return fw
    }
    
    type filteredWatch struct {
    	incoming Interface
    	result   chan Event
    	f        FilterFunc
    }
    
    // ResultChan returns a channel which will receive filtered events.
    func (fw *filteredWatch) ResultChan() <-chan Event {
    	return fw.result
    }
    
    // Stop stops the upstream watch, which will eventually stop this watch.
    func (fw *filteredWatch) Stop() {
    	fw.incoming.Stop()
    }
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jul 26 17:14:05 UTC 2022
    - 2.8K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/pkg/storage/cacher/cache_watcher_test.go

    	}()
    
    	// We expect all init events to be delivered.
    	for i := 0; i < numObjects; i++ {
    		<-w.ResultChan()
    	}
    	// We don't expect any other event to be delivered and thus
    	// the ResultChan to be closed.
    	result, ok := <-w.ResultChan()
    	if ok {
    		t.Errorf("unexpected event: %#v", result)
    	}
    
    	wg.Wait()
    }
    
    func TestTimeBucketWatchersBasic(t *testing.T) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jun 04 09:20:10 UTC 2024
    - 22.9K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher_whitebox_test.go

    	d.RLock()
    	defer d.RUnlock()
    	return d.requestWatchProgressCounter
    }
    
    type dummyWatch struct {
    	ch chan watch.Event
    }
    
    func (w *dummyWatch) ResultChan() <-chan watch.Event {
    	return w.ch
    }
    
    func (w *dummyWatch) Stop() {
    	close(w.ch)
    }
    
    func newDummyWatch() watch.Interface {
    	return &dummyWatch{
    		ch: make(chan watch.Event),
    	}
    }
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jun 12 10:12:02 UTC 2024
    - 82.9K bytes
    - Viewed (0)
Back to top