Skip to content

Commit

Permalink
undo re-ordering in source.go
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
  • Loading branch information
inteon committed Apr 26, 2023
1 parent 6d8195f commit 1d67191
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions pkg/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,30 +229,6 @@ func (cs *Channel) Stop() error {
return cs.group.Wait()
}

var _ Source = Func(nil)

// Func is a function that implements Source.
// Deprecated: use manually implemented Source instead.
type Func func(context.Context, handler.EventHandler, workqueue.RateLimitingInterface, ...predicate.Predicate) error

// Start is internal and should be called only by the Controller to register an EventHandler with the Informer
// to enqueue reconcile.Requests.
func (f Func) Start(ctx context.Context, evt handler.EventHandler, queue workqueue.RateLimitingInterface,
pr ...predicate.Predicate) error {
return f(ctx, evt, queue, pr...)
}

// Stop is internal and should be called only by the Controller to stop the Source. It should block until the
// Source has stopped.
// WARNING: will always return an error.
func (f Func) Stop() error {
return fmt.Errorf("Func source is not stoppable")
}

func (f Func) String() string {
return fmt.Sprintf("func source: %p", f)
}

// Informer is used to provide a source of events originating inside the cluster from Watches (e.g. Pod Create).
type Informer struct {
// Informer is the controller-runtime Informer
Expand Down Expand Up @@ -323,3 +299,27 @@ func (is *Informer) Stop() error {
func (is *Informer) String() string {
return fmt.Sprintf("informer source: %p", is.Informer)
}

var _ Source = Func(nil)

// Func is a function that implements Source.
// Deprecated: use manually implemented Source instead.
type Func func(context.Context, handler.EventHandler, workqueue.RateLimitingInterface, ...predicate.Predicate) error

// Start is internal and should be called only by the Controller to register an EventHandler with the Informer
// to enqueue reconcile.Requests.
func (f Func) Start(ctx context.Context, evt handler.EventHandler, queue workqueue.RateLimitingInterface,
pr ...predicate.Predicate) error {
return f(ctx, evt, queue, pr...)
}

// Stop is internal and should be called only by the Controller to stop the Source. It should block until the
// Source has stopped.
// WARNING: will always return an error.
func (f Func) Stop() error {
return fmt.Errorf("Func source is not stoppable")
}

func (f Func) String() string {
return fmt.Sprintf("func source: %p", f)
}

0 comments on commit 1d67191

Please sign in to comment.