Skip to content

Feature request: an API to list only the keys in storage, not their values? #1699

@nvie

Description

@nvie

Sometimes it would be useful to only list the "keys" using the Transactional Storage API, and not also having to retreive all of their values. If there are many entries, and they all have a lot of data in their values, then doing a .list() can potentially read N * 128 KiB of unneeded data into memory, which would only be discarded.

For example:

await state.storage.list({ prefix, startAfter, limit, /* etc etc */ });
// new Map([['foo', 'value1'], ['bar', 'value2']])

await state.storage.keys({ prefix, startAfter, limit, /* etc etc */ });
// ['foo', 'bar']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions