denoland / denoland/deploy_feedback

[KV Feedback]: Return pagination metadata in `list`

Open
#411 5 comments 1 reaction 0 assignees View on GitHub
kv
Dominant language
No language data
Stars
79
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### 🔍

- [x] Did you search for existing issues?

### Type of feedback

Bug report

### Description

Currently, `list` allows to paginate over the key space using the `prefix` and/or `start`/`end` selectors.

But since it returns an async iterator, there’s no way of getting the metadata of the pagination.

For example:
- totalCount: number of keys in key space
- hasNextPage: if there are more keys after the last key in the selected range
- hasPreviousPage: if there are more keys before the first key in the selected range

This makes it impossible for a client to know if it can paginate further or not, and it needs to try and fail to figure it out.

Could there be a built-in way to expose pagination metadata?

### Steps to reproduce (if applicable)

_No response_

### Expected behavior (if applicable)

_No response_

### Possible solution (if applicable)

_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue concerns the KV `list` async iterator and pagination over `prefix` and `start`/`end` selectors. Start by locating the KV list API and its iterator contract, then determine how pagination metadata could be exposed without breaking iteration. Done means clients can obtain totalCount, hasNextPage, and hasPreviousPage for a selected range.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.