-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add a FindOption to control SeekDirection of Storage.Find #2789
Labels
discussion
Initial issue state - proposed but not yet accepted
Comments
BTW, native contracts (Neo and RoleManagement) use |
Closed
roman-khimov
added a commit
to roman-khimov/neo
that referenced
this issue
Sep 27, 2022
Depending on the data scheme contracts may want to iterate over prefix in descending order. Fixes neo-project#2789.
roman-khimov
added a commit
to roman-khimov/neo
that referenced
this issue
Sep 27, 2022
Depending on the data scheme contracts may want to iterate over prefix in descending order. Fixes neo-project#2789.
This was referenced Sep 27, 2022
shargon
added a commit
that referenced
this issue
Apr 12, 2023
…2819) * SmartContract: add FindOptions.Backwards to iterate in reverse order Depending on the data scheme contracts may want to iterate over prefix in descending order. Fixes #2789. * Ternary! Syntax sweetener. Co-authored-by: Anna Shaleva <shaleva.ann@gmail.com> * Update src/Neo/SmartContract/FindOptions.cs Co-authored-by: Erik Zhang <erik@neo.org> * Persistence: move deferred part of the Find to a method of its own And add a test for null/empty cases. --------- Co-authored-by: Anna Shaleva <shaleva.ann@gmail.com> Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Erik Zhang <erik@neo.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary or problem description
Storage.Find contract API exposed by the system allows to iterate over a set of keys with various options, but it only does so in one direction (ascending) even though the DataCache/Snapshot behind the scenes has a definition of SeekDirection and therefore is able to seek through the elements in descending order. Depending on the contract's storage schema and the nature of the data stored there might be a need to get X number of the latest values from a set, currently this requires iterating over the whole set till it ends.
Do you have any solution you want to propose?
Add a new flag to FindOptions to control the SeekDirection and allow to iterate over a set of KV pairs in descending (backwards) order.
Neo Version
Where in the software does this update applies to?
The text was updated successfully, but these errors were encountered: