refactor: Remove InterpretStatus/Error & Outcome from Topology #99
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: NationTech/harmony#99
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "remove-interpret-status-from-topology"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
InterpretStatus
,InterpretError
, andOutcome
leaked in places it shouldn't have: theTopology
. Because of this, refactoring to better track & instrumentInterpret
was more difficult as it might have effects on theTopology
as well. Which wasn't a desirable outcome.This PR introduces a
TopologyState
along with itsTopologyStatus
, and aPreparationOutcome
along with itsPreparationError
.A clear separation was introduced between the
TopologyState
/TopologyStatus
and thePreparationOutcome
/PrepareError
because they serve different purposes/were needed by different actors.TopologyState
/TopologyStatus
serves only theMaestro
to track theTopology
state (whether it's ready or not). Whereas thePreparationOutcome
/PreparationError
serves theTopology
itself for every individual actions it might take in order to be ready (e.g. installing k8s client, configuring the k8s tenant manager, installing prometheus, etc.).For now, I couldn't find an elegant way to move the
TopologyState
management inside the topology itself without pushing this responsibility back to the implementers of eachTopology
. So that's why it's currently handled by theMaestro
itself. Which in a way makes sense as it's part of its responsibilities.Sidequest (sorry 😅): also replace the multiple Topology events by a single
TopologyStateChanged
event. We will probably do the same for the Interpret events later on.LGTM 🎉
@ -63,0 +73,4 @@
}
#[derive(Debug, Clone, new)]
pub struct PreparationError {
I love this! Feels natural and clean.
Also very naturally outlines a trend to eventually avoid the boilerplate of having each module define its own set of Outcome, Error. We will then refactor with a standardized approach when time comes.