fn flush_page_maps(&self, tip_state: &mut ReplicatedState) {
        let tip_layout = self
            .state_layout
            .tip()
            .unwrap_or_else(|err| fatal!(self.log, "Failed to access @TIP: {}", err));

        for canister in tip_state.canisters_iter_mut() {
            let canister_id = canister.canister_id();

            let canister_layout = tip_layout.canister(&canister_id).unwrap_or_else(|err| {
                fatal!(
                    self.log,
                    "Failed to access canister {} layout @TIP {}: {}",
                    canister_id,
                    tip_layout.raw_path().display(),
                    err
                )
            });
            let stable_deltas = canister.system_state.stable_memory.take_round_delta();
            if !stable_deltas.is_empty() {
                let stable_memory_path = &canister_layout.stable_memory_blob();
                stable_deltas
                    .persist(&stable_memory_path)
                    .unwrap_or_else(|err| {
                        fatal!(
                            self.log,
                            "Failed to persist stable page delta of canister {} to file {}: {}",
                            canister_id,
                            stable_memory_path.display(),
                            err
                        )
                    });
            }
            if let Some(execution_state) = &mut canister.execution_state {
                let round_delta = execution_state.page_map.take_round_delta();
                if round_delta.is_empty() {
                    continue;
                }

                let memory_path = &canister_layout.vmemory_0();
                round_delta.persist(&memory_path).unwrap_or_else(|err| {
                    fatal!(
                        self.log,
                        "Failed to persist page delta of canister {} to file {}: {}",
                        canister_id,
                        memory_path.display(),
                        err
                    )
                });
            }
        }
    }
/// Flushes to disk all the canister heap deltas accumulated in memory
/// during one round of execution.
Flushes to disk all the canister heap deltas accumulated in memory
during one round of execution.
Flushes to disk all the canister heap deltas accumulated in memory during one round of execution .
fn flush_page_maps(&self, tip_state: &mut ReplicatedState) {
        let tip_layout = self
            .state_layout
            .tip()
            .unwrap_or_else(|err| fatal!(self.log, "Failed to access @TIP: {}", err));
        for canister in tip_state.canisters_iter_mut() {
            let canister_id = canister.canister_id();
            let canister_layout = tip_layout.canister(&canister_id).unwrap_or_else(|err| {
                fatal!(
                    self.log,
                    "Failed to access canister {} layout @TIP {}: {}",
                    canister_id,
                    tip_layout.raw_path().display(),
                    err
                )
            });
            let stable_deltas = canister.system_state.stable_memory.take_round_delta();
            if !stable_deltas.is_empty() {
                let stable_memory_path = &canister_layout.stable_memory_blob();
                stable_deltas
                    .persist(&stable_memory_path)
                    .unwrap_or_else(|err| {
                        fatal!(
                            self.log,
                            "Failed to persist stable page delta of canister {} to file {}: {}",
                            canister_id,
                            stable_memory_path.display(),
                            err
                        )
                    });
            }
            if let Some(execution_state) = &mut canister.execution_state {
                let round_delta = execution_state.page_map.take_round_delta();
                if round_delta.is_empty() {
                    continue;
                }
                let memory_path = &canister_layout.vmemory_0();
                round_delta.persist(&memory_path).unwrap_or_else(|err| {
                    fatal!(
                        self.log,
                        "Failed to persist page delta of canister {} to file {}: {}",
                        canister_id,
                        memory_path.display(),
                        err
                    )
                });
            }
        }
    }
fn flush_page_maps ( & self , tip_state : & mut ReplicatedState ) { let tip_layout = self . state_layout . tip ( ) . unwrap_or_else ( | err | fatal ! ( self log " " err ) ) ; for canister in tip_state . canisters_iter_mut ( ) { let canister_id = canister . canister_id ( ) ; let canister_layout = tip_layout . canister ( & canister_id ) . unwrap_or_else ( | err | { fatal ! ( self log " " canister_id tip_layout raw_path ( ) display ( ) err ) } ) ; let stable_deltas = canister . system_state . stable_memory . take_round_delta ( ) ; if ! stable_deltas . is_empty ( ) { let stable_memory_path = & canister_layout . stable_memory_blob ( ) ; stable_deltas . persist ( & stable_memory_path ) . unwrap_or_else ( | err | { fatal ! ( self log " " canister_id stable_memory_path display ( ) err ) } ) ; } if let Some ( execution_state ) = & mut canister . execution_state { let round_delta = execution_state . page_map . take_round_delta ( ) ; if round_delta . is_empty ( ) { continue ; } let memory_path = & canister_layout . vmemory_0 ( ) ; round_delta . persist ( & memory_path ) . unwrap_or_else ( | err | { fatal ! ( self log " " canister_id memory_path display ( ) err ) } ) ; } } }
Flushes to disk all the canister heap deltas accumulated in memory
during one round of execution.
Flushes to disk all the canister heap deltas accumulated in memory during one round of execution .
&self
tip_state
&mut ReplicatedState
&self
tip_state
&mut ReplicatedState