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

storage: add optional prefix iterator methods #1478

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

juped
Copy link
Member

@juped juped commented May 26, 2023

Subspace key iterators are created with the iter_prefix() method on the
storage trait, which takes a string as a key prefix. Because the empty
string should be an invalid key for parsing purposes, other topics have
changed key parsing to error on the empty string. However, this leaves
us without a way to iterate over all subspace keys, previously achieved
with iter_prefix("").

To remedy this, iter_prefix has been extended into
iter_optional_prefix, taking an optional Key. Calls to iter_prefix("")
can be replaced with iter_all(), a new method; iter_prefix() still
exists with its original signature but will no longer accept empty
strings.

Subspace key iterators are created with the iter_prefix() method on the
storage trait, which takes a string as a key prefix. Because the empty
string should be an invalid key for parsing purposes, other topics have
changed key parsing to error on the empty string. However, this leaves
us without a way to iterate over all subspace keys, previously achieved
with iter_prefix("").

To remedy this, iter_prefix has been extended into
iter_optional_prefix, taking an optional Key. Calls to iter_prefix("")
can be replaced with iter_all(), a new method; iter_prefix() still
exists with its original signature but will no longer accept empty
strings.
Fraccaman added a commit that referenced this pull request Jun 9, 2023
* origin/ray/iter-optional-prefix:
  storage: add optional prefix iterator methods
@Fraccaman Fraccaman mentioned this pull request Jun 9, 2023
Fraccaman added a commit that referenced this pull request Jun 14, 2023
* origin/ray/iter-optional-prefix:
  storage: add optional prefix iterator methods
@Fraccaman Fraccaman merged commit 8ffec72 into main Jun 14, 2023
@Fraccaman Fraccaman deleted the ray/iter-optional-prefix branch June 14, 2023 14:41
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

Successfully merging this pull request may close these issues.

3 participants