New storage api#10693
Open
ecdsa wants to merge 5 commits into
Open
Conversation
ea2886b to
2f25568
Compare
c3f6c61 to
44b951d
Compare
106685f to
9938ba5
Compare
3257e5c to
88e66c9
Compare
- WalletDB no longer inherits from JsonDB, it uses a StoredDict - JsonDB inherits from BaseDB - FileStorage is only seen by JsonDB - calling JSonDB constructor creates the storage note: this commit temporarily breaks DB upgrades
this restores DB upgrades. (DB upgrades require not converting stored classes)
Add unit test of atomicity. Use a write batch for DB upgrades.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I am marking this as ready because it is advanced enough that it could use some review.
My hope was to make the first commit pass all the tests, but that seems to be impossible. Commit 4 (types conversions) restores functionality. Note that commit 2 (perf optimization) and 3 (rename) are trivial, and they could potentially be reordered after commit 4.
There are 3 remaining design issues:
should
StoredDict.get() returndict/listinstead ofStoredList/StoredDict?get() would be consistent withpop()get() would be inconsistent with__getitem__, which must returnStoredList/StoredDictStoredDict/StoredList, we would moveget_dict,get_listfromwallet_dbtostored_dict. This would make the returned types more explicit.should we remove the
init_dbparameter in the constructor, and use an explicitDictStorage.open() call instead?close() methodopenwould take the password as parameter, and behave asdecrypt(). Howver, it would need to be called even for non-encrypted wallets.currently if an exception is raised during a batch write, memory and disk become inconsistent (see FIXME)
save_db, and always write to disk if we are not in a batch.