pub fn op_to_record(op: Op, activity_entry: Option<Entry>) -> Record
Examples found in repository?
src/core/workflow/call_zome_workflow.rs (line 275)
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
pub async fn inline_validation<Ribosome>(
    workspace: SourceChainWorkspace,
    network: HolochainP2pDna,
    conductor_handle: ConductorHandle,
    ribosome: Ribosome,
) -> WorkflowResult<()>
where
    Ribosome: RibosomeT + 'static,
{
    let to_app_validate = {
        // collect all the records we need to validate in wasm
        let scratch_records = workspace.source_chain().scratch_records()?;
        let mut to_app_validate: Vec<Record> = Vec::with_capacity(scratch_records.len());
        // Loop forwards through all the new records
        for record in scratch_records {
            sys_validate_record(&record, &workspace, network.clone(), &(*conductor_handle))
                .await
                // If the was en error exit
                // If the validation failed, exit with an InvalidCommit
                // If it was ok continue
                .or_else(|outcome_or_err| outcome_or_err.invalid_call_zome_commit())?;
            to_app_validate.push(record);
        }

        to_app_validate
    };

    let mut cascade =
        holochain_cascade::Cascade::from_workspace_and_network(&workspace, network.clone());
    for mut chain_record in to_app_validate {
        for op_type in action_to_op_types(chain_record.action()) {
            let op =
                app_validation_workflow::record_to_op(chain_record, op_type, &mut cascade).await;

            let (op, activity_entry) = match op {
                Ok(op) => op,
                Err(outcome_or_err) => return map_outcome(Outcome::try_from(outcome_or_err)),
            };

            let outcome = app_validation_workflow::validate_op(
                &op,
                workspace.clone().into(),
                &network,
                &ribosome,
            )
            .await;
            let outcome = outcome.or_else(Outcome::try_from);
            map_outcome(outcome)?;
            chain_record = app_validation_workflow::op_to_record(op, activity_entry);
        }
    }

    Ok(())
}