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

Feature: support scan and prefix searches in modules #282

Open
abourget opened this issue Aug 16, 2023 · 1 comment
Open

Feature: support scan and prefix searches in modules #282

abourget opened this issue Aug 16, 2023 · 1 comment
Labels

Comments

@abourget
Copy link
Contributor

Right now, you can only get keys from the input stores of a given module. Sometimes, it would be desirable to scan some keys in there.

Today, the data structure used to support the stores are simple map[string][]byte, which doesn't help with scan and prefix searches. It only helped getting off the ground with modules.

To support scan and prefix semantics, we would need a nice model, like a prefix-tree.. or some things similar to those routers (that do prefix searches), and keep keys ordered at all times.

We also have an additional challenge: in stores, we can get_at, to get the state of the store at a given ordinal in the block. So even with an underlying structure that keeps things ordered, we would still need to overlay the StoreDeltas inside the responses to scan and prefix.. adding a bit of complexity.

It's all doable, but let's first hear your use cases. Chime in!

@ThierryBleau
Copy link

A use case could be to iterate over kv pairs of an input store module within a map module.

For example, if we have a store module that keeps track of token holdings for every address, we could iterate over all (holder , holding) pairs from within a map module in order to produce outputs that are a function of the latest state of the holdings, like say, ownership percentages.

@jubeless jubeless added the Idea label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants