@@ -10,31 +10,18 @@ type stateChangedPredicate interface {
10
10
delete (object client.Object ) bool
11
11
}
12
12
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
17
17
}
18
18
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 )
21
21
}
22
22
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 )
38
25
}
39
26
40
27
// generationChangedPredicate implements stateChangedPredicate based on the generation of the object.
0 commit comments