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 range to ReadonlyStorage #181
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reponded
This is not done, but close (the wasm integration is left). But before I get into C types and all, I would like a look over the API I am creating. (And yes, I want this with a feature flag for more general blockchain support, even if this ends up as a default-on flag). |
Interesting... it seems that only the extern "C" functions that are reachable by rust code in the contract are required in the wasm build. I enabled the
The feature flag seems unnecessary for building the wasm contracts, and we can always enable it there (default). However, when working on the cosmwasm-vm and the functions it needs from the runtime, we need to clearly define this (as it is exposed or not exposed at link time, not when a contract is loaded) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some random thoughts for now
bd4a876
to
38b7ed5
Compare
I think I've done all the plumbing, but now a SIGABRT when using the scan/next callbacks. I need to get into serious debug mode. (playing with unsafe code here). One larger issue I found is when I write to two buffers, there is no clear way to return the length of both of them. In the Relevant lines to explain what I mean:
@webmaster128 would it make sense to "upgrade" the buffer from If you like the idea and have time, I'd be happy if you could work on a PR on that. Otherwise I look tomorrow |
That makes a lot of sense to me. Having two separate paths (data at pointer and return value) that need to be brought together in order to read data smaller than the whole region is no the nicest thing I can imagine. The structure we end of with is by the way almost the same as a Rust vector
https://doc.rust-lang.org/std/vec/struct.Vec.html#guarantees I'm looking into this right now to understand the problem. Will at least start with something right now and push later. |
436eeca
to
798ca12
Compare
Great stuff. Looking forward to finish this. Do you have any idea what happens when you delete a database entry in the middle of a range query? |
Thank you, I'm glad to get this in and add a few follow up PRs, for lifetimes, renamings, and multiple iterators.
You cannot delete an entry in the middle of a range query. In this case the over-eager compiler helps us 😄 |
Actually in this version (before #188), the iterators loads all data into memory, and you can delete while iterating, but the iterator will keep giving you a snapshot of previous data. I prefer the compiler prohibiting it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
Time to merge the big chunk
Closes #53
This is working pretty well now. All tests pass and I am happy enough with the code structure.
TODO:
Do #188 later