-
Notifications
You must be signed in to change notification settings - Fork 354
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
UniqueIndex range_de #500
UniqueIndex range_de #500
Conversation
7838470
to
d323592
Compare
d323592
to
a8e1434
Compare
OK, there's now a working impl of These impls come with some shortcomings / gotchas:
Clearly (as @uint said to me in chat), these indexes (particularly
Will create issues with these, and they can be addressed eventually. |
Also, there are a number of impls / methods that are still missing, for Let's address those in another PR, though. (see #461 (comment)) |
@uint I cannot put you as reviewer, but please take a look. Also, some documentation on this (besides tests) is still missing. Let's add it before merging. Along with more tests. |
f106b3b
to
5fb6ec5
Compare
Some comments here... let's not get too overboard with more issues. TL;DR: there is some good cleanup here that should be done. There are some larger design changes I would put off to later, and do in a non-breaking way, and support multiple MultiIndex approaches. But we should document them better for sure.
Fair enough for now. But usually there is some critical info in the pk that is not in the value (like owner's address). We should deal with this in the future.
Ah, the 1 we store to hold it's place... yeah, making this "work" is okay. We could try to make it prettier, but that will probably be state-breaking (forcing a migration of all indexes), so we should do it asap or never. (Before many people build 1.0 contracts and cannot update to next cw-plus.
Sounds good.
Huh? We use the pk as a minimal viable differentiation between the different indexed values. The considered alternative was to have one index, and point to a Vec of all pk's that fill that index. For small number of items at one index it is better, but becomes almost unusable if there are 1000s at one index. We could provide 2 different implementations, one that uses pk in the key, other that stores
Storing the value directly in the index has an issue... every time you update the type, you must update all references. Currently, if you modify a value, but it doesn't change the indexes (you change different fields), those are not updated at all (at least that was the intention). Again, this is a design trade-off and I very consciously made this choice. Maybe the other one is valid as well. The idea of doing some cleanup (multiple files) and then providing multiple MultiIndex implementations does seem okay.
Makes sense
Very good point. |
Agreed.
Just to be clear: You can get those pks deserialized, but you need to specify their type using the
OK. I think the best approach would be to separate the pk from the index, at the generic types level (i.e. having a proper
Maybe I wasn't clear. I meant, removing the need to specify the pk in the index tuple. I.e. handling key multiplicity internally / opaquely to the user. I think this can be done, and have an idea on how to do it (related to my comment above).
You are right, I hadn't thought of that. It's costlier in terms of updates / removals. And, it has to be done for all the multi indexes. I like the "pk indirection" approach more now.
The last part about encapsulation / coupling is not fully clear to me yet, but it can probably be done with some
I can work on this stuff next month, if there's not so much urgency with contracts work. I would really like to put this in a better / more consistent / more user friendly shape asap. |
@maurolacy Just looked through this. I don't think I have any specific nitpicks or ideas. Nice to see it works now and is more complete, shame about the less than pretty stuff. |
No worries. I'll document this a little when finding some time, and I think we can merge it. And handle improvements in follow-ups. |
I agree this is mergeable. Let's find time to discuss architecture for the larger follow-up issues before tackling them (but feel free to make issues in the meantime) |
5fb6ec5
to
ae6871e
Compare
e00072f
to
067fb5f
Compare
Oh, man, there are like 5 PRs built on top of this, right? Can you merge main in sometime (no more rebase possible) |
Yes, I'll rebase everything once the int key changes are merged to main. |
37d9988
to
6eb222d
Compare
Just rebased it without issues. |
Cool. Want to merge this first, then the other branches on top? |
Sure. |
ce74d48
to
ba3099f
Compare
OK, all the follow-up issues / comments are addressed, are changes are merged / integrated here. This is also rebased from master. Let's merge this. |
LGTM overall. Does what we need it to! |
Deals with #461