/// Commits to service instances and artifacts marked as pending in the provided `fork`.
Commits to service instances and artifacts marked as pending in the provided `fork`.
Commits to service instances and artifacts marked as pending in the provided ` fork ` .
pub(crate) fn commit_block(&mut self, mut fork: Fork) -> Patch {
        let mut schema = Schema::new(&fork);
        let pending_artifacts = schema.take_pending_artifacts();
        let modified_instances = schema.take_modified_instances();
        // Process migration commits and rollbacks.
        self.block_on_migrations(&modified_instances, &mut schema);
        self.rollback_migrations(&modified_instances, &mut fork);
        // Check if any migration scripts have completed locally. Record migration results in the DB.
        let results = self.migrations.take_completed();
        let mut schema = Schema::new(&fork);
        for (instance_name, result) in results {
            schema.add_local_migration_result(&instance_name, result);
        }
        let patch = fork.into_patch();
        // Block futures with pending deployments.
        for (artifact, deploy_spec) in pending_artifacts {
            self.block_until_deployed(artifact, deploy_spec);
        }
        // Notify runtime about changes in service instances.
        for (state, modified_info) in modified_instances {
            let data_version = state.data_version().to_owned();
            let status = state
                .status
                .expect("BUG: Service status cannot be changed to `None`");
            self.update_service_status(&patch, &state.spec, status.clone());
            if modified_info.migration_transition == Some(MigrationTransition::Start) {
                let target = status
                    .ongoing_migration_target()
                    .expect("BUG: Migration target is not specified for ongoing migration");
                self.start_migration_script(target, state.spec, data_version);
            }
        }
        patch
    }
pub ( crate ) fn commit_block ( & mut self , mut fork : Fork ) -> Patch { let mut schema = Schema :: new ( & fork ) ; let pending_artifacts = schema . take_pending_artifacts ( ) ; let modified_instances = schema . take_modified_instances ( ) ; // Process migration commits and rollbacks. self . block_on_migrations ( & modified_instances , & mut schema ) ; self . rollback_migrations ( & modified_instances , & mut fork ) ; // Check if any migration scripts have completed locally. Record migration results in the DB. let results = self . migrations . take_completed ( ) ; let mut schema = Schema :: new ( & fork ) ; for ( instance_name , result ) in results { schema . add_local_migration_result ( & instance_name , result ) ; } let patch = fork . into_patch ( ) ; // Block futures with pending deployments. for ( artifact , deploy_spec ) in pending_artifacts { self . block_until_deployed ( artifact , deploy_spec ) ; } // Notify runtime about changes in service instances. for ( state , modified_info ) in modified_instances { let data_version = state . data_version ( ) . to_owned ( ) ; let status = state . status . expect ( " " ) ; self . update_service_status ( & patch , & state . spec , status . clone ( ) ) ; if modified_info . migration_transition == Some ( MigrationTransition :: Start ) { let target = status . ongoing_migration_target ( ) . expect ( " " ) ; self . start_migration_script ( target , state . spec , data_version ) ; } } patch }
Commits to service instances and artifacts marked as pending in the provided `fork`.
Commits to service instances and artifacts marked as pending in the provided ` fork ` .
&mut self
fork
Fork