-
Notifications
You must be signed in to change notification settings - Fork 130
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
refactor(pkg/trie/triedb): introduce HashDB
interface and integrate into TrieDB
with added iterators
#4315
Merged
Conversation
This file contains 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
HashDB
interface and integrate into TrieDB
, with added iteratorsHashDB
interface and integrate into TrieDB
and added iterators
HashDB
interface and integrate into TrieDB
and added iteratorsHashDB
interface and integrate into TrieDB
with added iterators
183d6d7
to
a81ff1b
Compare
9877caa
to
a81ff1b
Compare
HashDB
interface and integrate into TrieDB
with added iteratorsHashDB
interface and integrate into TrieDB
with added iterators
e2449c1
to
95f5c35
Compare
…B, update tests, add required iterators, bug fixes.
95f5c35
to
a907f8a
Compare
haikoschol
approved these changes
Nov 8, 2024
dimartiro
reviewed
Nov 9, 2024
dimartiro
approved these changes
Nov 9, 2024
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.
LGTM
Co-authored-by: Haiko Schol <hs@haikoschol.com>
Co-authored-by: Haiko Schol <hs@haikoschol.com>
Co-authored-by: Haiko Schol <hs@haikoschol.com>
Co-authored-by: Haiko Schol <hs@haikoschol.com>
timwu20
added a commit
that referenced
this pull request
Dec 12, 2024
… into `TrieDB` with added iterators (#4315) Co-authored-by: Haiko Schol <hs@haikoschol.com>
timwu20
added a commit
that referenced
this pull request
Dec 13, 2024
… into `TrieDB` with added iterators (#4315) Co-authored-by: Haiko Schol <hs@haikoschol.com>
timwu20
added a commit
that referenced
this pull request
Feb 11, 2025
… into `TrieDB` with added iterators (#4315) Co-authored-by: Haiko Schol <hs@haikoschol.com>
timwu20
added a commit
that referenced
this pull request
Feb 13, 2025
… into `TrieDB` with added iterators (#4315) Co-authored-by: Haiko Schol <hs@haikoschol.com>
timwu20
added a commit
that referenced
this pull request
Feb 13, 2025
… into `TrieDB` with added iterators (#4315) Co-authored-by: Haiko Schol <hs@haikoschol.com>
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.
Changes
hashdb.HashDB
hashdb.HashDB
is an interface introduced around a persistent store where the hash of the inserted value is used as the key. This interface is found prominently in substrate, and is used as the underlying storage oftriedb.TrieDB
. The integration of this interface as the underlying storage is included with the changes.hashdb.Prefix
is introduced to represent prefix partials where there could be an existence of a padded byte. This is useful to represent nibble offset for a partial key.memorydb.MemoryDB
memorydb.MemoryDB
is an implementation ofHashDB
with generic type parameters for theHash
,Hasher
,Key
, andKeyFunction
. Variations ofmemorydb.MemoryDB
using different key functions where the prefix is actually used vs not used are found in the substrate primitives and are used in PR #4318. One key feature that is of note is that values are actually reference counted, and not actually removed unless an equal amount of removes to the amount of gets.triedb.TrieDBIterator
andtriedb.TrieDBKeyIterator
These two iterator types are introduced and used in PR #4318. They are simply exported iterators that will iterate through the pairs (key, values) or just the keys in lexographic order.
triedb.TrieDB.LookupFirstDescendant
This method is required to for
TrieBackend
work in PR #4318. It will look up the first descendant node from a given key.Tests
go test -tags integration github.com/ChainSafe/gossamer
Issues
contributes to #3901