@@ -36,21 +36,26 @@ func newListenerWatcher(resourceName string, parent *xdsResolver) *listenerWatch
36
36
return lw
37
37
}
38
38
39
- func (l * listenerWatcher ) OnUpdate (update * xdsresource.ListenerResourceData , onDone xdsresource.OnDoneFunc ) {
39
+ func (l * listenerWatcher ) OnResourceChanged (update * xdsresource.ListenerResourceData , err error , onDone xdsresource.OnDoneFunc ) {
40
+ if err != nil {
41
+ var handleError func (context.Context )
42
+ if xdsresource .ErrType (err ) == xdsresource .ErrorTypeResourceNotFound {
43
+ handleError = func (context.Context ) { l .parent .onListenerResourceNotFound (); onDone () }
44
+ } else {
45
+ handleError = func (context.Context ) { l .parent .onListenerResourceError (err ); onDone () }
46
+ }
47
+ l .parent .serializer .ScheduleOr (handleError , onDone )
48
+ return
49
+ }
40
50
handleUpdate := func (context.Context ) { l .parent .onListenerResourceUpdate (update .Resource ); onDone () }
41
51
l .parent .serializer .ScheduleOr (handleUpdate , onDone )
42
52
}
43
53
44
- func (l * listenerWatcher ) OnError (err error , onDone xdsresource.OnDoneFunc ) {
54
+ func (l * listenerWatcher ) OnAmbientError (err error , onDone xdsresource.OnDoneFunc ) {
45
55
handleError := func (context.Context ) { l .parent .onListenerResourceError (err ); onDone () }
46
56
l .parent .serializer .ScheduleOr (handleError , onDone )
47
57
}
48
58
49
- func (l * listenerWatcher ) OnResourceDoesNotExist (onDone xdsresource.OnDoneFunc ) {
50
- handleNotFound := func (context.Context ) { l .parent .onListenerResourceNotFound (); onDone () }
51
- l .parent .serializer .ScheduleOr (handleNotFound , onDone )
52
- }
53
-
54
59
func (l * listenerWatcher ) stop () {
55
60
l .cancel ()
56
61
l .parent .logger .Infof ("Canceling watch on Listener resource %q" , l .resourceName )
@@ -68,24 +73,29 @@ func newRouteConfigWatcher(resourceName string, parent *xdsResolver) *routeConfi
68
73
return rw
69
74
}
70
75
71
- func (r * routeConfigWatcher ) OnUpdate (u * xdsresource.RouteConfigResourceData , onDone xdsresource.OnDoneFunc ) {
76
+ func (r * routeConfigWatcher ) OnResourceChanged (u * xdsresource.RouteConfigResourceData , err error , onDone xdsresource.OnDoneFunc ) {
77
+ if err != nil {
78
+ var handleError func (context.Context )
79
+ if xdsresource .ErrType (err ) == xdsresource .ErrorTypeResourceNotFound {
80
+ handleError = func (context.Context ) { r .parent .onRouteConfigResourceNotFound (r .resourceName ); onDone () }
81
+ } else {
82
+ handleError = func (context.Context ) { r .parent .onRouteConfigResourceError (r .resourceName , err ); onDone () }
83
+ }
84
+ r .parent .serializer .ScheduleOr (handleError , onDone )
85
+ return
86
+ }
72
87
handleUpdate := func (context.Context ) {
73
88
r .parent .onRouteConfigResourceUpdate (r .resourceName , u .Resource )
74
89
onDone ()
75
90
}
76
91
r .parent .serializer .ScheduleOr (handleUpdate , onDone )
77
92
}
78
93
79
- func (r * routeConfigWatcher ) OnError (err error , onDone xdsresource.OnDoneFunc ) {
94
+ func (r * routeConfigWatcher ) OnAmbientError (err error , onDone xdsresource.OnDoneFunc ) {
80
95
handleError := func (context.Context ) { r .parent .onRouteConfigResourceError (r .resourceName , err ); onDone () }
81
96
r .parent .serializer .ScheduleOr (handleError , onDone )
82
97
}
83
98
84
- func (r * routeConfigWatcher ) OnResourceDoesNotExist (onDone xdsresource.OnDoneFunc ) {
85
- handleNotFound := func (context.Context ) { r .parent .onRouteConfigResourceNotFound (r .resourceName ); onDone () }
86
- r .parent .serializer .ScheduleOr (handleNotFound , onDone )
87
- }
88
-
89
99
func (r * routeConfigWatcher ) stop () {
90
100
r .cancel ()
91
101
r .parent .logger .Infof ("Canceling watch on RouteConfiguration resource %q" , r .resourceName )
0 commit comments