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

Get a set of keys, sharing the TreeCache #63

Open
plaidfinch opened this issue Oct 14, 2022 · 1 comment
Open

Get a set of keys, sharing the TreeCache #63

plaidfinch opened this issue Oct 14, 2022 · 1 comment

Comments

@plaidfinch
Copy link
Contributor

There should be two more functions, get_all and get_all_with_proofs:

fn get_all(&self, version: Version, impl Iterator<Item = KeyHash>) -> GetAll { /* ... */ }

fn get_all_with_proofs(&self, version: Version, impl Iterator<Item = KeyHash>) -> GetAllWithProofs { /* ... */ }

Where GetAll and GetAllWithProofs are types that impl Iterator<Item = (KeyHash, Option<OwnedValue>)> and impl Iterator<Item = (KeyHash, Option<(OwnedValue, SparseMerkleProof)>)>, respectively, plus a variety of other iterator-related traits.

These methods would share the TreeCache for the duration of iteration, making it so that lookups from the database are not repeated. This is especially going to be useful to support range lookups based on our auxiliary key to key hash index, where we could feed the iterator resulting from a range query directly into this method, and get constant-space iteration over a key hash preimage range.

@plaidfinch
Copy link
Contributor Author

Note: what's needed is something simpler than TreeCache, just a map from NodeKey to Node, caching all the reads.

@zbuc zbuc added this to Testnets Mar 31, 2023
@zbuc zbuc moved this to Future in Testnets Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Future
Development

No branches or pull requests

1 participant