Unified Storage: Add sort order to keys func in datastore (#110714)

* Add sort order to keys func in datastore. Add test to not prune deleted events.

* include sort field in the ListRequestKey instead of it being a separate param
This commit is contained in:
owensmallwood
2025-09-11 14:12:30 -06:00
committed by GitHub
parent b6567e5abc
commit 310893292f
3 changed files with 90 additions and 10 deletions
@@ -106,6 +106,7 @@ type ListRequestKey struct {
Group string
Resource string
Name string
Sort SortOrder
}
func (k ListRequestKey) Validate() error {
@@ -194,6 +195,7 @@ func (d *dataStore) Keys(ctx context.Context, key ListRequestKey) iter.Seq2[Data
for k, err := range d.kv.Keys(ctx, dataSection, ListOptions{
StartKey: prefix,
EndKey: PrefixRangeEnd(prefix),
Sort: key.Sort,
}) {
if err != nil {
yield(DataKey{}, err)