Repository navigation
Iteration over storage items with given key prefix - #411
Conversation
302372c to
332eb5f
Compare
There was a problem hiding this comment.
I think the correct way to do this is by having an Operation enum, just like in TransactionVerifier. The bonus you get there is that you can support caching read-operations by adding an extra arm, which you can exclude from writing back to db when you commit.
There was a problem hiding this comment.
Can have a look into it but preferably not as a part of the present PR. There will have to be some thought around how to mutate the data structure.The get() method now takes &self, not &mut self so some decision whether to introduce mutability into the interface or use some interior mutability mechanism would have to be made.
There was a problem hiding this comment.
That's fair. I don't mind doing this in another PR. But I also want to point out that even without reads, mapping Some to Write and None to Erase is confusing. Let's fix this some times later with or without reads.
There was a problem hiding this comment.
Can you please add a test of iteration that starts with a set, then deletes some items of the set arbitrarily in the middle, and then iterates again and ensures only the correct items are left?
There was a problem hiding this comment.
Btw, I meant within and outside of a transaction.
This can be seen in multiple cases:
- Create the data, commit, erase a subset, check, commit, check
- Create the data, erase a subset, check, commit, check
There was a problem hiding this comment.
Btw, I meant within and outside of a transaction.
This can be seen in multiple cases:
- Create the data, commit, erase a subset, check, commit, check
- Create the data, erase a subset, check, commit, check
These are covered by randomised property tests but will add some normal tests as well since these tend to be easier to analyse.
There was a problem hiding this comment.
Added some more tests for deleting stuff
TheQuantumPhysicist
left a comment
There was a problem hiding this comment.
Looking good. I made some minor comments.
0aaa006 to
18c31fc
Compare
This adds an interface for iterating over database entries where keys start with given prefix. The interface is then implemented for the in-memory backend.
5572f2e to
a77f743
Compare
Mostly tests to do with the recently introduced key prefix iteration but includes some other new tests and test framework enhancements too.
* Add application-agnostic frontend iteration functionality * Add a simple test for it * Move modules around a bit
a77f743 to
cdfb260
Compare
Uh oh!
There was an error while loading. Please reload this page.