-
Notifications
You must be signed in to change notification settings - Fork 755
Move database creation to database factory package #3899
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
Conversation
Signed-off-by: Stephen Buttolph <[email protected]>
metricsPrefix, | ||
) | ||
if err != nil { | ||
return nil, err |
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.
nit: could you create more specific formatted errors to the ones here ?
i.e. fmt.Errorf("failed to MakeAndRegister the metricPrefix %s : %w". metricsPrefix, err)
same for the others error in this function.
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.
I agree with this comment but I don't think it makes sense to block this PR on it because this is a strict refactor.
Why this should be merged
It moves database creation function to
database/factory
pkg to be used from external pkgs/modules (like subnet-evm)How this works
Database Configuration Refactor:
database/factory
package: Introduced a newDatabaseConfig
struct and aNewDatabase
function indatabase/factory/factory.go
. This function centralizes the creation of LevelDB, MemDB, and PebbleDB instances, as well as their associated wrappers (e.g., corruptable and meter DBs).Code Simplification in
node
Package:initDatabase
method innode/node.go
now uses theNewDatabase
function from thedatabase/factory
package, reducing duplicated logic and improving maintainability.How this was tested
e2e tests should cover this + locally
Need to be documented in RELEASES.md?
No