1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-13 05:49:16 +00:00

Keep track of events for SQL cache watches (#661)

* Keep track of past events

* Clarify RV acronym

* Fix comment typo

* Rename listEvents variables

* Improve filter readability

* Move defer
This commit is contained in:
Tom Lebreux
2025-06-05 16:40:19 -06:00
committed by GitHub
parent b0aa90cd22
commit b695567794
10 changed files with 377 additions and 39 deletions

View File

@@ -569,6 +569,7 @@ func (s *Store) watch(apiOp *types.APIRequest, schema *types.APISchema, w types.
}
opts := informer.WatchOptions{
ResourceVersion: w.Revision,
Filter: informer.WatchFilter{
ID: w.ID,
Namespace: idNamespace,
@@ -737,7 +738,7 @@ func (s *Store) Delete(apiOp *types.APIRequest, schema *types.APISchema, id stri
// - the total number of resources (returned list might be a subset depending on pagination options in apiOp)
// - a continue token, if there are more pages after the returned one
// - an error instead of all of the above if anything went wrong
func (s *Store) ListByPartitions(apiOp *types.APIRequest, schema *types.APISchema, partitions []partition.Partition) ([]unstructured.Unstructured, int, string, error) {
func (s *Store) ListByPartitions(apiOp *types.APIRequest, schema *types.APISchema, partitions []partition.Partition) (*unstructured.UnstructuredList, int, string, error) {
opts, err := listprocessor.ParseQuery(apiOp, s.namespaceCache)
if err != nil {
return nil, 0, "", err
@@ -768,7 +769,7 @@ func (s *Store) ListByPartitions(apiOp *types.APIRequest, schema *types.APISchem
return nil, 0, "", err
}
return list.Items, total, continueToken, nil
return list, total, continueToken, nil
}
// WatchByPartitions returns a channel of events for a list or resource belonging to any of the specified partitions