const deletionExpected … type GenerationsBySlice … type EndpointSliceTracker … // NewEndpointSliceTracker creates and initializes a new endpointSliceTracker. func NewEndpointSliceTracker() *EndpointSliceTracker { … } // Has returns true if the endpointSliceTracker has a generation for the // provided EndpointSlice. func (est *EndpointSliceTracker) Has(endpointSlice *discovery.EndpointSlice) bool { … } // ShouldSync returns true if this endpointSliceTracker does not have a // generation for the provided EndpointSlice or it is greater than the // generation of the tracked EndpointSlice. func (est *EndpointSliceTracker) ShouldSync(endpointSlice *discovery.EndpointSlice) bool { … } // StaleSlices returns true if any of the following are true: // 1. One or more of the provided EndpointSlices have older generations than the // corresponding tracked ones. // 2. The tracker is expecting one or more of the provided EndpointSlices to be // deleted. (EndpointSlices that have already been marked for deletion are ignored here.) // 3. The tracker is tracking EndpointSlices that have not been provided. func (est *EndpointSliceTracker) StaleSlices(service *v1.Service, endpointSlices []*discovery.EndpointSlice) bool { … } // Update adds or updates the generation in this endpointSliceTracker for the // provided EndpointSlice. func (est *EndpointSliceTracker) Update(endpointSlice *discovery.EndpointSlice) { … } // DeleteService removes the set of generations tracked for the Service. func (est *EndpointSliceTracker) DeleteService(namespace, name string) { … } // ExpectDeletion sets the generation to deletionExpected in this // endpointSliceTracker for the provided EndpointSlice. func (est *EndpointSliceTracker) ExpectDeletion(endpointSlice *discovery.EndpointSlice) { … } // HandleDeletion removes the generation in this endpointSliceTracker for the // provided EndpointSlice. This returns true if the tracker expected this // EndpointSlice to be deleted and false if not. func (est *EndpointSliceTracker) HandleDeletion(endpointSlice *discovery.EndpointSlice) bool { … } // GenerationsForSliceUnsafe returns the generations for the Service // corresponding to the provided EndpointSlice, and a bool to indicate if it // exists. A lock must be applied before calling this function. func (est *EndpointSliceTracker) GenerationsForSliceUnsafe(endpointSlice *discovery.EndpointSlice) (GenerationsBySlice, bool) { … } // getServiceNN returns a namespaced name for the Service corresponding to the // provided EndpointSlice. func getServiceNN(endpointSlice *discovery.EndpointSlice) types.NamespacedName { … }