@@ -60,7 +60,7 @@ const (
60
60
// MapEventType describes an event raised by a cache mutation.
61
61
type MapEventType string
62
62
63
- // MapLifecycleEventType describes an event that may be raised during the lifecycle
63
+ // MapLifecycleEventType describes an event type that may be raised during the lifecycle
64
64
// of a cache.
65
65
type MapLifecycleEventType string
66
66
@@ -159,8 +159,13 @@ func (se *sessionLifecycleEvent) String() string {
159
159
return fmt .Sprintf ("SessionLifecycleEvent{source=%v, format=%s}" , se .Source (), se .Type ())
160
160
}
161
161
162
+ // MapLifecycleEvent describes an event that may be raised during the lifecycle
163
+ // of a cache.
162
164
type MapLifecycleEvent [K comparable , V any ] interface {
165
+ // Source returns the source of this MapLifecycleEvent.
163
166
Source () NamedMap [K , V ]
167
+
168
+ // Type returns the MapLifecycleEventType for this MapLifecycleEvent.
164
169
Type () MapLifecycleEventType
165
170
}
166
171
@@ -186,22 +191,39 @@ func (l *mapLifecycleEvent[K, V]) Source() NamedMap[K, V] {
186
191
return l .source
187
192
}
188
193
189
- // String returns a string representation of a MapLifecycleEvent.
194
+ // String returns a string representation of a [ MapLifecycleEvent] .
190
195
func (l * mapLifecycleEvent [K , V ]) String () string {
191
196
return fmt .Sprintf ("MapLifecycleEvent{source=%v, type=%s}" , l .Source ().GetCacheName (), l .Type ())
192
197
}
193
198
194
- // MapEvent an event which indicates that the content of the NamedMap or
195
- // NamedCache has changed (i.e., an entry has been added, updated, and/or
199
+ // MapEvent an event which indicates that the content of the [ NamedMap] or
200
+ // [ NamedCache] has changed (i.e., an entry has been added, updated, and/or
196
201
// removed).
197
202
type MapEvent [K comparable , V any ] interface {
203
+ // Source returns the source of this MapEvent.
198
204
Source () NamedMap [K , V ]
205
+
206
+ // Key returns the key of the entry for which this event was raised.
199
207
Key () (* K , error )
208
+
209
+ // OldValue returns the old value, if any, of the entry for which this event
210
+ // was raised.
200
211
OldValue () (* V , error )
212
+
213
+ // NewValue returns the new value, if any, of the entry for which this event
214
+ // was raised.
201
215
NewValue () (* V , error )
216
+
217
+ // Type returns the MapEventType for this MapEvent.
202
218
Type () MapEventType
219
+
220
+ // IsExpired returns true if the event was generated from an expiry event. Only valid for gRPC v1 connections.
203
221
IsExpired () (bool , error )
222
+
223
+ // IsPriming returns true if the event is a priming event. Only valid for gRPC v1 connections.
204
224
IsPriming () (bool , error )
225
+
226
+ // IsSynthetic returns true if the event is a synthetic event. Only valid for gRPC v1 connections.
205
227
IsSynthetic () (bool , error )
206
228
}
207
229
@@ -1197,7 +1219,7 @@ func reRegisterListeners[K comparable, V any](ctx context.Context, namedMap *Nam
1197
1219
bc .filterListenersV1 = make (map [filters.Filter ]* listenerGroupV1 [K , V ], 0 )
1198
1220
bc .filterIDToGroupV1 = make (map [int64 ]* listenerGroupV1 [K , V ], 0 )
1199
1221
1200
- // re-ensure all the caches as the connected has gone and so has the gRPC Proxy
1222
+ // re-ensure all the caches as the connection has gone and so has the gRPC Proxy
1201
1223
for _ , c := range cacheNames {
1202
1224
cacheID , err3 := bc .session .v1StreamManagerCache .ensureCache (context .Background (), c )
1203
1225
if err3 != nil {
0 commit comments