Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pagination for KV and Object list_bucket #172

Open
jcreager opened this issue Sep 18, 2024 · 1 comment
Open

Support pagination for KV and Object list_bucket #172

jcreager opened this issue Sep 18, 2024 · 1 comment

Comments

@jcreager
Copy link
Contributor

jcreager commented Sep 18, 2024

Proposal:

list_buckets for both KV and Object have their own contract that looks like {:ok, ["TEST_BUCKET_1", "TEST_BUCKET_2"], %{total:_, offset: 0, limit: 1024}}.

list_buckets/2 in either module will optionally accept a parameter which specifies the offset and limit of the next page.

This is to avoid introducing breaking changes to the existing implementation of KV's list_object function, as well as the proposed Object list_buckets function.

@mmmries
Copy link
Collaborator

mmmries commented Sep 21, 2024

I was thinking about this a bit more and one way we could keep the API the same is to handle pagination inside the function itself. That seems to be what this function in go does: https://github.com/nats-io/nats.go/blob/f0b1ea421c52eee17f89d528543b7affba18910b/kv.go#L1150-L1167

It paginates through all the streams and for each of them that match the right prefix, it generates a KeyValueStoreStatus. We're just returning the names, but I think we could handle the pagination and then just return the full list of KV bucket names?

I also couldn't find any pagination options that are available on the CLI, so I'm guessing it just paginates through all of them as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants