/// Initiates migration of an existing stopped service to a newer artifact.
/// The migration script is started once the block corresponding to `fork`
/// is committed.
Initiates migration of an existing stopped service to a newer artifact.
The migration script is started once the block corresponding to `fork`
is committed.
Initiates migration of an existing stopped service to a newer artifact . The migration script is started once the block corresponding to ` fork ` is committed .
pub(crate) fn initiate_migration(
        &self,
        fork: &Fork,
        new_artifact: ArtifactId,
        service_name: &str,
    ) -> Result<(), ExecutionError> {
        let mut schema = Schema::new(fork);
        let instance_state = schema.check_migration_initiation(&new_artifact, service_name)?;
        let maybe_script =
            self.get_migration_script(&new_artifact, instance_state.data_version())?;
        if let Some(script) = maybe_script {
            let migration = InstanceMigration::new(new_artifact, script.end_version().to_owned());
            schema.add_pending_migration(instance_state, migration);
        } else {
            // No migration script means that the service instance may be immediately updated to
            // the new artifact version.
            schema.fast_forward_migration(instance_state, new_artifact.version);
        }
        Ok(())
    }
pub ( crate ) fn initiate_migration ( & self , fork : & Fork , new_artifact : ArtifactId , service_name : & str , ) -> Result < ( ) , ExecutionError > { let mut schema = Schema :: new ( fork ) ; let instance_state = schema . check_migration_initiation ( & new_artifact , service_name ) ? ; let maybe_script = self . get_migration_script ( & new_artifact , instance_state . data_version ( ) ) ? ; if let Some ( script ) = maybe_script { let migration = InstanceMigration :: new ( new_artifact , script . end_version ( ) . to_owned ( ) ) ; schema . add_pending_migration ( instance_state , migration ) ; } else { // No migration script means that the service instance may be immediately updated to // the new artifact version. schema . fast_forward_migration ( instance_state , new_artifact . version ) ; } Ok ( ( ) ) }
Initiates migration of an existing stopped service to a newer artifact.
Initiates migration of an existing stopped service to a newer artifact .
&self
fork
&Fork
new_artifact
ArtifactId
service_name
&str