-
Notifications
You must be signed in to change notification settings - Fork 129
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
timwu20
changed the title
refactor(pkg/trie/triedb): Introduce
refactor(pkg/trie/triedb): Introduce Nov 4, 2024
HashDB
interface and integrate into TrieDB
, with added iteratorsHashDB
interface and integrate into TrieDB
and added iterators
timwu20
changed the title
refactor(pkg/trie/triedb): Introduce
refactor(pkg/trie/triedb): Introduce Nov 4, 2024
HashDB
interface and integrate into TrieDB
and added iteratorsHashDB
interface and integrate into TrieDB
with added iterators
timwu20
force-pushed
the
tim/triedb-iterators-hashdb
branch
3 times, most recently
from
November 5, 2024 14:29
183d6d7
to
a81ff1b
Compare
timwu20
requested review from
dimartiro,
EclesioMeloJunior,
jimjbrettj and
P1sar
as code owners
November 5, 2024 20:09
timwu20
force-pushed
the
tim/triedb-iterators-hashdb
branch
from
November 5, 2024 20:39
9877caa
to
a81ff1b
Compare
timwu20
changed the title
refactor(pkg/trie/triedb): Introduce
refactor(pkg/trie/triedb): introduce Nov 5, 2024
HashDB
interface and integrate into TrieDB
with added iteratorsHashDB
interface and integrate into TrieDB
with added iterators
timwu20
force-pushed
the
tim/triedb-iterators-hashdb
branch
from
November 6, 2024 03:04
e2449c1
to
95f5c35
Compare
timwu20
changed the base branch from
refactor/client-db
to
tim/refactor-triedb-caching-base
November 6, 2024 03:04
timwu20
changed the base branch from
tim/refactor-triedb-caching-base
to
tim/refactor-client-db-base
November 6, 2024 03:05
timwu20
changed the base branch from
tim/refactor-client-db-base
to
refactor/client-db
November 6, 2024 14:40
…B, update tests, add required iterators, bug fixes.
timwu20
force-pushed
the
tim/triedb-iterators-hashdb
branch
from
November 6, 2024 14:46
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 <[email protected]>
Co-authored-by: Haiko Schol <[email protected]>
Co-authored-by: Haiko Schol <[email protected]>
Co-authored-by: Haiko Schol <[email protected]>
timwu20
added a commit
that referenced
this pull request
Dec 12, 2024
… into `TrieDB` with added iterators (#4315) Co-authored-by: Haiko Schol <[email protected]>
timwu20
added a commit
that referenced
this pull request
Dec 13, 2024
… into `TrieDB` with added iterators (#4315) Co-authored-by: Haiko Schol <[email protected]>
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