Skip to content

ConfigMigrationStep

#include <mrx/core/config/ConfigMigrationStep.hpp>
class mrx::core::ConfigMigrationStep

Base class representing a single migration operation in a configuration pipeline.

Subclasses override the four lifecycle hooks to implement source-specific logic. The runner invokes each hook in order — detect, precheck, migrate, postcheck — and uses the boolean return values to decide whether to continue the pipeline or stop.

The default implementations return true for every hook, so a subclass that does not override any hook will run through all four phases successfully.

ReturnNameDescription
ConfigMigrationStepConstructs a step with no state.
~ConfigMigrationStep virtualVirtual destructor to allow safe polymorphic deletion through base pointers.
booldetect virtualReturns whether this step has a configuration source that requires migration.
boolprecheck virtualValidates preconditions before attempting migration.
boolmigrate virtualPerforms the actual configuration migration.
boolpostcheck virtualValidates that the migration produced a correct result.

ConfigMigrationStep()

Constructs a step with no state.


virtual
virtual ~ConfigMigrationStep()

Virtual destructor to allow safe polymorphic deletion through base pointers.


virtual
virtual bool detect()

Returns whether this step has a configuration source that requires migration.

When the runner calls detect() and it returns false the remaining hooks for this step are skipped and the runner considers the step successful. Override this to return true only when the source is present and should be processed.

true if migration should proceed; false to skip this step.


virtual
virtual bool precheck()

Validates preconditions before attempting migration.

Called only after detect() returns true. Return false to abort the entire pipeline without attempting migration.

true if migration may proceed; false to abort the pipeline.


virtual
virtual bool migrate()

Performs the actual configuration migration.

Called only after precheck() returns true. The runner stops on the first failed migration, so any incomplete state is left to the caller to handle.

true if migration succeeded; false to abort the pipeline.


virtual
virtual bool postcheck()

Validates that the migration produced a correct result.

Called only after migrate() returns true. Use this hook for integrity checks that run after the mutation is complete.

true if the migrated configuration is valid; false to abort the pipeline.

NameDescription
ResultTerminal outcome of the detection phase for a legacy configuration source.

enum Result

Terminal outcome of the detection phase for a legacy configuration source.

Detection is distinct from migration success so a detected-but-invalid source cannot be mistaken for an absent source and incorrectly skipped in favour of an older step.

ValueDescription
NotDetectedThe legacy configuration source was not found.
MigratedThe legacy source was detected and migrated successfully.
FailedThe legacy source was detected but migration failed.