@@ -60,7 +60,7 @@ const (
6060// MapEventType describes an event raised by a cache mutation.
6161type MapEventType string
6262
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
6464// of a cache.
6565type MapLifecycleEventType string
6666
@@ -159,8 +159,13 @@ func (se *sessionLifecycleEvent) String() string {
159159 return fmt .Sprintf ("SessionLifecycleEvent{source=%v, format=%s}" , se .Source (), se .Type ())
160160}
161161
162+ // MapLifecycleEvent describes an event that may be raised during the lifecycle
163+ // of a cache.
162164type MapLifecycleEvent [K comparable , V any ] interface {
165+ // Source returns the source of this MapLifecycleEvent.
163166 Source () NamedMap [K , V ]
167+
168+ // Type returns the MapLifecycleEventType for this MapLifecycleEvent.
164169 Type () MapLifecycleEventType
165170}
166171
@@ -186,22 +191,39 @@ func (l *mapLifecycleEvent[K, V]) Source() NamedMap[K, V] {
186191 return l .source
187192}
188193
189- // String returns a string representation of a MapLifecycleEvent.
194+ // String returns a string representation of a [ MapLifecycleEvent] .
190195func (l * mapLifecycleEvent [K , V ]) String () string {
191196 return fmt .Sprintf ("MapLifecycleEvent{source=%v, type=%s}" , l .Source ().GetCacheName (), l .Type ())
192197}
193198
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
196201// removed).
197202type MapEvent [K comparable , V any ] interface {
203+ // Source returns the source of this MapEvent.
198204 Source () NamedMap [K , V ]
205+
206+ // Key returns the key of the entry for which this event was raised.
199207 Key () (* K , error )
208+
209+ // OldValue returns the old value, if any, of the entry for which this event
210+ // was raised.
200211 OldValue () (* V , error )
212+
213+ // NewValue returns the new value, if any, of the entry for which this event
214+ // was raised.
201215 NewValue () (* V , error )
216+
217+ // Type returns the MapEventType for this MapEvent.
202218 Type () MapEventType
219+
220+ // IsExpired returns true if the event was generated from an expiry event. Only valid for gRPC v1 connections.
203221 IsExpired () (bool , error )
222+
223+ // IsPriming returns true if the event is a priming event. Only valid for gRPC v1 connections.
204224 IsPriming () (bool , error )
225+
226+ // IsSynthetic returns true if the event is a synthetic event. Only valid for gRPC v1 connections.
205227 IsSynthetic () (bool , error )
206228}
207229
@@ -1197,7 +1219,7 @@ func reRegisterListeners[K comparable, V any](ctx context.Context, namedMap *Nam
11971219 bc .filterListenersV1 = make (map [filters.Filter ]* listenerGroupV1 [K , V ], 0 )
11981220 bc .filterIDToGroupV1 = make (map [int64 ]* listenerGroupV1 [K , V ], 0 )
11991221
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
12011223 for _ , c := range cacheNames {
12021224 cacheID , err3 := bc .session .v1StreamManagerCache .ensureCache (context .Background (), c )
12031225 if err3 != nil {
0 commit comments