Skip to content

Conversation

@elmato
Copy link
Contributor

@elmato elmato commented Jun 12, 2025

No description provided.

battlmonstr and others added 30 commits November 6, 2024 10:06
Previously SnapshotBundle contained a fixed number of predefined entities.
Now SnapshotBundle is dynamic and based on a snapshots::Schema::RepositoryDef. The actual schema is defined in db::blocks::make_blocks_repository_schema(). snapshots::Schema follows a "fluent config builder" pattern. Currently rec_split_index_defs_ values are trivial there, but in the future we will configure index builders there.

snapshots::Schema::RepositoryDef is a part of datastore::Schema. It is configured by db::DataStore::make_schema. Currently datastore::Schema just wraps snapshots::Schema, but in the future it will also contain DHIIs.

For the DAL client code a db::blocks::BundleDataRef wrapper is provided for convenient access into the block repository bundles (much like db::DataStoreRef provides a convenient access to the block repository).

Related refactorings:

* separate bundle and bundle paths. SnapshotBundlePaths is useful for file manipulation without opening snapshots.
* always open SnapshotBundle on creation (RAII)
* open repository by default. It is not opened only in case of CAPI where bundles are mmap-ed and provided externally.
* move db/transactions subfolder into db/blocks. db/blocks now contains everything related to "block snapshots". db/state will contain "state snapshots" and DHII.
* rename snapshot_repository variables to just repository
SnapshotPath is decoupled from SnapshotType and fixed file extensions. SnapshotPath has a tag string without trying to interpret it.

SnapshotType is replaced with EntityName. EntityName constants match tags for simple conversions to/from SnapshotPath tag.

Block snapshot file extensions are defined in blocks/schema_config, and propagated to datastore/snapshots via Schema::RepositoryDef.

Related refactorings:

* rename index_file() to related_path_ext(kIdxExtension)
* dash in kIdxTxnHash2BlockName to eliminate tag underscore conversions
* SnapshotRepository::is_stale_index_path reimplemented with a help of SnapshotBundleFactory::index_dependency_paths
* use bundle factory in dev/snapshots.cpp create_index cmd
Schema is extended to support DHII entities. The repository schema is re-defined as set of entities. The block snapshot files are grouped under a special "default" entity for simplicity. Each entity can be configured with multiple related snapshot files. EntityName of each snapshot file must be unique within an entity. Each file can be configured with a custom tag and file extension. 

State snapshots repository schema is defined in db/state/schema_config.hpp

Refactorings:
* rename bundle factory to index builders factory. The old name made no sense, because bundles can now be created from schema objects directly. SnapshotBundleFactoryImpl is renamed to BlocksIndexBuildersFactory.
* use schema (entity_name_by_path) to convert path to name and name to tag, because it is not trivial anymore. Tags are explicitly set on all snapshot files.
* move schema factories to bundle implementation. schema definition must not be tied to implementation types (like rec split index).
* repository.find_segment takes both segment and index names (it returns SegmentAndIndex and names differ now).
chfast and others added 26 commits February 3, 2025 14:54
@elmato elmato force-pushed the elmato/merge-erigontech-capi-0.24.0 branch from 61d135e to d931ba2 Compare June 17, 2025 22:35
@elmato elmato force-pushed the elmato/merge-erigontech-capi-0.24.0 branch from 9578e53 to bda0cb4 Compare August 7, 2025 04:41
@elmato elmato closed this Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.