You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
after the bootstrap of the db (or its initialization or loading from disk) is done, create final_state by passing it the db and letting it initialize all its subsystems in its constructor:
pos_state = PosState::try_from_db(&db).map_err(||e| format!("could not init PosState in FinalState: {}"), e)?;
async_pool = AsyncPool::try_from_db(&db).map_err(||e| format!("could not AsyncPool state in FinalState: {}"), e)?;
... each of those constructors initializes the subsystem but also checks the db validity on the prefix subset(s) they manage
That way we have each module take responsibility for checking its own parts of the db properly and we reduce the error surface when adding new elements to the db (eg. forgetting to add them to is_db_valid).
The text was updated successfully, but these errors were encountered:
Leo-Besancon
changed the title
I think that things could be simplified a bit and better encapsulated:
Simplify and refactor final state initialization and checks on the DB after bootstrap.
Jul 8, 2023
That way we have each module take responsibility for checking its own parts of the db properly and we reduce the error surface when adding new elements to the db (eg. forgetting to add them to is_db_valid).
Originally posted by @damip in #4197 (comment)
The text was updated successfully, but these errors were encountered: