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

Use Include/Exclude Bounds to define range searches #116

Merged
merged 7 commits into from
Oct 12, 2020
Merged

Conversation

ethanfrey
Copy link
Member

@ethanfrey ethanfrey commented Oct 10, 2020

I think this is what you were suggesting Mauro - public API doesn't require bit-twiddling.

This is incomplete and definitely missing tests, but please review the idea (and maybe suggest a better path forward).

When we agree on a proper interface and implement it, then I will use the new Item and Map and Prefix/Bound types to reimplement the storage of cw3-fixed-multisig as a real world test case.

Once this is out, I would love to cut a 0.3.0 release, and then we can add secondary indexes in 0.3.1 as a non-breaking change

@ethanfrey ethanfrey added this to In progress in Contract development via automation Oct 10, 2020
@maurolacy
Copy link
Contributor

maurolacy commented Oct 11, 2020

OK. Even though you already merged it, I'll review the other MR (storage-maps) first, as it will help me gain more context.

Contract development automation moved this from In progress to Reviewer approved Oct 12, 2020
Copy link
Contributor

@maurolacy maurolacy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, in that it hides the bound calculation under the impl. It also has a clearer naming IMO.

#[derive(Copy, Clone, Debug)]
pub enum Bound<'a> {
Include(&'a [u8]),
Exclude(&'a [u8]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Inclusive / Exclusive (like in inclusive / exclusive bounds) are better names here.

@ethanfrey ethanfrey marked this pull request as ready for review October 12, 2020 16:48
@ethanfrey
Copy link
Member Author

Migrating cw3-fixed-multisig is a bigger task than I thought, as I need/want to add support for u64 keys natively and not force &id.as_be_bytes() everywhere, but provide a cleaner interface. This is a big boon to the API, but more work than I want to throw in this PR.

Will tackle that as a follow up

@ethanfrey ethanfrey merged commit d87c3ae into master Oct 12, 2020
Contract development automation moved this from Reviewer approved to Done Oct 12, 2020
@ethanfrey ethanfrey deleted the cleaner-ranges branch October 12, 2020 16:50
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
Development

Successfully merging this pull request may close these issues.

None yet

2 participants