Skip to content
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

datastore: DataStore and related refactorings #2467

Merged
merged 17 commits into from
Nov 5, 2024
Merged

Conversation

battlmonstr
Copy link
Contributor

@battlmonstr battlmonstr commented Oct 30, 2024

datastore::DataStore is a root database (mdbx + snapshots) object. It owns chaindata and snapshot repository instances. It supports multiple snapshot repositories named uniquely with an EntityName.

db::DataStore wraps datastore::DataStore on the DAL side and provides a convenience constructor and access via DataStoreRef. It uses db::blocks::make_blocks_repository to create a SnapshotRepository of "block" snapshots.

Related refactorings:

  • use DataStore everywhere instead of separate mdbx::env_managed and a SnapshotRepository
  • use RWAccess or ROAccess instead of a low level mdbx::env
  • use a DataModelFactory helper constructor from DataStoreRef
  • in tests replace make_repository() with TestDataStore subclass of TestDatabaseContext, and TempChainDataStore subclass of TempChainData
  • make mdbx::open_env() config const (the page_size update within NodeSettings is unused)
  • move an open_env unit test from db/access_layer_test to mdbx/mdbx_test
  • rename repository_dir to repository_path to align with the majority of cases
  • replace Node::chain_config_ field with a getter

@battlmonstr battlmonstr added snapshots Framework for BitTorrent-based snapshots erigon3 Erigon3 feature labels Oct 30, 2024
@battlmonstr battlmonstr force-pushed the pr/data_store1 branch 8 times, most recently from 9e526ba to 88112f4 Compare November 1, 2024 11:42
@battlmonstr battlmonstr changed the title datastore: DataStore datastore: DataStore and related refactorings Nov 1, 2024
@battlmonstr battlmonstr force-pushed the pr/data_store1 branch 2 times, most recently from 723c579 to 0fe6a7f Compare November 1, 2024 14:09
@battlmonstr battlmonstr marked this pull request as ready for review November 1, 2024 15:15
@battlmonstr battlmonstr requested a review from canepat November 1, 2024 15:15
@battlmonstr battlmonstr enabled auto-merge November 1, 2024 15:16
@canepat canepat mentioned this pull request Nov 1, 2024
41 tasks
@battlmonstr battlmonstr merged commit 57cf7fe into master Nov 5, 2024
5 checks passed
@battlmonstr battlmonstr deleted the pr/data_store1 branch November 5, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erigon3 Erigon3 feature snapshots Framework for BitTorrent-based snapshots
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants