@@ -10,31 +10,18 @@ type stateChangedPredicate interface {
1010 delete (object client.Object ) bool
1111}
1212
13- // funcs is a function that implements stateChangedPredicate .
14- type funcs struct {
15- upsertStateChangeFunc func ( oldObject , newObject client. Object ) bool
16- deleteStateChangeFunc func (object client.Object ) bool
13+ // funcPredicate applies the stateChanged function on upsert and delete. On upsert, the newObject is passed .
14+ // Implements stateChangedPredicate.
15+ type funcPredicate struct {
16+ stateChanged func (object client.Object ) bool
1717}
1818
19- func (f funcs ) upsert (oldObject , newObject client.Object ) bool {
20- return f .upsertStateChangeFunc ( oldObject , newObject )
19+ func (f funcPredicate ) upsert (_ , newObject client.Object ) bool {
20+ return f .stateChanged ( newObject )
2121}
2222
23- func (f funcs ) delete (object client.Object ) bool {
24- return f .deleteStateChangeFunc (object )
25- }
26-
27- // newStateChangedPredicateFuncs returns a predicate funcs that applies the given function on calls to upsert and
28- // delete.
29- func newStateChangedPredicateFuncs (stateChangedFunc func (object client.Object ) bool ) funcs {
30- return funcs {
31- upsertStateChangeFunc : func (oldObject , newObject client.Object ) bool {
32- return stateChangedFunc (newObject )
33- },
34- deleteStateChangeFunc : func (object client.Object ) bool {
35- return stateChangedFunc (object )
36- },
37- }
23+ func (f funcPredicate ) delete (object client.Object ) bool {
24+ return f .stateChanged (object )
3825}
3926
4027// generationChangedPredicate implements stateChangedPredicate based on the generation of the object.
0 commit comments