Attempt to get rid of macros in chainstate storage #1233
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unfortunately, the biggest culprit here is the Schema trait impls.
In struct impls, many trait bounds can be detected automatically. But then in traits, all these trait bounds have to be specified manually. To some degree I'm OK with that, but then when this trait bound is required:
That basically makes it infeasible to do it.
So, what I did was that I factored out some of the repetitive code, but the basis is already factored out in read and read_value functions. So these calls are repeated, but it's minimal.
At least my IDE recognizes these functions and their contents now and they're readable and parsable.
Let me know what you think.
Edit: I seem to have forgotten to mentioned my original plan..
So my original plan was to use the MakeMapRef trait that I created to abstract getting the database map proxy, but then this failed because all the trait bounds are leaked to the trait implementing these properties due to the schema complexity.