-
Notifications
You must be signed in to change notification settings - Fork 1
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
Introducing DeltaReader #7
Merged
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
citizen-stig
force-pushed
the
nikolai/delta-db-introduction
branch
from
May 30, 2024 11:15
cc769ae
to
9ed4dc0
Compare
neysofu
reviewed
Jun 4, 2024
neysofu
approved these changes
Jun 4, 2024
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.
This PR adds a
DeltaReader
, that will be used by new storage manager.DeltaReader
resembles combination ofCacheDb
andCacheContainer
It has public API that can be used by
StateDb
,AccessoryDb
andLedgerDb
the almost same way as CacheDb (excluding writes, which is usage is in process of being removed from SDK).And it also manages ordering of keys and iteration for snapshots and database. It doesn't have any implicit link to
StorageManager
. It explicitly gets list of snapshots and DB and it uses it to provide correct data.Current code has some duplication with existing CacheDb and CacheContainer. This is intentional. After SDK migrates to new StorageManager, old
Cache*
related structs will be removed.Here is a list of all public methods of
DeltaReader
and where they have been copied (*means with significant modifications).new
is ignored as it is obvious constructor.get
:CacheDb::read
+CacheDb::read_async
. Now it does not lock, as it just iterate over Vecget_largest
:CacheDb::get_largest
. But simplified as it doesn't have to join "local_cache" into pictureget_prev
:CacheDb::get_prev
. Same asget_largest
get_n_from_first_match
:CacheDb::get_n_from_first_match
collect_in_range
:CacheDb::collect_in_range
All iteration related logic is taken mainly from
CacheContainer