From 59ae9d264e1d04c9c922b502653d58209fe32f79 Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Tue, 28 May 2024 07:57:20 +1200 Subject: [PATCH 1/9] Rename `item*` directories to `step*`. --- .../{item => step}/item_parameters.md | 0 .../step_parameters}/mapping_functions.md | 0 .../step_parameters}/params_framework_support.md | 0 .../step_parameters}/params_specification.md | 0 .../step_parameters}/value_specification.md | 0 .../{item_graph => step_graph}/clean.md | 0 .../{item_graph => step_graph}/initialization.md | 0 .../{item_graph => step_graph}/state_ensure.md | 0 .../{item_graph => step_graph}/state_inspection.md | 0 .../src/{items => steps}/peace_aws_iam_policy.rs | 0 .../peace_aws_iam_policy/iam_policy_apply_fns.rs | 0 .../peace_aws_iam_policy/iam_policy_data.rs | 0 .../peace_aws_iam_policy/iam_policy_error.rs | 0 .../peace_aws_iam_policy/iam_policy_item.rs | 0 .../peace_aws_iam_policy/iam_policy_params.rs | 0 .../peace_aws_iam_policy/iam_policy_state.rs | 0 .../iam_policy_state_current_fn.rs | 0 .../peace_aws_iam_policy/iam_policy_state_diff.rs | 0 .../iam_policy_state_diff_fn.rs | 0 .../iam_policy_state_goal_fn.rs | 0 .../{items => steps}/peace_aws_iam_policy/model.rs | 0 .../model/policy_id_arn_version.rs | 0 .../src/{items => steps}/peace_aws_iam_role.rs | 0 .../ec2_assume_role_policy_document.json | 0 .../peace_aws_iam_role/iam_role_apply_fns.rs | 0 .../peace_aws_iam_role/iam_role_data.rs | 0 .../peace_aws_iam_role/iam_role_error.rs | 0 .../peace_aws_iam_role/iam_role_item.rs | 0 .../peace_aws_iam_role/iam_role_params.rs | 0 .../peace_aws_iam_role/iam_role_state.rs | 0 .../peace_aws_iam_role/iam_role_state_current_fn.rs | 0 .../peace_aws_iam_role/iam_role_state_diff.rs | 0 .../peace_aws_iam_role/iam_role_state_diff_fn.rs | 0 .../peace_aws_iam_role/iam_role_state_goal_fn.rs | 0 .../{items => steps}/peace_aws_iam_role/model.rs | 0 .../model/managed_policy_attachment.rs | 0 .../peace_aws_iam_role/model/role_id_and_arn.rs | 0 .../{items => steps}/peace_aws_instance_profile.rs | 0 .../instance_profile_apply_fns.rs | 0 .../instance_profile_data.rs | 0 .../instance_profile_error.rs | 0 .../instance_profile_item.rs | 0 .../instance_profile_params.rs | 0 .../instance_profile_state.rs | 0 .../instance_profile_state_current_fn.rs | 0 .../instance_profile_state_diff.rs | 0 .../instance_profile_state_diff_fn.rs | 0 .../instance_profile_state_goal_fn.rs | 0 .../peace_aws_instance_profile/model.rs | 0 .../model/instance_profile_id_and_arn.rs | 0 .../src/{items => steps}/peace_aws_s3_bucket.rs | 0 .../peace_aws_s3_bucket/s3_bucket_apply_fns.rs | 0 .../peace_aws_s3_bucket/s3_bucket_data.rs | 0 .../peace_aws_s3_bucket/s3_bucket_error.rs | 0 .../peace_aws_s3_bucket/s3_bucket_item.rs | 0 .../peace_aws_s3_bucket/s3_bucket_params.rs | 0 .../peace_aws_s3_bucket/s3_bucket_state.rs | 0 .../s3_bucket_state_current_fn.rs | 0 .../peace_aws_s3_bucket/s3_bucket_state_diff.rs | 0 .../peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs | 0 .../peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs | 0 .../src/{items => steps}/peace_aws_s3_object.rs | 0 .../peace_aws_s3_object/s3_object_apply_fns.rs | 0 .../peace_aws_s3_object/s3_object_data.rs | 0 .../peace_aws_s3_object/s3_object_error.rs | 0 .../peace_aws_s3_object/s3_object_item.rs | 0 .../peace_aws_s3_object/s3_object_params.rs | 0 .../peace_aws_s3_object/s3_object_state.rs | 0 .../s3_object_state_current_fn.rs | 0 .../peace_aws_s3_object/s3_object_state_diff.rs | 0 .../peace_aws_s3_object/s3_object_state_diff_fn.rs | 0 .../peace_aws_s3_object/s3_object_state_goal_fn.rs | 0 {items => steps}/Cargo.toml | 0 {items => steps}/blank/Cargo.toml | 0 {items => steps}/blank/src/blank_apply_fns.rs | 0 {items => steps}/blank/src/blank_data.rs | 0 {items => steps}/blank/src/blank_dest.rs | 0 {items => steps}/blank/src/blank_error.rs | 0 {items => steps}/blank/src/blank_item.rs | 0 {items => steps}/blank/src/blank_params.rs | 0 {items => steps}/blank/src/blank_src.rs | 0 {items => steps}/blank/src/blank_state.rs | 0 {items => steps}/blank/src/blank_state_diff.rs | 0 {items => steps}/blank/src/lib.rs | 0 {items => steps}/file_download/Cargo.toml | 0 {items => steps}/file_download/src/e_tag.rs | 0 .../file_download/src/file_download_apply_fns.rs | 0 .../file_download/src/file_download_data.rs | 0 .../file_download/src/file_download_error.rs | 0 .../file_download/src/file_download_item.rs | 0 .../file_download/src/file_download_params.rs | 0 .../file_download/src/file_download_state.rs | 0 .../src/file_download_state_current_fn.rs | 0 .../file_download/src/file_download_state_diff.rs | 0 .../src/file_download_state_diff_fn.rs | 0 .../src/file_download_state_goal_fn.rs | 0 {items => steps}/file_download/src/lib.rs | 0 {items => steps}/file_download/src/storage_form.rs | 0 {items => steps}/sh_cmd/Cargo.toml | 0 {items => steps}/sh_cmd/src/cmd_variant.rs | 0 {items => steps}/sh_cmd/src/lib.rs | 0 {items => steps}/sh_cmd/src/sh_cmd.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_apply_fns.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_data.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_error.rs | 0 .../sh_cmd/src/sh_cmd_execution_record.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_executor.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_item.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_params.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_state.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_state_diff.rs | 0 {items => steps}/sh_cmd/src/sh_cmd_state_diff_fn.rs | 0 {items => steps}/src/lib.rs | 0 {items => steps}/tar_x/Cargo.toml | 0 {items => steps}/tar_x/src/file_metadata.rs | 0 {items => steps}/tar_x/src/file_metadatas.rs | 0 {items => steps}/tar_x/src/lib.rs | 0 {items => steps}/tar_x/src/native.rs | 0 {items => steps}/tar_x/src/native/dest_dir_entry.rs | 0 {items => steps}/tar_x/src/native/dir_unfold.rs | 0 {items => steps}/tar_x/src/tar_x_apply_fns.rs | 0 {items => steps}/tar_x/src/tar_x_data.rs | 0 {items => steps}/tar_x/src/tar_x_error.rs | 0 {items => steps}/tar_x/src/tar_x_item.rs | 0 {items => steps}/tar_x/src/tar_x_params.rs | 0 .../tar_x/src/tar_x_state_current_fn.rs | 0 {items => steps}/tar_x/src/tar_x_state_diff.rs | 0 {items => steps}/tar_x/src/tar_x_state_diff_fn.rs | 0 {items => steps}/tar_x/src/tar_x_state_goal_fn.rs | 0 workspace_tests/src/{items => steps}/sh_cmd_item.rs | 0 .../unix/test_file_creation_apply_check.sh | 0 .../unix/test_file_creation_apply_exec.sh | 0 .../unix/test_file_creation_state_clean.sh | 0 .../unix/test_file_creation_state_current.sh | 0 .../unix/test_file_creation_state_diff.sh | 0 .../unix/test_file_creation_state_goal.sh | 0 .../windows/test_file_creation_apply_check.ps1 | 0 .../windows/test_file_creation_apply_exec.ps1 | 0 .../windows/test_file_creation_state_clean.ps1 | 0 .../windows/test_file_creation_state_current.ps1 | 0 .../windows/test_file_creation_state_diff.ps1 | 0 .../windows/test_file_creation_state_goal.ps1 | 0 workspace_tests/src/{items => steps}/tar_x_item.rs | 0 .../tar_x_item => steps/tar_x_step}/tar_x1.tar | Bin .../tar_x_item => steps/tar_x_step}/tar_x2.tar | Bin 145 files changed, 0 insertions(+), 0 deletions(-) rename doc/src/technical_concepts/{item => step}/item_parameters.md (100%) rename doc/src/technical_concepts/{item/item_parameters => step/step_parameters}/mapping_functions.md (100%) rename doc/src/technical_concepts/{item/item_parameters => step/step_parameters}/params_framework_support.md (100%) rename doc/src/technical_concepts/{item/item_parameters => step/step_parameters}/params_specification.md (100%) rename doc/src/technical_concepts/{item/item_parameters => step/step_parameters}/value_specification.md (100%) rename doc/src/technical_concepts/{item_graph => step_graph}/clean.md (100%) rename doc/src/technical_concepts/{item_graph => step_graph}/initialization.md (100%) rename doc/src/technical_concepts/{item_graph => step_graph}/state_ensure.md (100%) rename doc/src/technical_concepts/{item_graph => step_graph}/state_inspection.md (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_apply_fns.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_data.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_error.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_item.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_params.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_state.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_state_current_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_state_diff.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_state_diff_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/iam_policy_state_goal_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/model.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_policy/model/policy_id_arn_version.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/ec2_assume_role_policy_document.json (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_apply_fns.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_data.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_error.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_item.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_params.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_state.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_state_current_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_state_diff.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_state_diff_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/iam_role_state_goal_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/model.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/model/managed_policy_attachment.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_iam_role/model/role_id_and_arn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_apply_fns.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_data.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_error.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_item.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_params.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_state.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_state_current_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_state_diff.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_state_diff_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/instance_profile_state_goal_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/model.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_apply_fns.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_data.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_error.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_item.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_params.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_state.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_state_diff.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_apply_fns.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_data.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_error.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_item.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_params.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_state.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_state_current_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_state_diff.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_state_diff_fn.rs (100%) rename examples/envman/src/{items => steps}/peace_aws_s3_object/s3_object_state_goal_fn.rs (100%) rename {items => steps}/Cargo.toml (100%) rename {items => steps}/blank/Cargo.toml (100%) rename {items => steps}/blank/src/blank_apply_fns.rs (100%) rename {items => steps}/blank/src/blank_data.rs (100%) rename {items => steps}/blank/src/blank_dest.rs (100%) rename {items => steps}/blank/src/blank_error.rs (100%) rename {items => steps}/blank/src/blank_item.rs (100%) rename {items => steps}/blank/src/blank_params.rs (100%) rename {items => steps}/blank/src/blank_src.rs (100%) rename {items => steps}/blank/src/blank_state.rs (100%) rename {items => steps}/blank/src/blank_state_diff.rs (100%) rename {items => steps}/blank/src/lib.rs (100%) rename {items => steps}/file_download/Cargo.toml (100%) rename {items => steps}/file_download/src/e_tag.rs (100%) rename {items => steps}/file_download/src/file_download_apply_fns.rs (100%) rename {items => steps}/file_download/src/file_download_data.rs (100%) rename {items => steps}/file_download/src/file_download_error.rs (100%) rename {items => steps}/file_download/src/file_download_item.rs (100%) rename {items => steps}/file_download/src/file_download_params.rs (100%) rename {items => steps}/file_download/src/file_download_state.rs (100%) rename {items => steps}/file_download/src/file_download_state_current_fn.rs (100%) rename {items => steps}/file_download/src/file_download_state_diff.rs (100%) rename {items => steps}/file_download/src/file_download_state_diff_fn.rs (100%) rename {items => steps}/file_download/src/file_download_state_goal_fn.rs (100%) rename {items => steps}/file_download/src/lib.rs (100%) rename {items => steps}/file_download/src/storage_form.rs (100%) rename {items => steps}/sh_cmd/Cargo.toml (100%) rename {items => steps}/sh_cmd/src/cmd_variant.rs (100%) rename {items => steps}/sh_cmd/src/lib.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_apply_fns.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_data.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_error.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_execution_record.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_executor.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_item.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_params.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_state.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_state_diff.rs (100%) rename {items => steps}/sh_cmd/src/sh_cmd_state_diff_fn.rs (100%) rename {items => steps}/src/lib.rs (100%) rename {items => steps}/tar_x/Cargo.toml (100%) rename {items => steps}/tar_x/src/file_metadata.rs (100%) rename {items => steps}/tar_x/src/file_metadatas.rs (100%) rename {items => steps}/tar_x/src/lib.rs (100%) rename {items => steps}/tar_x/src/native.rs (100%) rename {items => steps}/tar_x/src/native/dest_dir_entry.rs (100%) rename {items => steps}/tar_x/src/native/dir_unfold.rs (100%) rename {items => steps}/tar_x/src/tar_x_apply_fns.rs (100%) rename {items => steps}/tar_x/src/tar_x_data.rs (100%) rename {items => steps}/tar_x/src/tar_x_error.rs (100%) rename {items => steps}/tar_x/src/tar_x_item.rs (100%) rename {items => steps}/tar_x/src/tar_x_params.rs (100%) rename {items => steps}/tar_x/src/tar_x_state_current_fn.rs (100%) rename {items => steps}/tar_x/src/tar_x_state_diff.rs (100%) rename {items => steps}/tar_x/src/tar_x_state_diff_fn.rs (100%) rename {items => steps}/tar_x/src/tar_x_state_goal_fn.rs (100%) rename workspace_tests/src/{items => steps}/sh_cmd_item.rs (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/unix/test_file_creation_apply_check.sh (100%) mode change 100755 => 100644 rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/unix/test_file_creation_apply_exec.sh (100%) mode change 100755 => 100644 rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/unix/test_file_creation_state_clean.sh (100%) mode change 100755 => 100644 rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/unix/test_file_creation_state_current.sh (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/unix/test_file_creation_state_diff.sh (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/unix/test_file_creation_state_goal.sh (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/windows/test_file_creation_apply_check.ps1 (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/windows/test_file_creation_apply_exec.ps1 (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/windows/test_file_creation_state_clean.ps1 (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/windows/test_file_creation_state_current.ps1 (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/windows/test_file_creation_state_diff.ps1 (100%) rename workspace_tests/src/{items/sh_cmd_item => steps/sh_cmd_step}/windows/test_file_creation_state_goal.ps1 (100%) rename workspace_tests/src/{items => steps}/tar_x_item.rs (100%) rename workspace_tests/src/{items/tar_x_item => steps/tar_x_step}/tar_x1.tar (100%) rename workspace_tests/src/{items/tar_x_item => steps/tar_x_step}/tar_x2.tar (100%) diff --git a/doc/src/technical_concepts/item/item_parameters.md b/doc/src/technical_concepts/step/item_parameters.md similarity index 100% rename from doc/src/technical_concepts/item/item_parameters.md rename to doc/src/technical_concepts/step/item_parameters.md diff --git a/doc/src/technical_concepts/item/item_parameters/mapping_functions.md b/doc/src/technical_concepts/step/step_parameters/mapping_functions.md similarity index 100% rename from doc/src/technical_concepts/item/item_parameters/mapping_functions.md rename to doc/src/technical_concepts/step/step_parameters/mapping_functions.md diff --git a/doc/src/technical_concepts/item/item_parameters/params_framework_support.md b/doc/src/technical_concepts/step/step_parameters/params_framework_support.md similarity index 100% rename from doc/src/technical_concepts/item/item_parameters/params_framework_support.md rename to doc/src/technical_concepts/step/step_parameters/params_framework_support.md diff --git a/doc/src/technical_concepts/item/item_parameters/params_specification.md b/doc/src/technical_concepts/step/step_parameters/params_specification.md similarity index 100% rename from doc/src/technical_concepts/item/item_parameters/params_specification.md rename to doc/src/technical_concepts/step/step_parameters/params_specification.md diff --git a/doc/src/technical_concepts/item/item_parameters/value_specification.md b/doc/src/technical_concepts/step/step_parameters/value_specification.md similarity index 100% rename from doc/src/technical_concepts/item/item_parameters/value_specification.md rename to doc/src/technical_concepts/step/step_parameters/value_specification.md diff --git a/doc/src/technical_concepts/item_graph/clean.md b/doc/src/technical_concepts/step_graph/clean.md similarity index 100% rename from doc/src/technical_concepts/item_graph/clean.md rename to doc/src/technical_concepts/step_graph/clean.md diff --git a/doc/src/technical_concepts/item_graph/initialization.md b/doc/src/technical_concepts/step_graph/initialization.md similarity index 100% rename from doc/src/technical_concepts/item_graph/initialization.md rename to doc/src/technical_concepts/step_graph/initialization.md diff --git a/doc/src/technical_concepts/item_graph/state_ensure.md b/doc/src/technical_concepts/step_graph/state_ensure.md similarity index 100% rename from doc/src/technical_concepts/item_graph/state_ensure.md rename to doc/src/technical_concepts/step_graph/state_ensure.md diff --git a/doc/src/technical_concepts/item_graph/state_inspection.md b/doc/src/technical_concepts/step_graph/state_inspection.md similarity index 100% rename from doc/src/technical_concepts/item_graph/state_inspection.md rename to doc/src/technical_concepts/step_graph/state_inspection.md diff --git a/examples/envman/src/items/peace_aws_iam_policy.rs b/examples/envman/src/steps/peace_aws_iam_policy.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy.rs rename to examples/envman/src/steps/peace_aws_iam_policy.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_apply_fns.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_apply_fns.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_apply_fns.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_apply_fns.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_data.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_data.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_data.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_data.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_error.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_error.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_error.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_error.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_item.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_item.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_item.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_item.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_params.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_params.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_params.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_params.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_state.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_current_fn.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_current_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_current_fn.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_current_fn.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_diff.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_diff.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_diff.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_diff.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_diff_fn.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_diff_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_diff_fn.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_diff_fn.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_goal_fn.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_goal_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_goal_fn.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_goal_fn.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/model.rs b/examples/envman/src/steps/peace_aws_iam_policy/model.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/model.rs rename to examples/envman/src/steps/peace_aws_iam_policy/model.rs diff --git a/examples/envman/src/items/peace_aws_iam_policy/model/policy_id_arn_version.rs b/examples/envman/src/steps/peace_aws_iam_policy/model/policy_id_arn_version.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_policy/model/policy_id_arn_version.rs rename to examples/envman/src/steps/peace_aws_iam_policy/model/policy_id_arn_version.rs diff --git a/examples/envman/src/items/peace_aws_iam_role.rs b/examples/envman/src/steps/peace_aws_iam_role.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role.rs rename to examples/envman/src/steps/peace_aws_iam_role.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/ec2_assume_role_policy_document.json b/examples/envman/src/steps/peace_aws_iam_role/ec2_assume_role_policy_document.json similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/ec2_assume_role_policy_document.json rename to examples/envman/src/steps/peace_aws_iam_role/ec2_assume_role_policy_document.json diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_apply_fns.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_apply_fns.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_apply_fns.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_apply_fns.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_data.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_data.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_data.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_data.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_error.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_error.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_error.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_error.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_item.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_item.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_item.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_item.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_params.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_params.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_params.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_params.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_state.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_state.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_state.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_state.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_state_current_fn.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_state_current_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_state_current_fn.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_state_current_fn.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_state_diff.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_state_diff.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_state_diff.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_state_diff.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_state_diff_fn.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_state_diff_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_state_diff_fn.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_state_diff_fn.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/iam_role_state_goal_fn.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_state_goal_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/iam_role_state_goal_fn.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_state_goal_fn.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/model.rs b/examples/envman/src/steps/peace_aws_iam_role/model.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/model.rs rename to examples/envman/src/steps/peace_aws_iam_role/model.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/model/managed_policy_attachment.rs b/examples/envman/src/steps/peace_aws_iam_role/model/managed_policy_attachment.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/model/managed_policy_attachment.rs rename to examples/envman/src/steps/peace_aws_iam_role/model/managed_policy_attachment.rs diff --git a/examples/envman/src/items/peace_aws_iam_role/model/role_id_and_arn.rs b/examples/envman/src/steps/peace_aws_iam_role/model/role_id_and_arn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_iam_role/model/role_id_and_arn.rs rename to examples/envman/src/steps/peace_aws_iam_role/model/role_id_and_arn.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile.rs b/examples/envman/src/steps/peace_aws_instance_profile.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile.rs rename to examples/envman/src/steps/peace_aws_instance_profile.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_apply_fns.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_apply_fns.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_apply_fns.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_apply_fns.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_data.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_data.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_data.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_data.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_error.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_error.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_error.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_error.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_item.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_item.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_item.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_item.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_params.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_params.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_params.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_params.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_state.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_current_fn.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_current_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_current_fn.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_current_fn.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_diff.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_diff.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_diff.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_diff.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_diff_fn.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_diff_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_diff_fn.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_diff_fn.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_goal_fn.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_goal_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_goal_fn.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_goal_fn.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/model.rs b/examples/envman/src/steps/peace_aws_instance_profile/model.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/model.rs rename to examples/envman/src/steps/peace_aws_instance_profile/model.rs diff --git a/examples/envman/src/items/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs b/examples/envman/src/steps/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs rename to examples/envman/src/steps/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket.rs b/examples/envman/src/steps/peace_aws_s3_bucket.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket.rs rename to examples/envman/src/steps/peace_aws_s3_bucket.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_apply_fns.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_apply_fns.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_apply_fns.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_apply_fns.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_data.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_data.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_data.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_data.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_error.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_error.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_error.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_error.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_item.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_item.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_item.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_item.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_params.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_params.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_params.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_params.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_diff.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_diff.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_diff.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_diff.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs diff --git a/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs diff --git a/examples/envman/src/items/peace_aws_s3_object.rs b/examples/envman/src/steps/peace_aws_s3_object.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object.rs rename to examples/envman/src/steps/peace_aws_s3_object.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_apply_fns.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_apply_fns.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_apply_fns.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_apply_fns.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_data.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_data.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_data.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_data.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_error.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_error.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_error.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_error.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_item.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_item.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_item.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_item.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_params.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_params.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_params.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_params.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_state.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_state.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_state.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_state.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_state_current_fn.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_state_current_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_state_current_fn.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_state_current_fn.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_state_diff.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_state_diff.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_state_diff.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_state_diff.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_state_diff_fn.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_state_diff_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_state_diff_fn.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_state_diff_fn.rs diff --git a/examples/envman/src/items/peace_aws_s3_object/s3_object_state_goal_fn.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_state_goal_fn.rs similarity index 100% rename from examples/envman/src/items/peace_aws_s3_object/s3_object_state_goal_fn.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_state_goal_fn.rs diff --git a/items/Cargo.toml b/steps/Cargo.toml similarity index 100% rename from items/Cargo.toml rename to steps/Cargo.toml diff --git a/items/blank/Cargo.toml b/steps/blank/Cargo.toml similarity index 100% rename from items/blank/Cargo.toml rename to steps/blank/Cargo.toml diff --git a/items/blank/src/blank_apply_fns.rs b/steps/blank/src/blank_apply_fns.rs similarity index 100% rename from items/blank/src/blank_apply_fns.rs rename to steps/blank/src/blank_apply_fns.rs diff --git a/items/blank/src/blank_data.rs b/steps/blank/src/blank_data.rs similarity index 100% rename from items/blank/src/blank_data.rs rename to steps/blank/src/blank_data.rs diff --git a/items/blank/src/blank_dest.rs b/steps/blank/src/blank_dest.rs similarity index 100% rename from items/blank/src/blank_dest.rs rename to steps/blank/src/blank_dest.rs diff --git a/items/blank/src/blank_error.rs b/steps/blank/src/blank_error.rs similarity index 100% rename from items/blank/src/blank_error.rs rename to steps/blank/src/blank_error.rs diff --git a/items/blank/src/blank_item.rs b/steps/blank/src/blank_item.rs similarity index 100% rename from items/blank/src/blank_item.rs rename to steps/blank/src/blank_item.rs diff --git a/items/blank/src/blank_params.rs b/steps/blank/src/blank_params.rs similarity index 100% rename from items/blank/src/blank_params.rs rename to steps/blank/src/blank_params.rs diff --git a/items/blank/src/blank_src.rs b/steps/blank/src/blank_src.rs similarity index 100% rename from items/blank/src/blank_src.rs rename to steps/blank/src/blank_src.rs diff --git a/items/blank/src/blank_state.rs b/steps/blank/src/blank_state.rs similarity index 100% rename from items/blank/src/blank_state.rs rename to steps/blank/src/blank_state.rs diff --git a/items/blank/src/blank_state_diff.rs b/steps/blank/src/blank_state_diff.rs similarity index 100% rename from items/blank/src/blank_state_diff.rs rename to steps/blank/src/blank_state_diff.rs diff --git a/items/blank/src/lib.rs b/steps/blank/src/lib.rs similarity index 100% rename from items/blank/src/lib.rs rename to steps/blank/src/lib.rs diff --git a/items/file_download/Cargo.toml b/steps/file_download/Cargo.toml similarity index 100% rename from items/file_download/Cargo.toml rename to steps/file_download/Cargo.toml diff --git a/items/file_download/src/e_tag.rs b/steps/file_download/src/e_tag.rs similarity index 100% rename from items/file_download/src/e_tag.rs rename to steps/file_download/src/e_tag.rs diff --git a/items/file_download/src/file_download_apply_fns.rs b/steps/file_download/src/file_download_apply_fns.rs similarity index 100% rename from items/file_download/src/file_download_apply_fns.rs rename to steps/file_download/src/file_download_apply_fns.rs diff --git a/items/file_download/src/file_download_data.rs b/steps/file_download/src/file_download_data.rs similarity index 100% rename from items/file_download/src/file_download_data.rs rename to steps/file_download/src/file_download_data.rs diff --git a/items/file_download/src/file_download_error.rs b/steps/file_download/src/file_download_error.rs similarity index 100% rename from items/file_download/src/file_download_error.rs rename to steps/file_download/src/file_download_error.rs diff --git a/items/file_download/src/file_download_item.rs b/steps/file_download/src/file_download_item.rs similarity index 100% rename from items/file_download/src/file_download_item.rs rename to steps/file_download/src/file_download_item.rs diff --git a/items/file_download/src/file_download_params.rs b/steps/file_download/src/file_download_params.rs similarity index 100% rename from items/file_download/src/file_download_params.rs rename to steps/file_download/src/file_download_params.rs diff --git a/items/file_download/src/file_download_state.rs b/steps/file_download/src/file_download_state.rs similarity index 100% rename from items/file_download/src/file_download_state.rs rename to steps/file_download/src/file_download_state.rs diff --git a/items/file_download/src/file_download_state_current_fn.rs b/steps/file_download/src/file_download_state_current_fn.rs similarity index 100% rename from items/file_download/src/file_download_state_current_fn.rs rename to steps/file_download/src/file_download_state_current_fn.rs diff --git a/items/file_download/src/file_download_state_diff.rs b/steps/file_download/src/file_download_state_diff.rs similarity index 100% rename from items/file_download/src/file_download_state_diff.rs rename to steps/file_download/src/file_download_state_diff.rs diff --git a/items/file_download/src/file_download_state_diff_fn.rs b/steps/file_download/src/file_download_state_diff_fn.rs similarity index 100% rename from items/file_download/src/file_download_state_diff_fn.rs rename to steps/file_download/src/file_download_state_diff_fn.rs diff --git a/items/file_download/src/file_download_state_goal_fn.rs b/steps/file_download/src/file_download_state_goal_fn.rs similarity index 100% rename from items/file_download/src/file_download_state_goal_fn.rs rename to steps/file_download/src/file_download_state_goal_fn.rs diff --git a/items/file_download/src/lib.rs b/steps/file_download/src/lib.rs similarity index 100% rename from items/file_download/src/lib.rs rename to steps/file_download/src/lib.rs diff --git a/items/file_download/src/storage_form.rs b/steps/file_download/src/storage_form.rs similarity index 100% rename from items/file_download/src/storage_form.rs rename to steps/file_download/src/storage_form.rs diff --git a/items/sh_cmd/Cargo.toml b/steps/sh_cmd/Cargo.toml similarity index 100% rename from items/sh_cmd/Cargo.toml rename to steps/sh_cmd/Cargo.toml diff --git a/items/sh_cmd/src/cmd_variant.rs b/steps/sh_cmd/src/cmd_variant.rs similarity index 100% rename from items/sh_cmd/src/cmd_variant.rs rename to steps/sh_cmd/src/cmd_variant.rs diff --git a/items/sh_cmd/src/lib.rs b/steps/sh_cmd/src/lib.rs similarity index 100% rename from items/sh_cmd/src/lib.rs rename to steps/sh_cmd/src/lib.rs diff --git a/items/sh_cmd/src/sh_cmd.rs b/steps/sh_cmd/src/sh_cmd.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd.rs rename to steps/sh_cmd/src/sh_cmd.rs diff --git a/items/sh_cmd/src/sh_cmd_apply_fns.rs b/steps/sh_cmd/src/sh_cmd_apply_fns.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_apply_fns.rs rename to steps/sh_cmd/src/sh_cmd_apply_fns.rs diff --git a/items/sh_cmd/src/sh_cmd_data.rs b/steps/sh_cmd/src/sh_cmd_data.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_data.rs rename to steps/sh_cmd/src/sh_cmd_data.rs diff --git a/items/sh_cmd/src/sh_cmd_error.rs b/steps/sh_cmd/src/sh_cmd_error.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_error.rs rename to steps/sh_cmd/src/sh_cmd_error.rs diff --git a/items/sh_cmd/src/sh_cmd_execution_record.rs b/steps/sh_cmd/src/sh_cmd_execution_record.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_execution_record.rs rename to steps/sh_cmd/src/sh_cmd_execution_record.rs diff --git a/items/sh_cmd/src/sh_cmd_executor.rs b/steps/sh_cmd/src/sh_cmd_executor.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_executor.rs rename to steps/sh_cmd/src/sh_cmd_executor.rs diff --git a/items/sh_cmd/src/sh_cmd_item.rs b/steps/sh_cmd/src/sh_cmd_item.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_item.rs rename to steps/sh_cmd/src/sh_cmd_item.rs diff --git a/items/sh_cmd/src/sh_cmd_params.rs b/steps/sh_cmd/src/sh_cmd_params.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_params.rs rename to steps/sh_cmd/src/sh_cmd_params.rs diff --git a/items/sh_cmd/src/sh_cmd_state.rs b/steps/sh_cmd/src/sh_cmd_state.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_state.rs rename to steps/sh_cmd/src/sh_cmd_state.rs diff --git a/items/sh_cmd/src/sh_cmd_state_diff.rs b/steps/sh_cmd/src/sh_cmd_state_diff.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_state_diff.rs rename to steps/sh_cmd/src/sh_cmd_state_diff.rs diff --git a/items/sh_cmd/src/sh_cmd_state_diff_fn.rs b/steps/sh_cmd/src/sh_cmd_state_diff_fn.rs similarity index 100% rename from items/sh_cmd/src/sh_cmd_state_diff_fn.rs rename to steps/sh_cmd/src/sh_cmd_state_diff_fn.rs diff --git a/items/src/lib.rs b/steps/src/lib.rs similarity index 100% rename from items/src/lib.rs rename to steps/src/lib.rs diff --git a/items/tar_x/Cargo.toml b/steps/tar_x/Cargo.toml similarity index 100% rename from items/tar_x/Cargo.toml rename to steps/tar_x/Cargo.toml diff --git a/items/tar_x/src/file_metadata.rs b/steps/tar_x/src/file_metadata.rs similarity index 100% rename from items/tar_x/src/file_metadata.rs rename to steps/tar_x/src/file_metadata.rs diff --git a/items/tar_x/src/file_metadatas.rs b/steps/tar_x/src/file_metadatas.rs similarity index 100% rename from items/tar_x/src/file_metadatas.rs rename to steps/tar_x/src/file_metadatas.rs diff --git a/items/tar_x/src/lib.rs b/steps/tar_x/src/lib.rs similarity index 100% rename from items/tar_x/src/lib.rs rename to steps/tar_x/src/lib.rs diff --git a/items/tar_x/src/native.rs b/steps/tar_x/src/native.rs similarity index 100% rename from items/tar_x/src/native.rs rename to steps/tar_x/src/native.rs diff --git a/items/tar_x/src/native/dest_dir_entry.rs b/steps/tar_x/src/native/dest_dir_entry.rs similarity index 100% rename from items/tar_x/src/native/dest_dir_entry.rs rename to steps/tar_x/src/native/dest_dir_entry.rs diff --git a/items/tar_x/src/native/dir_unfold.rs b/steps/tar_x/src/native/dir_unfold.rs similarity index 100% rename from items/tar_x/src/native/dir_unfold.rs rename to steps/tar_x/src/native/dir_unfold.rs diff --git a/items/tar_x/src/tar_x_apply_fns.rs b/steps/tar_x/src/tar_x_apply_fns.rs similarity index 100% rename from items/tar_x/src/tar_x_apply_fns.rs rename to steps/tar_x/src/tar_x_apply_fns.rs diff --git a/items/tar_x/src/tar_x_data.rs b/steps/tar_x/src/tar_x_data.rs similarity index 100% rename from items/tar_x/src/tar_x_data.rs rename to steps/tar_x/src/tar_x_data.rs diff --git a/items/tar_x/src/tar_x_error.rs b/steps/tar_x/src/tar_x_error.rs similarity index 100% rename from items/tar_x/src/tar_x_error.rs rename to steps/tar_x/src/tar_x_error.rs diff --git a/items/tar_x/src/tar_x_item.rs b/steps/tar_x/src/tar_x_item.rs similarity index 100% rename from items/tar_x/src/tar_x_item.rs rename to steps/tar_x/src/tar_x_item.rs diff --git a/items/tar_x/src/tar_x_params.rs b/steps/tar_x/src/tar_x_params.rs similarity index 100% rename from items/tar_x/src/tar_x_params.rs rename to steps/tar_x/src/tar_x_params.rs diff --git a/items/tar_x/src/tar_x_state_current_fn.rs b/steps/tar_x/src/tar_x_state_current_fn.rs similarity index 100% rename from items/tar_x/src/tar_x_state_current_fn.rs rename to steps/tar_x/src/tar_x_state_current_fn.rs diff --git a/items/tar_x/src/tar_x_state_diff.rs b/steps/tar_x/src/tar_x_state_diff.rs similarity index 100% rename from items/tar_x/src/tar_x_state_diff.rs rename to steps/tar_x/src/tar_x_state_diff.rs diff --git a/items/tar_x/src/tar_x_state_diff_fn.rs b/steps/tar_x/src/tar_x_state_diff_fn.rs similarity index 100% rename from items/tar_x/src/tar_x_state_diff_fn.rs rename to steps/tar_x/src/tar_x_state_diff_fn.rs diff --git a/items/tar_x/src/tar_x_state_goal_fn.rs b/steps/tar_x/src/tar_x_state_goal_fn.rs similarity index 100% rename from items/tar_x/src/tar_x_state_goal_fn.rs rename to steps/tar_x/src/tar_x_state_goal_fn.rs diff --git a/workspace_tests/src/items/sh_cmd_item.rs b/workspace_tests/src/steps/sh_cmd_item.rs similarity index 100% rename from workspace_tests/src/items/sh_cmd_item.rs rename to workspace_tests/src/steps/sh_cmd_item.rs diff --git a/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_apply_check.sh b/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_apply_check.sh old mode 100755 new mode 100644 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_apply_check.sh rename to workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_apply_check.sh diff --git a/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_apply_exec.sh b/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_apply_exec.sh old mode 100755 new mode 100644 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_apply_exec.sh rename to workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_apply_exec.sh diff --git a/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_clean.sh b/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_clean.sh old mode 100755 new mode 100644 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_clean.sh rename to workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_clean.sh diff --git a/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_current.sh b/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_current.sh similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_current.sh rename to workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_current.sh diff --git a/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_diff.sh b/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_diff.sh similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_diff.sh rename to workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_diff.sh diff --git a/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_goal.sh b/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_goal.sh similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_goal.sh rename to workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_goal.sh diff --git a/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_apply_check.ps1 b/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_apply_check.ps1 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_apply_check.ps1 rename to workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_apply_check.ps1 diff --git a/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_apply_exec.ps1 b/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_apply_exec.ps1 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_apply_exec.ps1 rename to workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_apply_exec.ps1 diff --git a/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_clean.ps1 b/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_clean.ps1 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_clean.ps1 rename to workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_clean.ps1 diff --git a/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_current.ps1 b/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_current.ps1 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_current.ps1 rename to workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_current.ps1 diff --git a/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_diff.ps1 b/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_diff.ps1 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_diff.ps1 rename to workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_diff.ps1 diff --git a/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_goal.ps1 b/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_goal.ps1 similarity index 100% rename from workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_goal.ps1 rename to workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_goal.ps1 diff --git a/workspace_tests/src/items/tar_x_item.rs b/workspace_tests/src/steps/tar_x_item.rs similarity index 100% rename from workspace_tests/src/items/tar_x_item.rs rename to workspace_tests/src/steps/tar_x_item.rs diff --git a/workspace_tests/src/items/tar_x_item/tar_x1.tar b/workspace_tests/src/steps/tar_x_step/tar_x1.tar similarity index 100% rename from workspace_tests/src/items/tar_x_item/tar_x1.tar rename to workspace_tests/src/steps/tar_x_step/tar_x1.tar diff --git a/workspace_tests/src/items/tar_x_item/tar_x2.tar b/workspace_tests/src/steps/tar_x_step/tar_x2.tar similarity index 100% rename from workspace_tests/src/items/tar_x_item/tar_x2.tar rename to workspace_tests/src/steps/tar_x_step/tar_x2.tar From 1b4ad9c014e71257faa02a1e2c2fc5fb97eca667 Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Tue, 28 May 2024 08:01:56 +1200 Subject: [PATCH 2/9] Rename `item*` files to `step*`. --- crate/cfg/src/{item.rs => step.rs} | 0 .../src/{item_stream_outcome.rs => step_stream_outcome.rs} | 0 ...tem_stream_outcome_mapper.rs => step_stream_outcome_mapper.rs} | 0 crate/core/src/{item_id.rs => step_id.rs} | 0 crate/flow_model/src/{item_info.rs => step_info.rs} | 0 crate/flow_model/src/{item_spec_info.rs => step_spec_info.rs} | 0 crate/resources/src/{item_rt_id.rs => step_rt_id.rs} | 0 crate/rt_model/src/outcomes/{item_apply.rs => step_apply.rs} | 0 .../src/outcomes/{item_apply_boxed.rs => step_apply_boxed.rs} | 0 .../src/outcomes/{item_apply_partial.rs => step_apply_partial.rs} | 0 .../{item_apply_partial_boxed.rs => step_apply_partial_boxed.rs} | 0 .../{item_apply_partial_rt.rs => step_apply_partial_rt.rs} | 0 .../rt_model/src/outcomes/{item_apply_rt.rs => step_apply_rt.rs} | 0 crate/rt_model/src/{item_boxed.rs => step_boxed.rs} | 0 crate/rt_model/src/{item_graph.rs => step_graph.rs} | 0 .../rt_model/src/{item_graph_builder.rs => step_graph_builder.rs} | 0 crate/rt_model/src/{item_rt.rs => step_rt.rs} | 0 crate/rt_model/src/{item_wrapper.rs => step_wrapper.rs} | 0 .../{items_state_stored_stale.rs => steps_state_stored_stale.rs} | 0 doc/src/technical_concepts/{item.md => step.md} | 0 .../step/{item_parameters.md => step_parameters.md} | 0 doc/src/technical_concepts/{item_graph.md => step_graph.md} | 0 examples/envman/src/model/{item_ids.rs => step_ids.rs} | 0 examples/envman/src/{items.rs => steps.rs} | 0 .../{iam_policy_item.rs => iam_policy_step.rs} | 0 .../peace_aws_iam_role/{iam_role_item.rs => iam_role_step.rs} | 0 .../{instance_profile_item.rs => instance_profile_step.rs} | 0 .../peace_aws_s3_bucket/{s3_bucket_item.rs => s3_bucket_step.rs} | 0 .../peace_aws_s3_object/{s3_object_item.rs => s3_object_step.rs} | 0 steps/blank/src/{blank_item.rs => blank_step.rs} | 0 .../src/{file_download_item.rs => file_download_step.rs} | 0 steps/sh_cmd/src/{sh_cmd_item.rs => sh_cmd_step.rs} | 0 steps/tar_x/src/{tar_x_item.rs => tar_x_step.rs} | 0 workspace_tests/src/cfg/{item_id.rs => step_id.rs} | 0 .../src/cfg/{item_id_invalid_fmt.rs => step_id_invalid_fmt.rs} | 0 .../cmd_model/{item_stream_outcome.rs => step_stream_outcome.rs} | 0 workspace_tests/src/flow_model/{item_info.rs => step_info.rs} | 0 .../src/flow_model/{item_spec_info.rs => step_spec_info.rs} | 0 workspace_tests/src/{mock_item.rs => mock_step.rs} | 0 .../src/rt_model/outcomes/{item_apply.rs => step_apply.rs} | 0 .../outcomes/{item_apply_boxed.rs => step_apply_boxed.rs} | 0 .../outcomes/{item_apply_partial.rs => step_apply_partial.rs} | 0 .../{item_apply_partial_boxed.rs => step_apply_partial_boxed.rs} | 0 .../{item_apply_partial_rt.rs => step_apply_partial_rt.rs} | 0 .../src/rt_model/outcomes/{item_apply_rt.rs => step_apply_rt.rs} | 0 workspace_tests/src/rt_model/{item_boxed.rs => step_boxed.rs} | 0 workspace_tests/src/rt_model/{item_graph.rs => step_graph.rs} | 0 .../src/rt_model/{item_graph_builder.rs => step_graph_builder.rs} | 0 workspace_tests/src/rt_model/{item_wrapper.rs => step_wrapper.rs} | 0 workspace_tests/src/{items.rs => steps.rs} | 0 workspace_tests/src/steps/{sh_cmd_item.rs => sh_cmd_step.rs} | 0 workspace_tests/src/steps/{tar_x_item.rs => tar_x_step.rs} | 0 workspace_tests/src/{vec_copy_item.rs => vec_copy_step.rs} | 0 53 files changed, 0 insertions(+), 0 deletions(-) rename crate/cfg/src/{item.rs => step.rs} (100%) rename crate/cmd_model/src/{item_stream_outcome.rs => step_stream_outcome.rs} (100%) rename crate/cmd_rt/src/{item_stream_outcome_mapper.rs => step_stream_outcome_mapper.rs} (100%) rename crate/core/src/{item_id.rs => step_id.rs} (100%) rename crate/flow_model/src/{item_info.rs => step_info.rs} (100%) rename crate/flow_model/src/{item_spec_info.rs => step_spec_info.rs} (100%) rename crate/resources/src/{item_rt_id.rs => step_rt_id.rs} (100%) rename crate/rt_model/src/outcomes/{item_apply.rs => step_apply.rs} (100%) rename crate/rt_model/src/outcomes/{item_apply_boxed.rs => step_apply_boxed.rs} (100%) rename crate/rt_model/src/outcomes/{item_apply_partial.rs => step_apply_partial.rs} (100%) rename crate/rt_model/src/outcomes/{item_apply_partial_boxed.rs => step_apply_partial_boxed.rs} (100%) rename crate/rt_model/src/outcomes/{item_apply_partial_rt.rs => step_apply_partial_rt.rs} (100%) rename crate/rt_model/src/outcomes/{item_apply_rt.rs => step_apply_rt.rs} (100%) rename crate/rt_model/src/{item_boxed.rs => step_boxed.rs} (100%) rename crate/rt_model/src/{item_graph.rs => step_graph.rs} (100%) rename crate/rt_model/src/{item_graph_builder.rs => step_graph_builder.rs} (100%) rename crate/rt_model/src/{item_rt.rs => step_rt.rs} (100%) rename crate/rt_model/src/{item_wrapper.rs => step_wrapper.rs} (100%) rename crate/rt_model_core/src/{items_state_stored_stale.rs => steps_state_stored_stale.rs} (100%) rename doc/src/technical_concepts/{item.md => step.md} (100%) rename doc/src/technical_concepts/step/{item_parameters.md => step_parameters.md} (100%) rename doc/src/technical_concepts/{item_graph.md => step_graph.md} (100%) rename examples/envman/src/model/{item_ids.rs => step_ids.rs} (100%) rename examples/envman/src/{items.rs => steps.rs} (100%) rename examples/envman/src/steps/peace_aws_iam_policy/{iam_policy_item.rs => iam_policy_step.rs} (100%) rename examples/envman/src/steps/peace_aws_iam_role/{iam_role_item.rs => iam_role_step.rs} (100%) rename examples/envman/src/steps/peace_aws_instance_profile/{instance_profile_item.rs => instance_profile_step.rs} (100%) rename examples/envman/src/steps/peace_aws_s3_bucket/{s3_bucket_item.rs => s3_bucket_step.rs} (100%) rename examples/envman/src/steps/peace_aws_s3_object/{s3_object_item.rs => s3_object_step.rs} (100%) rename steps/blank/src/{blank_item.rs => blank_step.rs} (100%) rename steps/file_download/src/{file_download_item.rs => file_download_step.rs} (100%) rename steps/sh_cmd/src/{sh_cmd_item.rs => sh_cmd_step.rs} (100%) rename steps/tar_x/src/{tar_x_item.rs => tar_x_step.rs} (100%) rename workspace_tests/src/cfg/{item_id.rs => step_id.rs} (100%) rename workspace_tests/src/cfg/{item_id_invalid_fmt.rs => step_id_invalid_fmt.rs} (100%) rename workspace_tests/src/cmd_model/{item_stream_outcome.rs => step_stream_outcome.rs} (100%) rename workspace_tests/src/flow_model/{item_info.rs => step_info.rs} (100%) rename workspace_tests/src/flow_model/{item_spec_info.rs => step_spec_info.rs} (100%) rename workspace_tests/src/{mock_item.rs => mock_step.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{item_apply.rs => step_apply.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{item_apply_boxed.rs => step_apply_boxed.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{item_apply_partial.rs => step_apply_partial.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{item_apply_partial_boxed.rs => step_apply_partial_boxed.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{item_apply_partial_rt.rs => step_apply_partial_rt.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{item_apply_rt.rs => step_apply_rt.rs} (100%) rename workspace_tests/src/rt_model/{item_boxed.rs => step_boxed.rs} (100%) rename workspace_tests/src/rt_model/{item_graph.rs => step_graph.rs} (100%) rename workspace_tests/src/rt_model/{item_graph_builder.rs => step_graph_builder.rs} (100%) rename workspace_tests/src/rt_model/{item_wrapper.rs => step_wrapper.rs} (100%) rename workspace_tests/src/{items.rs => steps.rs} (100%) rename workspace_tests/src/steps/{sh_cmd_item.rs => sh_cmd_step.rs} (100%) rename workspace_tests/src/steps/{tar_x_item.rs => tar_x_step.rs} (100%) rename workspace_tests/src/{vec_copy_item.rs => vec_copy_step.rs} (100%) diff --git a/crate/cfg/src/item.rs b/crate/cfg/src/step.rs similarity index 100% rename from crate/cfg/src/item.rs rename to crate/cfg/src/step.rs diff --git a/crate/cmd_model/src/item_stream_outcome.rs b/crate/cmd_model/src/step_stream_outcome.rs similarity index 100% rename from crate/cmd_model/src/item_stream_outcome.rs rename to crate/cmd_model/src/step_stream_outcome.rs diff --git a/crate/cmd_rt/src/item_stream_outcome_mapper.rs b/crate/cmd_rt/src/step_stream_outcome_mapper.rs similarity index 100% rename from crate/cmd_rt/src/item_stream_outcome_mapper.rs rename to crate/cmd_rt/src/step_stream_outcome_mapper.rs diff --git a/crate/core/src/item_id.rs b/crate/core/src/step_id.rs similarity index 100% rename from crate/core/src/item_id.rs rename to crate/core/src/step_id.rs diff --git a/crate/flow_model/src/item_info.rs b/crate/flow_model/src/step_info.rs similarity index 100% rename from crate/flow_model/src/item_info.rs rename to crate/flow_model/src/step_info.rs diff --git a/crate/flow_model/src/item_spec_info.rs b/crate/flow_model/src/step_spec_info.rs similarity index 100% rename from crate/flow_model/src/item_spec_info.rs rename to crate/flow_model/src/step_spec_info.rs diff --git a/crate/resources/src/item_rt_id.rs b/crate/resources/src/step_rt_id.rs similarity index 100% rename from crate/resources/src/item_rt_id.rs rename to crate/resources/src/step_rt_id.rs diff --git a/crate/rt_model/src/outcomes/item_apply.rs b/crate/rt_model/src/outcomes/step_apply.rs similarity index 100% rename from crate/rt_model/src/outcomes/item_apply.rs rename to crate/rt_model/src/outcomes/step_apply.rs diff --git a/crate/rt_model/src/outcomes/item_apply_boxed.rs b/crate/rt_model/src/outcomes/step_apply_boxed.rs similarity index 100% rename from crate/rt_model/src/outcomes/item_apply_boxed.rs rename to crate/rt_model/src/outcomes/step_apply_boxed.rs diff --git a/crate/rt_model/src/outcomes/item_apply_partial.rs b/crate/rt_model/src/outcomes/step_apply_partial.rs similarity index 100% rename from crate/rt_model/src/outcomes/item_apply_partial.rs rename to crate/rt_model/src/outcomes/step_apply_partial.rs diff --git a/crate/rt_model/src/outcomes/item_apply_partial_boxed.rs b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs similarity index 100% rename from crate/rt_model/src/outcomes/item_apply_partial_boxed.rs rename to crate/rt_model/src/outcomes/step_apply_partial_boxed.rs diff --git a/crate/rt_model/src/outcomes/item_apply_partial_rt.rs b/crate/rt_model/src/outcomes/step_apply_partial_rt.rs similarity index 100% rename from crate/rt_model/src/outcomes/item_apply_partial_rt.rs rename to crate/rt_model/src/outcomes/step_apply_partial_rt.rs diff --git a/crate/rt_model/src/outcomes/item_apply_rt.rs b/crate/rt_model/src/outcomes/step_apply_rt.rs similarity index 100% rename from crate/rt_model/src/outcomes/item_apply_rt.rs rename to crate/rt_model/src/outcomes/step_apply_rt.rs diff --git a/crate/rt_model/src/item_boxed.rs b/crate/rt_model/src/step_boxed.rs similarity index 100% rename from crate/rt_model/src/item_boxed.rs rename to crate/rt_model/src/step_boxed.rs diff --git a/crate/rt_model/src/item_graph.rs b/crate/rt_model/src/step_graph.rs similarity index 100% rename from crate/rt_model/src/item_graph.rs rename to crate/rt_model/src/step_graph.rs diff --git a/crate/rt_model/src/item_graph_builder.rs b/crate/rt_model/src/step_graph_builder.rs similarity index 100% rename from crate/rt_model/src/item_graph_builder.rs rename to crate/rt_model/src/step_graph_builder.rs diff --git a/crate/rt_model/src/item_rt.rs b/crate/rt_model/src/step_rt.rs similarity index 100% rename from crate/rt_model/src/item_rt.rs rename to crate/rt_model/src/step_rt.rs diff --git a/crate/rt_model/src/item_wrapper.rs b/crate/rt_model/src/step_wrapper.rs similarity index 100% rename from crate/rt_model/src/item_wrapper.rs rename to crate/rt_model/src/step_wrapper.rs diff --git a/crate/rt_model_core/src/items_state_stored_stale.rs b/crate/rt_model_core/src/steps_state_stored_stale.rs similarity index 100% rename from crate/rt_model_core/src/items_state_stored_stale.rs rename to crate/rt_model_core/src/steps_state_stored_stale.rs diff --git a/doc/src/technical_concepts/item.md b/doc/src/technical_concepts/step.md similarity index 100% rename from doc/src/technical_concepts/item.md rename to doc/src/technical_concepts/step.md diff --git a/doc/src/technical_concepts/step/item_parameters.md b/doc/src/technical_concepts/step/step_parameters.md similarity index 100% rename from doc/src/technical_concepts/step/item_parameters.md rename to doc/src/technical_concepts/step/step_parameters.md diff --git a/doc/src/technical_concepts/item_graph.md b/doc/src/technical_concepts/step_graph.md similarity index 100% rename from doc/src/technical_concepts/item_graph.md rename to doc/src/technical_concepts/step_graph.md diff --git a/examples/envman/src/model/item_ids.rs b/examples/envman/src/model/step_ids.rs similarity index 100% rename from examples/envman/src/model/item_ids.rs rename to examples/envman/src/model/step_ids.rs diff --git a/examples/envman/src/items.rs b/examples/envman/src/steps.rs similarity index 100% rename from examples/envman/src/items.rs rename to examples/envman/src/steps.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_item.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_step.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_item.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_step.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_item.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_step.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_item.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_step.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_item.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_step.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_item.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_step.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_item.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_step.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_item.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_step.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_item.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_step.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_item.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_step.rs diff --git a/steps/blank/src/blank_item.rs b/steps/blank/src/blank_step.rs similarity index 100% rename from steps/blank/src/blank_item.rs rename to steps/blank/src/blank_step.rs diff --git a/steps/file_download/src/file_download_item.rs b/steps/file_download/src/file_download_step.rs similarity index 100% rename from steps/file_download/src/file_download_item.rs rename to steps/file_download/src/file_download_step.rs diff --git a/steps/sh_cmd/src/sh_cmd_item.rs b/steps/sh_cmd/src/sh_cmd_step.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_item.rs rename to steps/sh_cmd/src/sh_cmd_step.rs diff --git a/steps/tar_x/src/tar_x_item.rs b/steps/tar_x/src/tar_x_step.rs similarity index 100% rename from steps/tar_x/src/tar_x_item.rs rename to steps/tar_x/src/tar_x_step.rs diff --git a/workspace_tests/src/cfg/item_id.rs b/workspace_tests/src/cfg/step_id.rs similarity index 100% rename from workspace_tests/src/cfg/item_id.rs rename to workspace_tests/src/cfg/step_id.rs diff --git a/workspace_tests/src/cfg/item_id_invalid_fmt.rs b/workspace_tests/src/cfg/step_id_invalid_fmt.rs similarity index 100% rename from workspace_tests/src/cfg/item_id_invalid_fmt.rs rename to workspace_tests/src/cfg/step_id_invalid_fmt.rs diff --git a/workspace_tests/src/cmd_model/item_stream_outcome.rs b/workspace_tests/src/cmd_model/step_stream_outcome.rs similarity index 100% rename from workspace_tests/src/cmd_model/item_stream_outcome.rs rename to workspace_tests/src/cmd_model/step_stream_outcome.rs diff --git a/workspace_tests/src/flow_model/item_info.rs b/workspace_tests/src/flow_model/step_info.rs similarity index 100% rename from workspace_tests/src/flow_model/item_info.rs rename to workspace_tests/src/flow_model/step_info.rs diff --git a/workspace_tests/src/flow_model/item_spec_info.rs b/workspace_tests/src/flow_model/step_spec_info.rs similarity index 100% rename from workspace_tests/src/flow_model/item_spec_info.rs rename to workspace_tests/src/flow_model/step_spec_info.rs diff --git a/workspace_tests/src/mock_item.rs b/workspace_tests/src/mock_step.rs similarity index 100% rename from workspace_tests/src/mock_item.rs rename to workspace_tests/src/mock_step.rs diff --git a/workspace_tests/src/rt_model/outcomes/item_apply.rs b/workspace_tests/src/rt_model/outcomes/step_apply.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/item_apply.rs rename to workspace_tests/src/rt_model/outcomes/step_apply.rs diff --git a/workspace_tests/src/rt_model/outcomes/item_apply_boxed.rs b/workspace_tests/src/rt_model/outcomes/step_apply_boxed.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/item_apply_boxed.rs rename to workspace_tests/src/rt_model/outcomes/step_apply_boxed.rs diff --git a/workspace_tests/src/rt_model/outcomes/item_apply_partial.rs b/workspace_tests/src/rt_model/outcomes/step_apply_partial.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/item_apply_partial.rs rename to workspace_tests/src/rt_model/outcomes/step_apply_partial.rs diff --git a/workspace_tests/src/rt_model/outcomes/item_apply_partial_boxed.rs b/workspace_tests/src/rt_model/outcomes/step_apply_partial_boxed.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/item_apply_partial_boxed.rs rename to workspace_tests/src/rt_model/outcomes/step_apply_partial_boxed.rs diff --git a/workspace_tests/src/rt_model/outcomes/item_apply_partial_rt.rs b/workspace_tests/src/rt_model/outcomes/step_apply_partial_rt.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/item_apply_partial_rt.rs rename to workspace_tests/src/rt_model/outcomes/step_apply_partial_rt.rs diff --git a/workspace_tests/src/rt_model/outcomes/item_apply_rt.rs b/workspace_tests/src/rt_model/outcomes/step_apply_rt.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/item_apply_rt.rs rename to workspace_tests/src/rt_model/outcomes/step_apply_rt.rs diff --git a/workspace_tests/src/rt_model/item_boxed.rs b/workspace_tests/src/rt_model/step_boxed.rs similarity index 100% rename from workspace_tests/src/rt_model/item_boxed.rs rename to workspace_tests/src/rt_model/step_boxed.rs diff --git a/workspace_tests/src/rt_model/item_graph.rs b/workspace_tests/src/rt_model/step_graph.rs similarity index 100% rename from workspace_tests/src/rt_model/item_graph.rs rename to workspace_tests/src/rt_model/step_graph.rs diff --git a/workspace_tests/src/rt_model/item_graph_builder.rs b/workspace_tests/src/rt_model/step_graph_builder.rs similarity index 100% rename from workspace_tests/src/rt_model/item_graph_builder.rs rename to workspace_tests/src/rt_model/step_graph_builder.rs diff --git a/workspace_tests/src/rt_model/item_wrapper.rs b/workspace_tests/src/rt_model/step_wrapper.rs similarity index 100% rename from workspace_tests/src/rt_model/item_wrapper.rs rename to workspace_tests/src/rt_model/step_wrapper.rs diff --git a/workspace_tests/src/items.rs b/workspace_tests/src/steps.rs similarity index 100% rename from workspace_tests/src/items.rs rename to workspace_tests/src/steps.rs diff --git a/workspace_tests/src/steps/sh_cmd_item.rs b/workspace_tests/src/steps/sh_cmd_step.rs similarity index 100% rename from workspace_tests/src/steps/sh_cmd_item.rs rename to workspace_tests/src/steps/sh_cmd_step.rs diff --git a/workspace_tests/src/steps/tar_x_item.rs b/workspace_tests/src/steps/tar_x_step.rs similarity index 100% rename from workspace_tests/src/steps/tar_x_item.rs rename to workspace_tests/src/steps/tar_x_step.rs diff --git a/workspace_tests/src/vec_copy_item.rs b/workspace_tests/src/vec_copy_step.rs similarity index 100% rename from workspace_tests/src/vec_copy_item.rs rename to workspace_tests/src/vec_copy_step.rs From e4dc13970f5f1226bd1da1001f301ec30e8e23ab Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Sat, 1 Jun 2024 15:37:33 +1200 Subject: [PATCH 3/9] Rename `an item` to `a step`. --- crate/cfg/src/fn_ctx.rs | 2 +- crate/cfg/src/state.rs | 12 ++++---- crate/cfg/src/step.rs | 6 ++-- crate/cmd/src/ctx/cmd_ctx_builder.rs | 2 +- crate/cmd_model/src/cmd_outcome.rs | 2 +- crate/cmd_model/src/step_stream_outcome.rs | 2 +- crate/cmd_rt/src/cmd_block.rs | 2 +- .../cmd_rt/src/cmd_block/cmd_block_wrapper.rs | 6 ++-- .../cmd_rt/src/step_stream_outcome_mapper.rs | 2 +- crate/code_gen/src/cmd/impl_common_fns.rs | 2 +- crate/core/src/progress/progress_sender.rs | 2 +- crate/core/src/progress/progress_status.rs | 2 +- crate/core/src/progress/progress_tracker.rs | 2 +- crate/core/src/step_id.rs | 4 +-- crate/data/src/marker/apply_dry.rs | 4 +-- crate/data/src/marker/clean.rs | 4 +-- crate/data/src/marker/current.rs | 4 +-- crate/data/src/marker/goal.rs | 4 +-- crate/flow_model/src/step_info.rs | 2 +- crate/flow_model/src/step_spec_info.rs | 2 +- crate/fmt/src/presenter.rs | 4 +-- crate/params/src/lib.rs | 2 +- crate/params/src/params.rs | 2 +- crate/params/src/params_fieldless.rs | 2 +- crate/params/src/params_spec.rs | 2 +- crate/params/src/params_spec_fieldless.rs | 2 +- crate/params/src/value_spec.rs | 2 +- .../src/impl_field_wise_builder.rs | 2 +- crate/params_derive/src/lib.rs | 4 +-- crate/resources/src/states.rs | 2 +- crate/resources/src/states/states_current.rs | 2 +- .../src/states/states_current_stored.rs | 2 +- crate/resources/src/states/states_goal.rs | 2 +- crate/resources/src/step_rt_id.rs | 2 +- crate/rt_model/src/flow.rs | 2 +- crate/rt_model/src/outcomes/step_apply.rs | 2 +- .../rt_model/src/outcomes/step_apply_boxed.rs | 2 +- .../src/outcomes/step_apply_partial.rs | 2 +- .../src/outcomes/step_apply_partial_boxed.rs | 2 +- crate/rt_model/src/step_graph_builder.rs | 2 +- crate/rt_model/src/step_rt.rs | 2 +- crate/rt_model_core/src/error.rs | 12 ++++---- .../src/error/state_downcast_error.rs | 2 +- crate/rt_model_core/src/error/web_error.rs | 16 +++++------ .../src/state_stored_and_discovered.rs | 2 +- crate/rt_model_web/src/storage.rs | 28 +++++++++---------- doc/src/ideas.md | 12 ++++---- doc/src/technical_concepts.md | 2 +- .../flow_versioning/seamless_execution.md | 6 ++-- .../flow_versioning/upgrade_actions.md | 4 +-- .../output/execution_progress.md | 2 +- doc/src/technical_concepts/state.md | 14 +++++----- .../technical_concepts/state/logical_state.md | 6 ++-- doc/src/technical_concepts/step.md | 2 +- .../step/step_parameters.md | 2 +- .../step_parameters/params_specification.md | 2 +- doc/src/technical_concepts/step_graph.md | 2 +- steps/tar_x/src/tar_x_error.rs | 2 +- 58 files changed, 115 insertions(+), 115 deletions(-) diff --git a/crate/cfg/src/fn_ctx.rs b/crate/cfg/src/fn_ctx.rs index 31289bd31..bfc1f958a 100644 --- a/crate/cfg/src/fn_ctx.rs +++ b/crate/cfg/src/fn_ctx.rs @@ -5,7 +5,7 @@ use peace_core::ItemId; #[cfg(feature = "output_progress")] use peace_core::progress::ProgressSender; -/// References to pass information between the Peace framework and an item. +/// References to pass information between the Peace framework and a step. #[derive(Clone, Copy, Debug)] pub struct FnCtx<'exec> { /// ID of the item this belongs to. diff --git a/crate/cfg/src/state.rs b/crate/cfg/src/state.rs index 839166162..c45975847 100644 --- a/crate/cfg/src/state.rs +++ b/crate/cfg/src/state.rs @@ -18,11 +18,11 @@ use serde::{Deserialize, Serialize}; /// states. Otherwise, a type that represents the fully logical / fully physical /// state is sufficient. /// -/// In `peace`, [`State`] represents the values of an item, and has the +/// In `peace`, [`State`] represents the values of a step, and has the /// following usages: /// -/// * Showing users the state of an item. -/// * Allowing users to describe the state that an item should be. +/// * Showing users the state of a step. +/// * Allowing users to describe the state that a step should be. /// * Determining what needs to change between the current state and the goal /// state. /// @@ -64,7 +64,7 @@ use serde::{Deserialize, Serialize}; /// /// ### Fully Logical /// -/// If an item's state can be fully described before the item exists, and can be +/// If a step's state can be fully described before the item exists, and can be /// made to happen without interacting with an external service, then the state /// is fully logical. /// @@ -76,7 +76,7 @@ use serde::{Deserialize, Serialize}; /// /// ### Logical and Physical /// -/// If an item's goal state can be described before the item exists, but +/// If a step's goal state can be described before the item exists, but /// interacts with an external service which produces additional information to /// bring that goal state into existence, then the state has both logical and /// physical parts. @@ -89,7 +89,7 @@ use serde::{Deserialize, Serialize}; /// /// ### Fully Physical /// -/// If an item's goal state is simply, "automation has been executed after these +/// If a step's goal state is simply, "automation has been executed after these /// files have been modified", then the state has no logical component. /// /// For example, running a compilation command only if the compilation artifact diff --git a/crate/cfg/src/step.rs b/crate/cfg/src/step.rs index 0aaa59a39..d4d6f03ef 100644 --- a/crate/cfg/src/step.rs +++ b/crate/cfg/src/step.rs @@ -10,7 +10,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::FnCtx; -/// Defines all of the data and logic to manage an item. +/// Defines all of the data and logic to manage a step. /// /// The item may be simple or complex, ranging from: /// @@ -158,8 +158,8 @@ pub trait Item: DynClone { /// /// # Design Note /// - /// This is an instance method as logic for an `Item` may be used for - /// multiple tasks. For example, an `Item` implemented to download a + /// This is an instance method as logic for a `Step` may be used for + /// multiple tasks. For example, a `Step` implemented to download a /// file may be instantiated with different files to download, and each /// instance of the `Item` should have its own ID. /// diff --git a/crate/cmd/src/ctx/cmd_ctx_builder.rs b/crate/cmd/src/ctx/cmd_ctx_builder.rs index d675efd64..84169949d 100644 --- a/crate/cmd/src/ctx/cmd_ctx_builder.rs +++ b/crate/cmd/src/ctx/cmd_ctx_builder.rs @@ -267,7 +267,7 @@ where /// Merges provided item parameters with previously stored item /// parameters. /// -/// If an item's parameters are not provided, and nothing was previously +/// If a step's parameters are not provided, and nothing was previously /// stored, then an error is returned. fn params_specs_merge( flow: &Flow, diff --git a/crate/cmd_model/src/cmd_outcome.rs b/crate/cmd_model/src/cmd_outcome.rs index 643e7353d..2ee34cfc8 100644 --- a/crate/cmd_model/src/cmd_outcome.rs +++ b/crate/cmd_model/src/cmd_outcome.rs @@ -7,7 +7,7 @@ use crate::{CmdBlockDesc, ItemStreamOutcome}; /// Outcome of a [`CmdExecution`]. /// /// The variants indicate whether execution was successful, interrupted, or -/// errored when processing an item. +/// errored when processing a step. /// /// [`CmdExecution`]: https://docs.rs/peace_cmd_rt/latest/peace_cmd_rt/struct.CmdExecution.html #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/crate/cmd_model/src/step_stream_outcome.rs b/crate/cmd_model/src/step_stream_outcome.rs index 86150b96c..9f6afcd7d 100644 --- a/crate/cmd_model/src/step_stream_outcome.rs +++ b/crate/cmd_model/src/step_stream_outcome.rs @@ -17,7 +17,7 @@ pub struct ItemStreamOutcome { } impl ItemStreamOutcome { - /// Returns an `ItemStreamOutcome` that is `Finished`. + /// Returns a `StepStreamOutcome` that is `Finished`. pub fn finished_with(value: T, item_ids_processed: Vec) -> Self { Self { value, diff --git a/crate/cmd_rt/src/cmd_block.rs b/crate/cmd_rt/src/cmd_block.rs index 06abda006..0f26f53fe 100644 --- a/crate/cmd_rt/src/cmd_block.rs +++ b/crate/cmd_rt/src/cmd_block.rs @@ -163,7 +163,7 @@ pub trait CmdBlock: Debug { /// Producer function to process all items. /// /// This is infallible because errors are expected to be returned associated - /// with an item. This may change if there are errors that are related to + /// with a step. This may change if there are errors that are related to /// the block that are not associated with a specific item. /// /// # Implementors diff --git a/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs b/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs index 12fb4483e..1bd33d5fd 100644 --- a/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs +++ b/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs @@ -34,7 +34,7 @@ pub struct CmdBlockWrapper ExecutionOutcome, /// Marker. @@ -54,7 +54,7 @@ where /// * `fn_partial_exec_handler`: How the `CmdExecution` should end, if /// execution ends with this `CmdBlock`. /// - /// This could be due to interruption, or a `CmdOutcome` with an item + /// This could be due to interruption, or a `CmdOutcome` with a step /// failure. pub fn new( cmd_block: CB, @@ -146,7 +146,7 @@ where // e.g. `StatesCurrentMut` should be mapped into `StatesEnsured` when some // items fail to be ensured. // - // Note, when discovering current and goal states for diffing, and an item + // Note, when discovering current and goal states for diffing, and a step // error occurs, mapping the partially accumulated `(StatesCurrentMut, // StatesGoalMut)` into `StateDiffs` may or may not be semantically // meaningful. diff --git a/crate/cmd_rt/src/step_stream_outcome_mapper.rs b/crate/cmd_rt/src/step_stream_outcome_mapper.rs index 9c852f3ab..3e7a55aa4 100644 --- a/crate/cmd_rt/src/step_stream_outcome_mapper.rs +++ b/crate/cmd_rt/src/step_stream_outcome_mapper.rs @@ -2,7 +2,7 @@ use fn_graph::StreamOutcome; use peace_cmd_model::ItemStreamOutcome; use peace_rt_model::Flow; -/// Maps a `StreamOutcome` to an `ItemStreamOutcome`. +/// Maps a `StreamOutcome` to a `StepStreamOutcome`. /// /// # Design Note /// diff --git a/crate/code_gen/src/cmd/impl_common_fns.rs b/crate/code_gen/src/cmd/impl_common_fns.rs index ad58c50fb..aaeceb90b 100644 --- a/crate/code_gen/src/cmd/impl_common_fns.rs +++ b/crate/code_gen/src/cmd/impl_common_fns.rs @@ -34,7 +34,7 @@ pub fn impl_common_fns(scope_struct: &ScopeStruct) -> proc_macro2::TokenStream { if scope.flow_count() == FlowCount::One { common_fns.extend(quote! { - /// Sets an item's parameters. + /// Sets a step's parameters. /// /// Note: this **must** be called for each item in the flow. pub fn with_item_params( diff --git a/crate/core/src/progress/progress_sender.rs b/crate/core/src/progress/progress_sender.rs index ba228306b..e2294745a 100644 --- a/crate/core/src/progress/progress_sender.rs +++ b/crate/core/src/progress/progress_sender.rs @@ -7,7 +7,7 @@ use crate::{ ItemId, }; -/// Submits progress for an item's `ApplyFns::exec` method. +/// Submits progress for a step's `ApplyFns::exec` method. #[derive(Clone, Copy, Debug)] pub struct ProgressSender<'exec> { /// ID of the item this belongs to. diff --git a/crate/core/src/progress/progress_status.rs b/crate/core/src/progress/progress_status.rs index 4ce1e8b77..212bcef47 100644 --- a/crate/core/src/progress/progress_status.rs +++ b/crate/core/src/progress/progress_status.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::progress::ProgressComplete; -/// Status of an item's execution progress. +/// Status of a step's execution progress. /// /// # Implementation Notes /// diff --git a/crate/core/src/progress/progress_tracker.rs b/crate/core/src/progress/progress_tracker.rs index 409324d3c..a213d299e 100644 --- a/crate/core/src/progress/progress_tracker.rs +++ b/crate/core/src/progress/progress_tracker.rs @@ -5,7 +5,7 @@ use indicatif::ProgressBar; use crate::progress::{ProgressLimit, ProgressStatus}; -/// Tracks progress for an item's `ApplyFns::exec` method. +/// Tracks progress for a step's `ApplyFns::exec` method. #[derive(Debug)] pub struct ProgressTracker { /// Status of the item's execution progress. diff --git a/crate/core/src/step_id.rs b/crate/core/src/step_id.rs index 5d7ed01f2..ac82feb2b 100644 --- a/crate/core/src/step_id.rs +++ b/crate/core/src/step_id.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use serde::{Deserialize, Serialize}; -/// Unique identifier for an [`Item`], `Cow<'static, str>` newtype. +/// Unique identifier for a [`Step`], `Cow<'static, str>` newtype. /// /// Must begin with a letter or underscore, and contain only letters, numbers, /// and underscores. @@ -28,7 +28,7 @@ use serde::{Deserialize, Serialize}; /// there needs to be a way to: /// /// * Read state using the old ID. -/// * Either clean up that state, or migrate that state into an Item with the +/// * Either clean up that state, or migrate that state into a Step with the /// new ID. /// /// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html diff --git a/crate/data/src/marker/apply_dry.rs b/crate/data/src/marker/apply_dry.rs index 484f895c1..5e3d1d1dc 100644 --- a/crate/data/src/marker/apply_dry.rs +++ b/crate/data/src/marker/apply_dry.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; /// Marker for apply-dry state. /// -/// This is used for referential param values, where an item param value is +/// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// An `ApplyDry` is set to `Some` whenever an item is dry applied, +/// An `ApplyDry` is set to `Some` whenever a step is dry applied, /// enabling a subsequent successor's params to access that value when the /// successor's `apply_dry` function is run. /// diff --git a/crate/data/src/marker/clean.rs b/crate/data/src/marker/clean.rs index 96e37f085..bf8c4defb 100644 --- a/crate/data/src/marker/clean.rs +++ b/crate/data/src/marker/clean.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; /// Marker for clean state. /// -/// This is used for referential param values, where an item param value is +/// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Clean` is set to `Some` whenever an item's clean state is +/// A `Clean` is set to `Some` whenever a step's clean state is /// needed, e.g. preparing for applying the clean state. enabling a subsequent /// successor's params to access that value when the successor's `state_clean` /// function is run. diff --git a/crate/data/src/marker/current.rs b/crate/data/src/marker/current.rs index a10b8e3fb..707df55fb 100644 --- a/crate/data/src/marker/current.rs +++ b/crate/data/src/marker/current.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; /// Marker for current state. /// -/// This is used for referential param values, where an item param value is +/// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Current` is set to `Some` whenever an item's current state +/// A `Current` is set to `Some` whenever a step's current state /// is discovered. enabling a subsequent successor's params to access that value /// when the successor's **goal** state function is run. /// diff --git a/crate/data/src/marker/goal.rs b/crate/data/src/marker/goal.rs index 3a3872afe..6ba975021 100644 --- a/crate/data/src/marker/goal.rs +++ b/crate/data/src/marker/goal.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; /// Marker for goal state. /// -/// This is used for referential param values, where an item param value is +/// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Goal` is set to `Some` whenever an item's goal state +/// A `Goal` is set to `Some` whenever a step's goal state /// is discovered. enabling a subsequent successor's params to access that value /// when the successor's goal state function is run. /// diff --git a/crate/flow_model/src/step_info.rs b/crate/flow_model/src/step_info.rs index 29882e5dc..c58ffe246 100644 --- a/crate/flow_model/src/step_info.rs +++ b/crate/flow_model/src/step_info.rs @@ -1,7 +1,7 @@ use peace_core::ItemId; use serde::{Deserialize, Serialize}; -/// Serializable representation of values used for / produced by an [`Item`]. +/// Serializable representation of values used for / produced by a [`Step`]. /// /// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] diff --git a/crate/flow_model/src/step_spec_info.rs b/crate/flow_model/src/step_spec_info.rs index e5ff66e1a..21cf029df 100644 --- a/crate/flow_model/src/step_spec_info.rs +++ b/crate/flow_model/src/step_spec_info.rs @@ -1,7 +1,7 @@ use peace_core::ItemId; use serde::{Deserialize, Serialize}; -/// Serializable representation of how an [`Item`] is configured. +/// Serializable representation of how a [`Step`] is configured. /// /// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] diff --git a/crate/fmt/src/presenter.rs b/crate/fmt/src/presenter.rs index 131658bf3..1b761ba1d 100644 --- a/crate/fmt/src/presenter.rs +++ b/crate/fmt/src/presenter.rs @@ -50,14 +50,14 @@ pub trait Presenter<'output> { /// Error returned during a presentation failure. type Error: std::error::Error; - /// Presents text as an item id. + /// Presents text as a step id. /// /// # Purposes /// /// * An ID with no spaces, e.g. "my_item" async fn id(&mut self, id: &str) -> Result<(), Self::Error>; - /// Presents text as an item name. + /// Presents text as a step name. /// /// # Purposes /// diff --git a/crate/params/src/lib.rs b/crate/params/src/lib.rs index 6b5873ee0..fce5e15d7 100644 --- a/crate/params/src/lib.rs +++ b/crate/params/src/lib.rs @@ -8,7 +8,7 @@ //! //! # Design //! -//! When an item is defined, implementors define the parameters type for +//! When a step is defined, implementors define the parameters type for //! that item. //! //! For Peace to derive additional functionality from that type, this crate: diff --git a/crate/params/src/params.rs b/crate/params/src/params.rs index c00c8451a..eee553ae0 100644 --- a/crate/params/src/params.rs +++ b/crate/params/src/params.rs @@ -4,7 +4,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::FieldWiseSpecRt; -/// Input parameters to an item. +/// Input parameters to a step. /// /// This trait is automatically implemented by `#[derive(Value)]`. pub trait Params: Clone + Debug + Serialize + DeserializeOwned + Send + Sync + 'static { diff --git a/crate/params/src/params_fieldless.rs b/crate/params/src/params_fieldless.rs index ae7b747cf..acbf26185 100644 --- a/crate/params/src/params_fieldless.rs +++ b/crate/params/src/params_fieldless.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use serde::{de::DeserializeOwned, Serialize}; -/// Field of an `Item::Params`. +/// Field of a `Step::Params`. /// /// This trait is automatically implemented by `#[derive(Value)]`. /// diff --git a/crate/params/src/params_spec.rs b/crate/params/src/params_spec.rs index f8a9fdcd8..d5daa5ef3 100644 --- a/crate/params/src/params_spec.rs +++ b/crate/params/src/params_spec.rs @@ -8,7 +8,7 @@ use crate::{ ParamsResolveError, ValueResolutionCtx, ValueSpecRt, }; -/// How to populate a field's value in an item's params. +/// How to populate a field's value in a step's params. /// /// The `MappingFn` variant's mapping function is `None` when deserialized, as /// it is impossible to determine the underlying `F` and `U` type parameters for diff --git a/crate/params/src/params_spec_fieldless.rs b/crate/params/src/params_spec_fieldless.rs index f71a8b944..7cde56617 100644 --- a/crate/params/src/params_spec_fieldless.rs +++ b/crate/params/src/params_spec_fieldless.rs @@ -8,7 +8,7 @@ use crate::{ ValueResolutionCtx, ValueSpecRt, }; -/// How to populate a field's value in an item's params. +/// How to populate a field's value in a step's params. /// /// The `MappingFn` variant's mapping function is `None` when deserialized, as /// it is impossible to determine the underlying `F` and `U` type parameters for diff --git a/crate/params/src/value_spec.rs b/crate/params/src/value_spec.rs index 86b042248..21e1f543e 100644 --- a/crate/params/src/value_spec.rs +++ b/crate/params/src/value_spec.rs @@ -8,7 +8,7 @@ use crate::{ ValueSpecRt, }; -/// How to populate a field's value in an item's params. +/// How to populate a field's value in a step's params. /// /// The `MappingFn` variant's mapping function is `None` when deserialized, as /// it is impossible to determine the underlying `F` and `U` type parameters for diff --git a/crate/params_derive/src/impl_field_wise_builder.rs b/crate/params_derive/src/impl_field_wise_builder.rs index 52b7c1fcb..a0d10d638 100644 --- a/crate/params_derive/src/impl_field_wise_builder.rs +++ b/crate/params_derive/src/impl_field_wise_builder.rs @@ -41,7 +41,7 @@ pub fn impl_field_wise_builder( |fields| fields_to_optional_value_spec(fields, peace_params_path), &[parse_quote! { #[doc="\ - Builder for specification of how to look up the values for an item's \n\ + Builder for specification of how to look up the values for a step's \n\ parameters.\ "] }], diff --git a/crate/params_derive/src/lib.rs b/crate/params_derive/src/lib.rs index 1d92ac01a..bc827eafc 100644 --- a/crate/params_derive/src/lib.rs +++ b/crate/params_derive/src/lib.rs @@ -452,7 +452,7 @@ fn t_field_wise( |fields| fields_to_value_spec(fields, peace_params_path), &[ parse_quote! { - #[doc="Specification of how to look up values for an item's parameters."] + #[doc="Specification of how to look up values for a step's parameters."] }, // `Clone` and `Debug` are implemented manually, so that type parameters do not receive // the `Clone` and `Debug` bounds. @@ -522,7 +522,7 @@ fn t_field_wise_external( t_field_wise_name, &[ parse_quote! { - #[doc="Specification of how to look up values for an item's parameters."] + #[doc="Specification of how to look up values for a step's parameters."] }, parse_quote!(#[derive(serde::Serialize, serde::Deserialize)]), ], diff --git a/crate/resources/src/states.rs b/crate/resources/src/states.rs index 6a352dc8e..8a5f30f88 100644 --- a/crate/resources/src/states.rs +++ b/crate/resources/src/states.rs @@ -57,7 +57,7 @@ mod states_serde; /// outer layer for whether the item had an entry, and the inner layer for /// whether there was any `State` recorded. /// -/// 4. If we can guarantee the item ID is valid -- an ID of an item in the flow +/// 4. If we can guarantee the item ID is valid -- an ID of a step in the flow /// -- we could remove that outer `Option` layer. Currently we cannot make /// this guarantee, as: /// diff --git a/crate/resources/src/states/states_current.rs b/crate/resources/src/states/states_current.rs index 57788c3ad..13281fa5f 100644 --- a/crate/resources/src/states/states_current.rs +++ b/crate/resources/src/states/states_current.rs @@ -14,7 +14,7 @@ use crate::states::{ /// /// # Implementors /// -/// If an `Item`'s state discovery depends on the `State` of a previous +/// If a `Step`'s state discovery depends on the `State` of a previous /// `Item`, then you should insert the predecessor's state into /// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]: /// diff --git a/crate/resources/src/states/states_current_stored.rs b/crate/resources/src/states/states_current_stored.rs index 5b3b8f5a8..9ee60eff4 100644 --- a/crate/resources/src/states/states_current_stored.rs +++ b/crate/resources/src/states/states_current_stored.rs @@ -19,7 +19,7 @@ use crate::states::{ /// /// # Implementors /// -/// If an `Item`'s state discovery depends on the `State` of a previous +/// If a `Step`'s state discovery depends on the `State` of a previous /// `Item`, then you should insert the predecessor's state into /// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]: /// diff --git a/crate/resources/src/states/states_goal.rs b/crate/resources/src/states/states_goal.rs index e5f0ef8f3..16e3698b9 100644 --- a/crate/resources/src/states/states_goal.rs +++ b/crate/resources/src/states/states_goal.rs @@ -12,7 +12,7 @@ use crate::states::{ /// /// # Implementors /// -/// If an `Item`'s goal state discovery depends on the goal `State` of +/// If a `Step`'s goal state discovery depends on the goal `State` of /// a previous `Item`, then you should insert the predecessor's goal /// state into [`Resources`], and reference that in the subsequent /// `TryFnSpec`'s [`Data`]: diff --git a/crate/resources/src/step_rt_id.rs b/crate/resources/src/step_rt_id.rs index c57a6d832..332a5dccf 100644 --- a/crate/resources/src/step_rt_id.rs +++ b/crate/resources/src/step_rt_id.rs @@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut}; use peace_data::fn_graph::FnId; -/// Runtime identifier for an [`Item`]. [`FnId`] newtype. +/// Runtime identifier for a [`Step`]. [`FnId`] newtype. /// /// This is a cheap identifier to copy around, instead of cloning /// [`ItemId`]. diff --git a/crate/rt_model/src/flow.rs b/crate/rt_model/src/flow.rs index 9a804b64c..993112a7e 100644 --- a/crate/rt_model/src/flow.rs +++ b/crate/rt_model/src/flow.rs @@ -6,7 +6,7 @@ use crate::ItemGraph; /// A flow to manage items. /// -/// A Flow ID is strictly associated with an [`ItemGraph`], as the graph +/// A Flow ID is strictly associated with a [`StepGraph`], as the graph /// contains the definitions to read and write the items' [`State`]s. /// /// [`State`]: peace_cfg::Item::State diff --git a/crate/rt_model/src/outcomes/step_apply.rs b/crate/rt_model/src/outcomes/step_apply.rs index 47b117702..e2c7d9d67 100644 --- a/crate/rt_model/src/outcomes/step_apply.rs +++ b/crate/rt_model/src/outcomes/step_apply.rs @@ -6,7 +6,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use crate::outcomes::{ItemApplyPartial, ItemApplyRt}; -/// Information about an item during an `ApplyCmd` execution. +/// Information about a step during an `ApplyCmd` execution. /// /// This is similar to [`ItemApplyPartial`], with most fields being /// non-optional, and the added `state_applied` field. diff --git a/crate/rt_model/src/outcomes/step_apply_boxed.rs b/crate/rt_model/src/outcomes/step_apply_boxed.rs index b8bacc942..bad5ca247 100644 --- a/crate/rt_model/src/outcomes/step_apply_boxed.rs +++ b/crate/rt_model/src/outcomes/step_apply_boxed.rs @@ -8,7 +8,7 @@ impl From> for ItemApplyBoxed where ItemApply: ItemApplyRt, { - /// Returns an `ItemApplyBoxed` which erases an `ItemApply`'s type + /// Returns a `StepApplyBoxed` which erases a `StepApply`'s type /// parameters. fn from(item_apply: ItemApply) -> Self { Self(Box::new(item_apply)) diff --git a/crate/rt_model/src/outcomes/step_apply_partial.rs b/crate/rt_model/src/outcomes/step_apply_partial.rs index 8747a5100..a16bbb6e1 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial.rs @@ -6,7 +6,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use crate::outcomes::ItemApplyPartialRt; -/// Information about an item during an `ApplyCmd` execution. +/// Information about a step during an `ApplyCmd` execution. /// /// # Design Note /// diff --git a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs index f2f35d588..72e17a971 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs @@ -8,7 +8,7 @@ impl From> for ItemApplyPar where ItemApplyPartial: ItemApplyPartialRt, { - /// Returns an `ItemApplyPartialBoxed` which erases an + /// Returns a `StepApplyPartialBoxed` which erases an /// `ItemApplyPartial`'s type parameters. fn from(item_apply: ItemApplyPartial) -> Self { Self(Box::new(item_apply)) diff --git a/crate/rt_model/src/step_graph_builder.rs b/crate/rt_model/src/step_graph_builder.rs index c579d86ae..74ef36487 100644 --- a/crate/rt_model/src/step_graph_builder.rs +++ b/crate/rt_model/src/step_graph_builder.rs @@ -4,7 +4,7 @@ use peace_data::fn_graph::FnGraphBuilder; use crate::{ItemBoxed, ItemGraph}; -/// Builder for an [`ItemGraph`], `FnGraphBuilder>` +/// Builder for a [`StepGraph`], `FnGraphBuilder>` /// newtype. #[derive(Debug)] pub struct ItemGraphBuilder(FnGraphBuilder>); diff --git a/crate/rt_model/src/step_rt.rs b/crate/rt_model/src/step_rt.rs index 561fe5532..54c11b809 100644 --- a/crate/rt_model/src/step_rt.rs +++ b/crate/rt_model/src/step_rt.rs @@ -70,7 +70,7 @@ pub trait ItemRt: /// whether we should use a string newtype for `ItemId`s, or redesign /// how `Item`s or related types are keyed. /// - /// Note: it is impossible to call this method if an `Item`'s state type has + /// Note: it is impossible to call this method if a `Step`'s state type has /// changed -- it would have failed on deserialization. fn state_eq(&self, state_a: &BoxDtDisplay, state_b: &BoxDtDisplay) -> Result where diff --git a/crate/rt_model_core/src/error.rs b/crate/rt_model_core/src/error.rs index 77173bdda..e78c7c974 100644 --- a/crate/rt_model_core/src/error.rs +++ b/crate/rt_model_core/src/error.rs @@ -109,13 +109,13 @@ pub enum Error { /// /// # Symptoms /// - /// * Provided params specs for an item ID has no corresponding item ID in + /// * Provided params specs for a step ID has no corresponding item ID in /// the flow. - /// * Stored params specs for an item ID has no corresponding item ID in the + /// * Stored params specs for a step ID has no corresponding item ID in the /// flow. - /// * ID of an item in the flow does not have a corresponding provided + /// * ID of a step in the flow does not have a corresponding provided /// params spec. - /// * ID of an item in the flow does not have a corresponding stored params + /// * ID of a step in the flow does not have a corresponding stored params /// spec. /// /// # Causes @@ -502,8 +502,8 @@ pub enum Error { path: PathBuf, }, - /// Error downcasting a `BoxDtDisplay` into an item's concrete state type. - #[error("Error downcasting a `BoxDtDisplay` into an item's concrete state type.")] + /// Error downcasting a `BoxDtDisplay` into a step's concrete state type. + #[error("Error downcasting a `BoxDtDisplay` into a step's concrete state type.")] StateDowncastError( #[cfg_attr(feature = "error_reporting", diagnostic_source)] #[source] diff --git a/crate/rt_model_core/src/error/state_downcast_error.rs b/crate/rt_model_core/src/error/state_downcast_error.rs index 2c8d58cd0..fa859e7ab 100644 --- a/crate/rt_model_core/src/error/state_downcast_error.rs +++ b/crate/rt_model_core/src/error/state_downcast_error.rs @@ -1,6 +1,6 @@ use type_reg::untagged::{BoxDtDisplay, DataType}; -/// Error downcasting a `BoxDtDisplay` into an item's concrete state type. +/// Error downcasting a `BoxDtDisplay` into a step's concrete state type. #[cfg_attr(feature = "error_reporting", derive(miette::Diagnostic))] #[derive(Debug, thiserror::Error)] pub enum StateDowncastError { diff --git a/crate/rt_model_core/src/error/web_error.rs b/crate/rt_model_core/src/error/web_error.rs index e20a01415..bb579305f 100644 --- a/crate/rt_model_core/src/error/web_error.rs +++ b/crate/rt_model_core/src/error/web_error.rs @@ -54,9 +54,9 @@ pub enum WebError { )] SessionStorageNone, - /// Failed to base64 decode an item from browser storage. + /// Failed to base64 decode a step from browser storage. #[error( - "Failed to base64 decode an item in browser storage: `{path}`. Value: `{value}` Error: `{error}`" + "Failed to base64 decode a step in browser storage: `{path}`. Value: `{value}` Error: `{error}`" )] #[cfg_attr( feature = "error_reporting", @@ -71,7 +71,7 @@ pub enum WebError { error: base64::DecodeError, }, - /// Failed to get an item from browser storage. + /// Failed to get a step from browser storage. /// /// This failure mode happens when the `get_item` call to the browser fails. /// @@ -85,7 +85,7 @@ pub enum WebError { /// /// This is because browsers are generally single threaded. The assumption /// would no longer be true if multiple threads are used, e.g. web workers. - #[error("Failed to get an item in browser storage: `{path}`. Error: `{error}`")] + #[error("Failed to get a step in browser storage: `{path}`. Error: `{error}`")] #[cfg_attr( feature = "error_reporting", diagnostic(code(peace_rt_model_web::storage_get_item)) @@ -96,7 +96,7 @@ pub enum WebError { /// Stringified JS error. error: String, }, - /// Failed to set an item in browser storage. + /// Failed to set a step in browser storage. /// /// Note: The original `JsValue` error is converted to a `String` to allow /// this type to be `Send`. @@ -108,7 +108,7 @@ pub enum WebError { /// /// This is because browsers are generally single threaded. The assumption /// would no longer be true if multiple threads are used, e.g. web workers. - #[error("Failed to set an item in browser storage: `{path}`: `{value}`. Error: `{error}`")] + #[error("Failed to set a step in browser storage: `{path}`: `{value}`. Error: `{error}`")] #[cfg_attr( feature = "error_reporting", diagnostic(code(peace_rt_model_web::storage_set_item)) @@ -121,13 +121,13 @@ pub enum WebError { /// Stringified JS error. error: String, }, - /// Failed to remove an item from browser storage. + /// Failed to remove a step from browser storage. /// /// This failure mode happens when the `get_item` call to the browser fails. /// /// Note: The original `JsValue` error is converted to a `String` to allow /// this type to be `Send`. - #[error("Failed to remove an item from browser storage: `{path}`. Error: `{error}`")] + #[error("Failed to remove a step from browser storage: `{path}`. Error: `{error}`")] #[cfg_attr( feature = "error_reporting", diagnostic(code(peace_rt_model_web::storage_remove_item)) diff --git a/crate/rt_model_core/src/state_stored_and_discovered.rs b/crate/rt_model_core/src/state_stored_and_discovered.rs index d2b539ff0..af92fdfa5 100644 --- a/crate/rt_model_core/src/state_stored_and_discovered.rs +++ b/crate/rt_model_core/src/state_stored_and_discovered.rs @@ -1,6 +1,6 @@ use type_reg::untagged::BoxDtDisplay; -/// Stored and/or discovered state for an item. +/// Stored and/or discovered state for a step. #[derive(Clone, Debug)] pub enum StateStoredAndDiscovered { /// Stored state exists, but the actual item state cannot be discovered. diff --git a/crate/rt_model_web/src/storage.rs b/crate/rt_model_web/src/storage.rs index cba2efa95..3b3af2f44 100644 --- a/crate/rt_model_web/src/storage.rs +++ b/crate/rt_model_web/src/storage.rs @@ -74,18 +74,18 @@ impl Storage { Ok(storage) } - /// Returns whether an item exists in the web storage. + /// Returns whether a step exists in the web storage. pub fn contains_item(&self, path: &Path) -> Result { self.get_item_opt(path).map(|item| item.is_some()) } /// Gets an optional item in the web storage. /// - /// * Use [`get_item_opt`] if you would like to fetch an item that may not + /// * Use [`get_item_opt`] if you would like to fetch a step that may not /// exist. /// * Use [`get_items_opt`] if you would like to fetch multiple optional /// items. - /// * Use [`get_item`] if you would like to fetch an item that must exist. + /// * Use [`get_item`] if you would like to fetch a step that must exist. /// * Use [`get_items`] if you would like to fetch multiple items that must /// exist. /// @@ -103,11 +103,11 @@ impl Storage { /// Gets multiple items in the web storage. /// - /// * Use [`get_item_opt`] if you would like to fetch an item that may not + /// * Use [`get_item_opt`] if you would like to fetch a step that may not /// exist. /// * Use [`get_items_opt`] if you would like to fetch multiple optional /// items. - /// * Use [`get_item`] if you would like to fetch an item that must exist. + /// * Use [`get_item`] if you would like to fetch a step that must exist. /// * Use [`get_items`] if you would like to fetch multiple items that must /// exist. /// @@ -137,13 +137,13 @@ impl Storage { Ok(iter) } - /// Gets an item in the web storage. + /// Gets a step in the web storage. /// - /// * Use [`get_item_opt`] if you would like to fetch an item that may not + /// * Use [`get_item_opt`] if you would like to fetch a step that may not /// exist. /// * Use [`get_items_opt`] if you would like to fetch multiple optional /// items. - /// * Use [`get_item`] if you would like to fetch an item that must exist. + /// * Use [`get_item`] if you would like to fetch a step that must exist. /// * Use [`get_items`] if you would like to fetch multiple items that must /// exist. /// @@ -168,7 +168,7 @@ impl Storage { /// Gets a base64 encoded item in the web storage. /// - /// * Use [`get_item_b64_opt`] if you would like to fetch an item that may + /// * Use [`get_item_b64_opt`] if you would like to fetch a step that may /// not exist. /// /// [`get_items`]: Self::get_items @@ -192,7 +192,7 @@ impl Storage { /// Gets a base64 encoded item in the web storage. /// - /// * Use [`get_item_b64_opt`] if you would like to fetch an item that may + /// * Use [`get_item_b64_opt`] if you would like to fetch a step that may /// not exist. /// /// [`get_items`]: Self::get_items @@ -212,11 +212,11 @@ impl Storage { /// Gets multiple items in the web storage. /// - /// * Use [`get_item_opt`] if you would like to fetch an item that may not + /// * Use [`get_item_opt`] if you would like to fetch a step that may not /// exist. /// * Use [`get_items_opt`] if you would like to fetch multiple optional /// items. - /// * Use [`get_item`] if you would like to fetch an item that must exist. + /// * Use [`get_item`] if you would like to fetch a step that must exist. /// * Use [`get_items`] if you would like to fetch multiple items that must /// exist. /// @@ -251,7 +251,7 @@ impl Storage { Ok(iter) } - /// Sets an item in the web storage. + /// Sets a step in the web storage. /// /// See [`set_items`] if you would like to set multiple items. /// @@ -417,7 +417,7 @@ impl Storage { Ok(()) } - /// Deletes an item from the web storage. + /// Deletes a step from the web storage. pub fn remove_item(&self, path: &Path) -> Result<(), Error> { let storage = self.get()?; let key = path.to_string_lossy(); diff --git a/doc/src/ideas.md b/doc/src/ideas.md index 6bed333c0..5c063b861 100644 --- a/doc/src/ideas.md +++ b/doc/src/ideas.md @@ -81,7 +81,7 @@ This may be dependent on profile params – sort env based on env type, last 7. Cancel-safe state storage
-When an item ensure does multiple writes, there is a possibility of not all of those writes occur during execution: +When a step ensure does multiple writes, there is a possibility of not all of those writes occur during execution: * user interrupts the execution. * internet connection drops. @@ -104,9 +104,9 @@ Implementors may add/remove/modify items in flows. Peace needs to be designed such that these changes do not cause already-existent flows to not be loadable, i.e. when: -* `states_*.yaml` contains state for which an item no longer exists in the flow. -* `states_*.yaml` does not contain state for an item that is newly added to the flow. -* `states_*.yaml` contains state whose fields are different to a new version of an item. +* `states_*.yaml` contains state for which a step no longer exists in the flow. +* `states_*.yaml` does not contain state for a step that is newly added to the flow. +* `states_*.yaml` contains state whose fields are different to a new version of a step. This one can be addressed by having `State` be an enum, with versioned variants. @@ -283,7 +283,7 @@ Should we combine all 3 into `FnCtx`? It would make `FnCtx` type parameterized o 17. Style edges / items red when an error occurs.
-When we hit an error, can we go through parameters / states to determine whether the error is to do with an item itself, or a link between the item and its predecessor? +When we hit an error, can we go through parameters / states to determine whether the error is to do with a step itself, or a link between the item and its predecessor? Then style that link red. @@ -337,7 +337,7 @@ This trades 3. AWS SDK does not always include error detail -- S3 `head_object`. ([aws-sdk-rust#227]) 4. Progress output should enable-able for state current / goal discover / clean functions. 5. Flow params are annoying to register every time we add another item. Maybe split end user provided params from item params. -6. Blank item needs a lot of rework to be easier to implement an item. ([67], [#96]) +6. Blank item needs a lot of rework to be easier to implement a step. ([67], [#96]) 7. For `ApplyCmd`, collect `StateCurrent`, `StateGoal`, `StateDiff` in execution report. 8. AWS errors' `code` and `message` should be shown to the user. 9. Progress limit should not be returned in `ApplyFns::check`, but sent through `progress_sender.limit(ProgressLimit)`. This simplifies `check`, and allows state current/goal discovery to set the limits easily. diff --git a/doc/src/technical_concepts.md b/doc/src/technical_concepts.md index 2a2cde228..02bdc1066 100644 --- a/doc/src/technical_concepts.md +++ b/doc/src/technical_concepts.md @@ -5,7 +5,7 @@ The following sections cover essential concepts to develop automation using the 1. **[Resources]**: An any-map, whose values' read and write access are checked at runtime instead of compile time. 2. **[Function graph]**: Functions with logical and data-access-dependent concurrency. 3. **[Item]**: Specification that defines information and logic to manage an *arbitrary item*. -4. **[Item graph]**: Like a function graph, where each node is not just a function, but an item. +4. **[Item graph]**: Like a function graph, where each node is not just a function, but a step. [Function graph]: technical_concepts/function_graph.html [Item graph]: technical_concepts/item_graph.html diff --git a/doc/src/technical_concepts/flow_versioning/seamless_execution.md b/doc/src/technical_concepts/flow_versioning/seamless_execution.md index 3066364d4..c51c6a0a0 100644 --- a/doc/src/technical_concepts/flow_versioning/seamless_execution.md +++ b/doc/src/technical_concepts/flow_versioning/seamless_execution.md @@ -90,14 +90,14 @@ An item upgrade may be one of: Notes: -* It may not be possible to migrate an item to a newer version without cleaning up its successors. +* It may not be possible to migrate a step to a newer version without cleaning up its successors. * It is possible if successors don't "live inside" the item, but only need their parameters changed. * it is not possible if successors live inside the item, and need to be deleted in order to modify the item. -Whether or not a successor needs to be cleaned up likely should be encoded into the `Edge` type, not part of the item upgrade parameters -- an item is unable to know if its successors live inside it or point to it. +Whether or not a successor needs to be cleaned up likely should be encoded into the `Edge` type, not part of the item upgrade parameters -- a step is unable to know if its successors live inside it or point to it. ```rust ,ignore -/// Indicates what is needed for an instance of an item to be upgraded. +/// Indicates what is needed for an instance of a step to be upgraded. enum ItemUpgradeReq { /// Item instance does not need to be upgraded, i.e. only state data type is changed. None, diff --git a/doc/src/technical_concepts/flow_versioning/upgrade_actions.md b/doc/src/technical_concepts/flow_versioning/upgrade_actions.md index ef7224f59..5c8858a0f 100644 --- a/doc/src/technical_concepts/flow_versioning/upgrade_actions.md +++ b/doc/src/technical_concepts/flow_versioning/upgrade_actions.md @@ -12,12 +12,12 @@ The following table shows what is required for ensuring an environment to be in > Notes: > -> * "Data" refers to an item's `Params`, `State`, or `StateDiff`. +> * "Data" refers to a step's `Params`, `State`, or `StateDiff`. > * Apply is associated with params, state, and diff. > > `apply_clean` needs to know `state_clean` based on the parameters used to compute `state_goal` at the time of the previous `apply_goal`. > -> * "Predecessor *action*" means what upgrade action is needed for *this* item, given a predecessor has had *action* applied to it. In other words, the change for an item can imply an upgrade action for successors. +> * "Predecessor *action*" means what upgrade action is needed for *this* item, given a predecessor has had *action* applied to it. In other words, the change for a step can imply an upgrade action for successors. | Change | Upgrade action | |:------------------------------------------|:---------------------------------| diff --git a/doc/src/technical_concepts/output/execution_progress.md b/doc/src/technical_concepts/output/execution_progress.md index f1c545d4d..55bae2c4c 100644 --- a/doc/src/technical_concepts/output/execution_progress.md +++ b/doc/src/technical_concepts/output/execution_progress.md @@ -3,7 +3,7 @@ Execution progress output is most useful as it happens. Execution progress output should fulfill the following concerns: * easy for a human to understand -* easy to be sent from an item implementation +* easy to be sent from a step implementation * pushed to output in real time * pulled from client in real time diff --git a/doc/src/technical_concepts/state.md b/doc/src/technical_concepts/state.md index 280f515fb..1ae5d64e8 100644 --- a/doc/src/technical_concepts/state.md +++ b/doc/src/technical_concepts/state.md @@ -1,9 +1,9 @@ # State -In `peace`, [`State`] represents the values of an item, and has the following usages: +In `peace`, [`State`] represents the values of a step, and has the following usages: -* Showing users the state of an item. -* Allowing users to describe the state that an item should be. +* Showing users the state of a step. +* Allowing users to describe the state that a step should be. * Determining what needs to change between the current state and the goal state. Therefore, `State` should be: @@ -41,27 +41,27 @@ State can be separated into two parts: ### Fully Logical -If an item's state can be fully described before the item exists, and can be made to happen without interacting with an external service, then the state is fully logical. +If a step's state can be fully described before the item exists, and can be made to happen without interacting with an external service, then the state is fully logical. For example, copying a file from one directory to another. The state of the file in the source directory and destination directories are fully discoverable, and there is no information generated during automation that is needed to determine if the states are equivalent. ### Logical and Physical -If an item's goal state can be described before the item exists, but interacts with an external service which produces additional information to bring that goal state into existence, then the state has both logical and physical parts. +If a step's goal state can be described before the item exists, but interacts with an external service which produces additional information to bring that goal state into existence, then the state has both logical and physical parts. For example, launching a server or virtual machine. The operating system, CPU capacity, and RAM are logical information, and can be determined ahead of time. However, the server ID and IP address are produced by the virtual machine service provider, which is physical state. ### Fully Physical -If an item's goal state is simply, "automation has been executed after these files have been modified", then the state has no logical component. +If a step's goal state is simply, "automation has been executed after these files have been modified", then the state has no logical component. For example, running a compilation command only if the compilation artifact doesn't exist, or the source files have changed since the last time the compilation has been executed. --- -The remaining pages in this section explain how to define the logical and physical state types when implementing an item. +The remaining pages in this section explain how to define the logical and physical state types when implementing a step. [`State`]: https://docs.rs/peace_cfg/latest/peace_cfg/state/struct.State.html diff --git a/doc/src/technical_concepts/state/logical_state.md b/doc/src/technical_concepts/state/logical_state.md index 404dc41a0..07c6c29bd 100644 --- a/doc/src/technical_concepts/state/logical_state.md +++ b/doc/src/technical_concepts/state/logical_state.md @@ -1,6 +1,6 @@ # Logical State -Logical state is the part of an item that is: +Logical state is the part of a step that is: * Implementor / user definable * Controllable by automation @@ -33,7 +33,7 @@ let state_diff = state_goal - state_current; ## Discovery Constraints -In an item's parameters, there must be the following categories of information: +In a step's parameters, there must be the following categories of information: * `src`: information of what the item should be, or where to look up that information. @@ -61,7 +61,7 @@ Both `src` and `dest` may reference resources that are ensured by predecessor it 1. `Item::state_goal` functions have to always cater for `src` not being available. - It incurs mental effort to always cater for `src` not being available – i.e. implementing an item would need knowledge beyond itself. + It incurs mental effort to always cater for `src` not being available – i.e. implementing a step would need knowledge beyond itself. 2. the `peace` framework defaults to not running `state_current_fn` for items that have a logical dependency on things that `Item::apply_check` returns `ExecRequired` diff --git a/doc/src/technical_concepts/step.md b/doc/src/technical_concepts/step.md index 7f7e50c12..f503feec7 100644 --- a/doc/src/technical_concepts/step.md +++ b/doc/src/technical_concepts/step.md @@ -167,7 +167,7 @@ Cleans up the item from existence. Readers may notice the function breakdown is `git`-like. The following table compares the concepts: -| Subject | Peace | Git | +| Concept | Peace | Git | |:-----------------------|:-------------------------------------------------------|:-----------------------------------------------------------------------------------------| | Item | Any consumer defined item. | A directory of files. | | Project initialization | `init` command takes in parameters to manage the item. | Uses the current directory or passed in directory. | diff --git a/doc/src/technical_concepts/step/step_parameters.md b/doc/src/technical_concepts/step/step_parameters.md index ec6941069..d7a54f061 100644 --- a/doc/src/technical_concepts/step/step_parameters.md +++ b/doc/src/technical_concepts/step/step_parameters.md @@ -1,6 +1,6 @@ # Item Parameters -For an item to work with different values, the values must be passed in. These values are called item parameters. +For a step to work with different values, the values must be passed in. These values are called item parameters. ```dot process digraph { diff --git a/doc/src/technical_concepts/step/step_parameters/params_specification.md b/doc/src/technical_concepts/step/step_parameters/params_specification.md index f4f6b7610..c791b2a0b 100644 --- a/doc/src/technical_concepts/step/step_parameters/params_specification.md +++ b/doc/src/technical_concepts/step/step_parameters/params_specification.md @@ -1,6 +1,6 @@ # Params Specification -For an item to work with different values, the values must be passed in. +For a step to work with different values, the values must be passed in. Item implementors define these as part of the `Item` trait: diff --git a/doc/src/technical_concepts/step_graph.md b/doc/src/technical_concepts/step_graph.md index ca9d196e0..d1544b6e3 100644 --- a/doc/src/technical_concepts/step_graph.md +++ b/doc/src/technical_concepts/step_graph.md @@ -1,6 +1,6 @@ # Item Graph -An item graph is a [function graph], whose logic type is an [item]. +An item graph is a [function graph], whose logic type is a [step]. Instead of storing a single function in each node of the graph, each logic type is a collection of well-defined functions adhering to the [`Item`][`Item`] trait. diff --git a/steps/tar_x/src/tar_x_error.rs b/steps/tar_x/src/tar_x_error.rs index 673f9f850..6afa0f042 100644 --- a/steps/tar_x/src/tar_x_error.rs +++ b/steps/tar_x/src/tar_x_error.rs @@ -15,7 +15,7 @@ pub enum TarXError { #[cfg_attr( feature = "error_reporting", diagnostic(code(peace_item_tar_x::tar_file_not_exists)), - help("Make sure there is an item that downloads the tar file.") + help("Make sure there is a step that downloads the tar file.") )] TarFileNotExists { /// Path to the tar file to extract. From ff414592d5e98386553fc36868de877b16844eae Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Sat, 1 Jun 2024 19:33:33 +1200 Subject: [PATCH 4/9] Add first half of renaming `item` to `step`. --- Cargo.toml | 16 +- README.md | 12 +- crate/cfg/src/accessors/stored.rs | 12 +- crate/cfg/src/fn_ctx.rs | 14 +- crate/cfg/src/lib.rs | 4 +- crate/cfg/src/state.rs | 12 +- crate/cfg/src/state/external.rs | 2 +- crate/cfg/src/state/external_opt.rs | 2 +- crate/cfg/src/step.rs | 128 ++++---- crate/cli/src/output/cli_md_presenter.rs | 2 +- crate/cli/src/output/cli_output.rs | 50 ++-- crate/cli/src/output/cli_output_builder.rs | 2 +- crate/cmd/src/ctx/cmd_ctx_builder.rs | 94 +++--- crate/cmd/src/scopes/multi_profile_no_flow.rs | 4 +- .../src/scopes/multi_profile_single_flow.rs | 26 +- .../cmd/src/scopes/single_profile_no_flow.rs | 4 +- .../src/scopes/single_profile_single_flow.rs | 26 +- crate/cmd_model/src/cmd_block_outcome.rs | 26 +- crate/cmd_model/src/cmd_outcome.rs | 88 +++--- crate/cmd_model/src/lib.rs | 4 +- crate/cmd_model/src/step_stream_outcome.rs | 78 ++--- .../src/stream_outcome_and_errors.rs | 6 +- .../cmd_model/src/value_and_stream_outcome.rs | 2 +- crate/cmd_rt/src/cmd_block.rs | 22 +- crate/cmd_rt/src/cmd_block/cmd_block_error.rs | 14 +- .../cmd_rt/src/cmd_block/cmd_block_wrapper.rs | 12 +- crate/cmd_rt/src/cmd_execution.rs | 14 +- .../cmd_execution/cmd_execution_builder.rs | 4 +- crate/cmd_rt/src/lib.rs | 4 +- crate/cmd_rt/src/progress.rs | 30 +- .../cmd_rt/src/step_stream_outcome_mapper.rs | 24 +- crate/code_gen/src/cmd/impl_build.rs | 68 ++--- crate/code_gen/src/cmd/impl_common_fns.rs | 10 +- crate/code_gen/src/cmd/scope.rs | 4 +- crate/code_gen/src/cmd/struct_definition.rs | 4 +- crate/core/src/apply_check.rs | 6 +- crate/core/src/lib.rs | 10 +- .../core/src/progress/cmd_progress_update.rs | 6 +- crate/core/src/progress/progress_complete.rs | 2 +- crate/core/src/progress/progress_delta.rs | 2 +- crate/core/src/progress/progress_sender.rs | 18 +- crate/core/src/progress/progress_status.rs | 14 +- crate/core/src/progress/progress_tracker.rs | 2 +- .../src/progress/progress_update_and_id.rs | 8 +- crate/core/src/step_id.rs | 18 +- crate/data/src/accessors.rs | 2 +- crate/data/src/accessors/r_maybe.rs | 4 +- crate/data/src/accessors/w_maybe.rs | 4 +- crate/data/src/data.rs | 18 +- crate/data/src/marker.rs | 6 +- crate/data/src/marker/apply_dry.rs | 2 +- crate/data/src/marker/clean.rs | 2 +- crate/data/src/marker/current.rs | 2 +- crate/data/src/marker/goal.rs | 2 +- crate/data_derive/src/lib.rs | 6 +- crate/flow_model/src/flow_info.rs | 8 +- crate/flow_model/src/flow_spec_info.rs | 90 +++--- crate/flow_model/src/lib.rs | 8 +- crate/flow_model/src/step_info.rs | 18 +- crate/flow_model/src/step_spec_info.rs | 18 +- crate/fmt/src/lib.rs | 4 +- crate/fmt/src/presentable.rs | 6 +- crate/fmt/src/presenter.rs | 8 +- crate/params/src/any_spec_rt.rs | 4 +- crate/params/src/field_wise_spec_rt.rs | 6 +- crate/params/src/lib.rs | 16 +- crate/params/src/mapping_fn_impl.rs | 8 +- crate/params/src/params_spec.rs | 4 +- crate/params/src/params_spec_fieldless.rs | 4 +- crate/params/src/params_specs.rs | 22 +- crate/params/src/value_resolution_ctx.rs | 16 +- crate/params/src/value_spec.rs | 4 +- crate/params/src/value_spec_rt.rs | 2 +- .../src/impl_field_wise_builder.rs | 2 +- .../impl_from_params_for_params_partial.rs | 2 +- ...impl_try_from_params_partial_for_params.rs | 2 +- crate/params_derive/src/lib.rs | 10 +- crate/params_derive/src/util.rs | 4 +- .../resources/src/internal/state_diffs_mut.rs | 22 +- crate/resources/src/internal/states_mut.rs | 26 +- crate/resources/src/lib.rs | 4 +- crate/resources/src/paths.rs | 2 +- .../resources/src/paths/params_specs_file.rs | 2 +- .../src/paths/states_current_file.rs | 2 +- crate/resources/src/paths/states_goal_file.rs | 2 +- crate/resources/src/resources.rs | 4 +- crate/resources/src/resources/ts.rs | 2 +- crate/resources/src/states.rs | 84 +++--- crate/resources/src/states/state_diffs.rs | 18 +- crate/resources/src/states/states_clean.rs | 4 +- crate/resources/src/states/states_cleaned.rs | 2 +- .../src/states/states_cleaned_dry.rs | 2 +- crate/resources/src/states/states_current.rs | 6 +- .../src/states/states_current_stored.rs | 6 +- crate/resources/src/states/states_ensured.rs | 2 +- .../src/states/states_ensured_dry.rs | 2 +- crate/resources/src/states/states_goal.rs | 8 +- .../src/states/states_goal_stored.rs | 4 +- crate/resources/src/states/states_previous.rs | 2 +- crate/resources/src/states/states_serde.rs | 36 +-- crate/resources/src/states/ts.rs | 20 +- crate/resources/src/step_rt_id.rs | 18 +- crate/rt/src/cmd_blocks.rs | 4 +- .../rt/src/cmd_blocks/apply_exec_cmd_block.rs | 186 ++++++------ .../apply_state_sync_check_cmd_block.rs | 98 +++--- crate/rt/src/cmd_blocks/diff_cmd_block.rs | 20 +- .../states_clean_insertion_cmd_block.rs | 16 +- .../states_current_read_cmd_block.rs | 4 +- .../cmd_blocks/states_discover_cmd_block.rs | 188 ++++++------ .../cmd_blocks/states_goal_read_cmd_block.rs | 4 +- crate/rt/src/cmds/clean_cmd.rs | 88 +++--- crate/rt/src/cmds/diff_cmd.rs | 24 +- crate/rt/src/cmds/ensure_cmd.rs | 82 ++--- crate/rt/src/cmds/states_discover_cmd.rs | 66 ++-- crate/rt/src/lib.rs | 2 +- crate/rt_model/src/flow.rs | 32 +- crate/rt_model/src/lib.rs | 16 +- crate/rt_model/src/outcomes.rs | 18 +- crate/rt_model/src/outcomes/step_apply.rs | 22 +- .../rt_model/src/outcomes/step_apply_boxed.rs | 16 +- .../src/outcomes/step_apply_partial.rs | 34 +-- .../src/outcomes/step_apply_partial_boxed.rs | 18 +- .../src/outcomes/step_apply_partial_rt.rs | 10 +- crate/rt_model/src/outcomes/step_apply_rt.rs | 10 +- crate/rt_model/src/params_specs_serializer.rs | 16 +- crate/rt_model/src/params_specs_type_reg.rs | 10 +- crate/rt_model/src/states_serializer.rs | 52 ++-- crate/rt_model/src/states_type_reg.rs | 14 +- crate/rt_model/src/step_boxed.rs | 50 ++-- crate/rt_model/src/step_graph.rs | 42 +-- crate/rt_model/src/step_graph_builder.rs | 30 +- crate/rt_model/src/step_rt.rs | 112 +++---- crate/rt_model/src/step_wrapper.rs | 282 +++++++++--------- .../rt_model_core/src/cmd_progress_tracker.rs | 18 +- crate/rt_model_core/src/error.rs | 98 +++--- .../src/error/apply_cmd_error.rs | 26 +- .../src/error/state_downcast_error.rs | 48 +-- 137 files changed, 1630 insertions(+), 1630 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cfbde3e77..f50243e53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,7 +83,7 @@ ssr = [ [workspace] members = [ "crate/*", - "items", + "steps", "workspace_tests", "examples/*", ] @@ -132,15 +132,15 @@ peace_webi_components = { path = "crate/webi_components", version = "0.0.13" } peace_webi_model = { path = "crate/webi_model", version = "0.0.13" } peace_webi_output = { path = "crate/webi_output", version = "0.0.13" } -# Item crates -peace_items = { path = "items", version = "0.0.13" } +# Step crates +peace_steps = { path = "steps", version = "0.0.13" } -peace_item_blank = { path = "items/blank", version = "0.0.13" } -peace_item_file_download = { path = "items/file_download", version = "0.0.13" } -peace_item_sh_cmd = { path = "items/sh_cmd", version = "0.0.13" } -peace_item_tar_x = { path = "items/tar_x", version = "0.0.13" } +peace_step_blank = { path = "steps/blank", version = "0.0.13" } +peace_step_file_download = { path = "steps/file_download", version = "0.0.13" } +peace_step_sh_cmd = { path = "steps/sh_cmd", version = "0.0.13" } +peace_step_tar_x = { path = "steps/tar_x", version = "0.0.13" } -# Dependencies used by framework and item crates. +# Dependencies used by framework and step crates. # # This does not include examples' dependencies, because we want it to be easy for # developers to see the dependencies to create an automation tool. diff --git a/README.md b/README.md index 6cfdbec60..5a2e5c831 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ See: | 🟣 | Works, "fun idea" | * 🟢 **Idempotent:** Multiple invocations result in the goal outcome. -* 🟢 **Clean:** Every item creation is paired with how it is cleaned up. +* 🟢 **Clean:** Every step defines how to create a resource and how to clean it up. * 🟢 **Understandable:** Progress is shown at an understandable level of detail. * 🔵 **Understandable:** Error reporting is compatible with [`miette`]. * 🟡 **Interruptible:** Execution can be interrupted. @@ -40,7 +40,7 @@ See: * 🟢 **Diffable:** States and diffs are serialized as YAML. * 🟢 **Efficient:** Tasks are concurrently executed via [`fn_graph`]. * 🟢 **Namespaced:** Profile directories isolate environments from each other. -* 🟢 **Type Safe:** Items and parameters are defined in code, not configuration. +* 🟢 **Type Safe:** Steps and parameters are defined in code, not configuration. [`fn_graph`]: https://github.com/azriel91/fn_graph [`miette`]: https://github.com/zkat/miette @@ -48,17 +48,17 @@ See: ### Roadmap -* 🟢 Define items to manage with automation. -* 🟢 Define dependencies between items. +* 🟢 Define steps to manage with automation. +* 🟢 Define dependencies between steps. * 🟢 Define "apply" logic. * 🟢 Define "clean up" logic. * 🟢 Discover current and goal states. * 🟢 Define diff calculation between states. * 🟢 Store and recall parameters across commands. * 🟢 Diff states between multiple profiles. -* 🟢 Type-safe referential parameters -- specify usage of values generated during automation as parameters to subsequent items. +* 🟢 Type-safe referential parameters -- specify usage of values generated during automation as parameters to subsequent steps. * 🟡 Feature-gated incremental functionality. -* 🟡 Off-the-shelf support for common items. +* 🟡 Off-the-shelf support for common steps. * 🟡 Dry run. * 🟣 WASM support. * âš« Cancel-safe interruption via [`tokio-graceful-shutdown`]. diff --git a/crate/cfg/src/accessors/stored.rs b/crate/cfg/src/accessors/stored.rs index bd06692b0..236e868b8 100644 --- a/crate/cfg/src/accessors/stored.rs +++ b/crate/cfg/src/accessors/stored.rs @@ -4,7 +4,7 @@ use std::{ marker::PhantomData, }; -use peace_core::ItemId; +use peace_core::StepId; use peace_data::{ fn_graph::{ resman::{BorrowFail, Ref}, @@ -18,8 +18,8 @@ use serde::Serialize; /// The previously stored `T` state, if any. #[derive(Debug)] pub struct Stored<'borrow, T> { - /// ID of the item the state should be retrieved for. - item_id: &'borrow ItemId, + /// ID of the step the state should be retrieved for. + step_id: &'borrow StepId, /// The borrowed `StatesCurrentStored`. states_current_stored: Option>, /// Marker. @@ -33,7 +33,7 @@ where pub fn get(&'borrow self) -> Option<&'borrow T> { self.states_current_stored .as_ref() - .and_then(|states_current_stored| states_current_stored.get(self.item_id)) + .and_then(|states_current_stored| states_current_stored.get(self.step_id)) } } @@ -41,7 +41,7 @@ impl<'borrow, T> Data<'borrow> for Stored<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { + fn borrow(step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { let states_current_stored = resources .try_borrow::() .map_err(|borrow_fail| match borrow_fail { @@ -53,7 +53,7 @@ where .ok(); Self { - item_id, + step_id, states_current_stored, marker: PhantomData, } diff --git a/crate/cfg/src/fn_ctx.rs b/crate/cfg/src/fn_ctx.rs index bfc1f958a..f5b8f320d 100644 --- a/crate/cfg/src/fn_ctx.rs +++ b/crate/cfg/src/fn_ctx.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use peace_core::ItemId; +use peace_core::StepId; #[cfg(feature = "output_progress")] use peace_core::progress::ProgressSender; @@ -8,9 +8,9 @@ use peace_core::progress::ProgressSender; /// References to pass information between the Peace framework and a step. #[derive(Clone, Copy, Debug)] pub struct FnCtx<'exec> { - /// ID of the item this belongs to. - pub item_id: &'exec ItemId, - /// For items to submit progress updates. + /// ID of the step this belongs to. + pub step_id: &'exec StepId, + /// For steps to submit progress updates. #[cfg(feature = "output_progress")] pub progress_sender: ProgressSender<'exec>, /// Marker. @@ -20,18 +20,18 @@ pub struct FnCtx<'exec> { impl<'exec> FnCtx<'exec> { /// Returns a new `OpCtx`. pub fn new( - item_id: &'exec ItemId, + step_id: &'exec StepId, #[cfg(feature = "output_progress")] progress_sender: ProgressSender<'exec>, ) -> Self { Self { - item_id, + step_id, #[cfg(feature = "output_progress")] progress_sender, marker: PhantomData, } } - /// Returns the `ProgressTracker` for items to send progress to. + /// Returns the `ProgressTracker` for steps to send progress to. #[cfg(feature = "output_progress")] pub fn progress_sender(&self) -> &ProgressSender<'exec> { &self.progress_sender diff --git a/crate/cfg/src/lib.rs b/crate/cfg/src/lib.rs index 2a0e79555..8152cf029 100644 --- a/crate/cfg/src/lib.rs +++ b/crate/cfg/src/lib.rs @@ -10,10 +10,10 @@ pub use peace_core::progress; pub use peace_core::*; -pub use crate::{fn_ctx::FnCtx, item::Item, state::State}; +pub use crate::{fn_ctx::FnCtx, step::Step, state::State}; pub mod accessors; pub mod state; mod fn_ctx; -mod item; +mod step; diff --git a/crate/cfg/src/state.rs b/crate/cfg/src/state.rs index c45975847..3f3e4a202 100644 --- a/crate/cfg/src/state.rs +++ b/crate/cfg/src/state.rs @@ -12,9 +12,9 @@ use std::{any::TypeId, fmt}; use serde::{Deserialize, Serialize}; -/// Logical and physical states of a managed item. +/// Logical and physical states of a resource managed by a step. /// -/// This type can be used when the managed item has both logical and physical +/// This type can be used when the resource has both logical and physical /// states. Otherwise, a type that represents the fully logical / fully physical /// state is sufficient. /// @@ -64,9 +64,9 @@ use serde::{Deserialize, Serialize}; /// /// ### Fully Logical /// -/// If a step's state can be fully described before the item exists, and can be -/// made to happen without interacting with an external service, then the state -/// is fully logical. +/// If a resource's state can be fully described before the resource exists, and +/// can be made to happen without interacting with an external service, then the +/// state is fully logical. /// /// For example, copying a file from one directory to another. The state of the /// file in the source directory and destination directories are fully @@ -76,7 +76,7 @@ use serde::{Deserialize, Serialize}; /// /// ### Logical and Physical /// -/// If a step's goal state can be described before the item exists, but +/// If a step's goal state can be described before the resource exists, but /// interacts with an external service which produces additional information to /// bring that goal state into existence, then the state has both logical and /// physical parts. diff --git a/crate/cfg/src/state/external.rs b/crate/cfg/src/state/external.rs index deba3e6ef..a36af7353 100644 --- a/crate/cfg/src/state/external.rs +++ b/crate/cfg/src/state/external.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; /// value is a bug and must be surfaced as an issue to the user. /// /// The following type aliases are available to semantically name the type in -/// item implementations: +/// step implementations: /// /// * [`Generated`] /// * [`Fetched`] diff --git a/crate/cfg/src/state/external_opt.rs b/crate/cfg/src/state/external_opt.rs index 398badc1d..0d0a05b21 100644 --- a/crate/cfg/src/state/external_opt.rs +++ b/crate/cfg/src/state/external_opt.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; /// the external source has been queried, but it did not return a value. /// /// The following type aliases are available to semantically name the type in -/// item implementations: +/// step implementations: /// /// * [`GeneratedOpt`] /// * [`FetchedOpt`] diff --git a/crate/cfg/src/step.rs b/crate/cfg/src/step.rs index d4d6f03ef..9ed10f917 100644 --- a/crate/cfg/src/step.rs +++ b/crate/cfg/src/step.rs @@ -2,7 +2,7 @@ use std::fmt::{Debug, Display}; use async_trait::async_trait; use dyn_clone::DynClone; -use peace_core::{ApplyCheck, ItemId}; +use peace_core::{ApplyCheck, StepId}; use peace_data::Data; use peace_params::{Params, ParamsSpec}; use peace_resources::{resources::ts::Empty, Resources}; @@ -12,7 +12,7 @@ use crate::FnCtx; /// Defines all of the data and logic to manage a step. /// -/// The item may be simple or complex, ranging from: +/// The step may be simple or complex, ranging from: /// /// * File download. /// * Application installation. @@ -55,17 +55,17 @@ use crate::FnCtx; /// /// [`Data`]: crate::CleanOpSpec::Data #[async_trait(?Send)] -pub trait Item: DynClone { +pub trait Step: DynClone { /// Consumer provided error type. type Error: std::error::Error + Send + Sync; - /// Summary of the managed item's state. + /// Summary of the managed resource's state. /// /// **For an extensive explanation of state, and how to define it, please /// see the [state concept] as well as the [`State`] type.** /// - /// This type is used to represent the current state of the item (if it - /// exists), the goal state of the item (what is intended to exist), and + /// This type is used to represent the current state of the step (if it + /// exists), the goal state of the step (what is intended to exist), and /// is used in the *diff* calculation -- what is the difference between the /// current and goal states. /// @@ -102,18 +102,18 @@ pub trait Item: DynClone { /// [`State`]: Self::State type StateDiff: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static; - /// Parameters to use this item. + /// Parameters to use this step. /// - /// Item consumers must provide for this item to work. + /// Step consumers must provide for this step to work. /// /// # Examples /// - /// * For a file download item: + /// * For a file download step: /// /// - URL of the file. /// - Credentials. /// - /// * For a server launch item: + /// * For a server launch step: /// /// - Image ID. /// - Server size. @@ -131,10 +131,10 @@ pub trait Item: DynClone { + Sync + 'static; - /// Data that the item accesses at runtime. + /// Data that the step accesses at runtime. /// /// These may be objects instantiated in `setup` for use during execution, - /// or information calculated from previous items. + /// or information calculated from previous steps. type Data<'exec>: Data<'exec>; /// Returns the ID of this full spec. @@ -142,16 +142,16 @@ pub trait Item: DynClone { /// # Implementors /// /// The ID should be a unique value that does not change over the lifetime - /// of the managed item. + /// of the managed resource. /// - /// [`ItemId`]s must begin with a letter or underscore, and contain only - /// letters, numbers, and underscores. The [`item_id!`] macro provides + /// [`StepId`]s must begin with a letter or underscore, and contain only + /// letters, numbers, and underscores. The [`step_id!`] macro provides /// a compile time check to ensure that these conditions are upheld. /// /// ```rust - /// # use peace_cfg::{item_id, ItemId}; - /// const fn id() -> ItemId { - /// item_id!("my_item") + /// # use peace_cfg::{step_id, StepId}; + /// const fn id() -> StepId { + /// step_id!("my_step") /// } /// # fn main() { let _id = id(); } /// ``` @@ -161,24 +161,24 @@ pub trait Item: DynClone { /// This is an instance method as logic for a `Step` may be used for /// multiple tasks. For example, a `Step` implemented to download a /// file may be instantiated with different files to download, and each - /// instance of the `Item` should have its own ID. + /// instance of the `Step` should have its own ID. /// - /// [`item_id!`]: peace_static_check_macros::item_id - fn id(&self) -> &ItemId; + /// [`step_id!`]: peace_static_check_macros::step_id + fn id(&self) -> &StepId; /// Inserts an instance of each data type in [`Resources`]. /// /// # Implementors /// /// [`Resources`] is the map of any type, and an instance of each data type - /// must be inserted into the map so that item functions can borrow the + /// must be inserted into the map so that [`Step`] functions can borrow the /// instance of that type. /// /// [`check`]: crate::ApplyFns::check /// [`apply`]: crate::ApplyFns::apply async fn setup(&self, resources: &mut Resources) -> Result<(), Self::Error>; - /// Returns the current state of the managed item, if possible. + /// Returns the current state of the managed resource, if possible. /// /// This should return `Ok(None)` if the state is not able to be queried, /// such as when failing to connect to a remote host, instead of returning @@ -189,7 +189,7 @@ pub trait Item: DynClone { data: Self::Data<'_>, ) -> Result, Self::Error>; - /// Returns the current state of the managed item. + /// Returns the current state of the managed resource. /// /// This is *expected* to successfully discover the current state, so errors /// will be presented to the user. @@ -199,7 +199,7 @@ pub trait Item: DynClone { data: Self::Data<'_>, ) -> Result; - /// Returns the goal state of the managed item, if possible. + /// Returns the goal state of the managed resource, if possible. /// /// This should return `Ok(None)` if the state is not able to be queried, /// such as when failing to read a potentially non-existent file to @@ -210,17 +210,17 @@ pub trait Item: DynClone { data: Self::Data<'_>, ) -> Result, Self::Error>; - /// Returns the goal state of the managed item. + /// Returns the goal state of the managed resource. /// /// This is *expected* to successfully discover the goal state, so errors /// will be presented to the user. /// /// # Examples /// - /// * For a file download item, the goal state could be the destination path + /// * For a file download step, the goal state could be the destination path /// and a content hash. /// - /// * For a web application service item, the goal state could be the web + /// * For a web application service step, the goal state could be the web /// service is running on the latest version. async fn state_goal( fn_ctx: FnCtx<'_>, @@ -241,10 +241,10 @@ pub trait Item: DynClone { /// /// # Examples /// - /// * For a file download item, the difference could be the content hash + /// * For a file download step, the difference could be the content hash /// changes from `abcd` to `efgh`. /// - /// * For a web application service item, the goal state could be the + /// * For a web application service step, the goal state could be the /// application version changing from 1 to 2. async fn state_diff( params_partial: & as Params>::Partial, @@ -257,10 +257,10 @@ pub trait Item: DynClone { /// /// # Implementors /// - /// This should return essentially the `None` concept of the item - /// state. The diff between this and the current state will be shown to the - /// user when they want to see what would be cleaned up by the clean - /// command. + /// This should return essentially the `None` / "work has not been done" + /// variant of the step state. The diff between this and the current + /// state will be shown to the user when they want to see what would be + /// cleaned up by the clean command. async fn state_clean( params_partial: & as Params>::Partial, data: Self::Data<'_>, @@ -273,10 +273,10 @@ pub trait Item: DynClone { /// /// # Examples /// - /// * For a file download item, if the destination file differs from the + /// * For a file download step, if the destination file differs from the /// file on the server, then the file needs to be downloaded. /// - /// * For a web application service item, if the web service is running, but + /// * For a web application service step, if the web service is running, but /// reports a previous version, then the service may need to be restarted. /// /// # Implementors @@ -286,20 +286,20 @@ pub trait Item: DynClone { /// # Parameters /// /// * `fn_ctx`: Context to send progress updates. - /// * `params`: Parameters to the item. + /// * `params`: Parameters to the step. /// * `data`: Runtime data that the function reads from or writes to. - /// * `state_current`: Current [`State`] of the managed item, returned from - /// [`state_current`]. - /// * `state_target`: Target [`State`] of the managed item, either + /// * `state_current`: Current [`State`] of the managed resource, returned + /// from [`state_current`]. + /// * `state_target`: Target [`State`] of the managed resource, either /// [`state_clean`] or [`state_goal`]. - /// * `state_diff`: Goal [`State`] of the managed item, returned from + /// * `state_diff`: Goal [`State`] of the managed resource, returned from /// [`state_diff`]. /// - /// [`state_clean`]: crate::Item::state_clean - /// [`state_current`]: crate::Item::state_current - /// [`state_goal`]: crate::Item::state_goal + /// [`state_clean`]: crate::Step::state_clean + /// [`state_current`]: crate::Step::state_current + /// [`state_goal`]: crate::Step::state_goal /// [`State`]: Self::State - /// [`state_diff`]: crate::Item::state_diff + /// [`state_diff`]: crate::Step::state_diff async fn apply_check( params: &Self::Params<'_>, data: Self::Data<'_>, @@ -319,7 +319,7 @@ pub trait Item: DynClone { /// /// * Where there would be IDs received from an external system, a /// placeholder ID should still be inserted into the runtime data. This - /// should allow subsequent `Item`s that rely on this one to use those + /// should allow subsequent `Step`s that rely on this one to use those /// placeholders in their logic. /// /// # Implementors @@ -329,22 +329,22 @@ pub trait Item: DynClone { /// # Parameters /// /// * `fn_ctx`: Context to send progress updates. - /// * `params`: Parameters to the item. + /// * `params`: Parameters to the step. /// * `data`: Runtime data that the function reads from or writes to. - /// * `state_current`: Current [`State`] of the managed item, returned from - /// [`state_current`]. - /// * `state_target`: Target [`State`] of the managed item, either + /// * `state_current`: Current [`State`] of the managed resource, returned + /// from [`state_current`]. + /// * `state_target`: Target [`State`] of the managed resource, either /// [`state_clean`] or [`state_goal`]. - /// * `state_diff`: Goal [`State`] of the managed item, returned from + /// * `state_diff`: Goal [`State`] of the managed resource, returned from /// [`state_diff`]. /// /// [`check`]: Self::check /// [`ExecRequired`]: crate::ApplyCheck::ExecRequired - /// [`state_clean`]: crate::Item::state_clean - /// [`state_current`]: crate::Item::state_current - /// [`state_goal`]: crate::Item::state_goal + /// [`state_clean`]: crate::Step::state_clean + /// [`state_current`]: crate::Step::state_current + /// [`state_goal`]: crate::Step::state_goal /// [`State`]: Self::State - /// [`state_diff`]: crate::Item::state_diff + /// [`state_diff`]: crate::Step::state_diff async fn apply_dry( fn_ctx: FnCtx<'_>, params: &Self::Params<'_>, @@ -361,22 +361,22 @@ pub trait Item: DynClone { /// # Parameters /// /// * `fn_ctx`: Context to send progress updates. - /// * `params`: Parameters to the item. + /// * `params`: Parameters to the step. /// * `data`: Runtime data that the function reads from or writes to. - /// * `state_current`: Current [`State`] of the managed item, returned from - /// [`state_current`]. - /// * `state_target`: Target [`State`] of the managed item, either + /// * `state_current`: Current [`State`] of the managed resource, returned + /// from [`state_current`]. + /// * `state_target`: Target [`State`] of the managed resource, either /// [`state_clean`] or [`state_goal`]. - /// * `state_diff`: Goal [`State`] of the managed item, returned from + /// * `state_diff`: Goal [`State`] of the managed resource, returned from /// [`state_diff`]. /// /// [`check`]: Self::check /// [`ExecRequired`]: crate::ApplyCheck::ExecRequired - /// [`state_clean`]: crate::Item::state_clean - /// [`state_current`]: crate::Item::state_current - /// [`state_goal`]: crate::Item::state_goal + /// [`state_clean`]: crate::Step::state_clean + /// [`state_current`]: crate::Step::state_current + /// [`state_goal`]: crate::Step::state_goal /// [`State`]: Self::State - /// [`state_diff`]: crate::Item::state_diff + /// [`state_diff`]: crate::Step::state_diff async fn apply( fn_ctx: FnCtx<'_>, params: &Self::Params<'_>, diff --git a/crate/cli/src/output/cli_md_presenter.rs b/crate/cli/src/output/cli_md_presenter.rs index 5bc10ba78..aed5815c6 100644 --- a/crate/cli/src/output/cli_md_presenter.rs +++ b/crate/cli/src/output/cli_md_presenter.rs @@ -122,7 +122,7 @@ where let mut cli_output_in_memory = CliOutput::new_with_writer(&mut buffer); let mut width_buffer_presenter = CliMdPresenter::new(&mut cli_output_in_memory); - // Render the first presentable of all items, so we can determine the maximum + // Render the first presentable of all steps, so we can determine the maximum // width. let (entries, max_width, _width_buffer_presenter, _f) = stream::iter(iterator.map(Result::<_, std::io::Error>::Ok)) diff --git a/crate/cli/src/output/cli_output.rs b/crate/cli/src/output/cli_output.rs index c56d7f1ed..07672e141 100644 --- a/crate/cli/src/output/cli_output.rs +++ b/crate/cli/src/output/cli_output.rs @@ -74,9 +74,9 @@ pub struct CliOutput { /// This is detected on instantiation. #[cfg(feature = "output_progress")] pub(crate) progress_format: CliProgressFormat, - /// Width of the item ID column for progress bars + /// Width of the step ID column for progress bars #[cfg(feature = "output_progress")] - pub(crate) pb_item_id_width: Option, + pub(crate) pb_step_id_width: Option, /// The TTY guard that restores the terminal mode when `CliOutput` is /// dropped. /// @@ -103,7 +103,7 @@ where debug_struct .field("progress_target", &self.progress_target) .field("progress_format", &self.progress_format) - .field("pb_item_id_width", &self.pb_item_id_width); + .field("pb_step_id_width", &self.pb_step_id_width); } debug_struct.field( @@ -198,10 +198,10 @@ where self.progress_format } - /// Returns the number of characters used for the progress bar item ID. + /// Returns the number of characters used for the progress bar step ID. #[cfg(feature = "output_progress")] - pub fn pb_item_id_width(&self) -> Option { - self.pb_item_id_width + pub fn pb_step_id_width(&self) -> Option { + self.pb_step_id_width } async fn output_presentable(&mut self, presentable: P) -> Result<(), E> @@ -349,7 +349,7 @@ where // 17: blue dark (running background) // 208: yellow-orange (stalled) // 220: yellow (interrupted) - // 75: indigo pale (user pending, item id) + // 75: indigo pale (user pending, step id) // 35: green pale (success) // 22: green dark (success background) // 160: red slightly dim (fail) @@ -434,7 +434,7 @@ where } } }; - let prefix_width = self.pb_item_id_width.unwrap_or(20); + let prefix_width = self.pb_step_id_width.unwrap_or(20); let prefix = format!("{{prefix:{prefix_width}}}"); let (progress_is_complete, completion_is_successful) = @@ -475,7 +475,7 @@ where // let mut format_str = format!("{icon} {progress_status:20} {prefix} {bar_or_spinner}"); // ``` - // `prefix` is the item ID. + // `prefix` is the step ID. let mut format_str = format!("{icon} {prefix} {bar_or_spinner}"); if let Some(units) = units { format_str.push_str(units); @@ -525,8 +525,8 @@ where .multi_progress() .set_draw_target(progress_draw_target); - // TODO: test with multiple item IDs of varying length - self.pb_item_id_width = { + // TODO: test with multiple step IDs of varying length + self.pb_step_id_width = { if cmd_progress_tracker.progress_trackers().is_empty() { Some(0) } else { @@ -542,21 +542,21 @@ where }) .unwrap_or(0) }; - let item_id_width = cmd_progress_tracker.progress_trackers().iter().fold( + let step_id_width = cmd_progress_tracker.progress_trackers().iter().fold( 0, - |pb_item_id_width, (item_id, _progress_tracker)| { - std::cmp::max(item_id.len(), pb_item_id_width) + |pb_step_id_width, (step_id, _progress_tracker)| { + std::cmp::max(step_id.len(), pb_step_id_width) }, ); - Some(list_digit_width + item_id_width) + Some(list_digit_width + step_id_width) } }; cmd_progress_tracker .progress_trackers() .iter() .enumerate() - .for_each(|(index, (item_id, progress_tracker))| { + .for_each(|(index, (step_id, progress_tracker))| { let progress_bar = progress_tracker.progress_bar(); // Hack: colourization done in `progress_begin` to get @@ -569,14 +569,14 @@ where .color256(15) .apply_to(format!("{index}.")); // blue - let item_id_colorized = console::Style::new() + let step_id_colorized = console::Style::new() .color256(75) - .apply_to(format!("{item_id}")); + .apply_to(format!("{step_id}")); progress_bar - .set_prefix(format!("{index_colorized} {item_id_colorized}")); + .set_prefix(format!("{index_colorized} {step_id_colorized}")); } CliColorize::Uncolored => { - progress_bar.set_prefix(format!("{index}. {item_id}")); + progress_bar.set_prefix(format!("{index}. {step_id}")); } } @@ -596,9 +596,9 @@ where panic!("`ProgressStyle` template was invalid. Template: `\"\"`. Error: {error}") }); cmd_progress_tracker.progress_trackers().iter().for_each( - |(item_id, progress_tracker)| { + |(step_id, progress_tracker)| { let progress_bar = progress_tracker.progress_bar(); - progress_bar.set_prefix(format!("{item_id}")); + progress_bar.set_prefix(format!("{step_id}")); progress_bar.set_style(progress_style.clone()); }, ); @@ -674,7 +674,7 @@ where // progress information. // // We probably need to send more information in the `ProgressUpdate`, i.e. which - // item it came from. + // step it came from. OutputFormat::Text | OutputFormat::Yaml => { let _progress_display_unused = serde_yaml::to_string(progress_update_and_id).map(|t_serialized| { @@ -698,12 +698,12 @@ where async fn progress_end(&mut self, cmd_progress_tracker: &CmdProgressTracker) { match self.progress_format { CliProgressFormat::ProgressBar => { - self.pb_item_id_width = None; + self.pb_step_id_width = None; // Hack: This should be done with a timer in `ApplyCmd`. // This uses threads, which is not WASM compatible. cmd_progress_tracker.progress_trackers().iter().for_each( - |(_item_id, progress_tracker)| { + |(_step_id, progress_tracker)| { let progress_bar = progress_tracker.progress_bar(); progress_bar.disable_steady_tick(); progress_bar.tick(); diff --git a/crate/cli/src/output/cli_output_builder.rs b/crate/cli/src/output/cli_output_builder.rs index e753817fc..a3aefbd93 100644 --- a/crate/cli/src/output/cli_output_builder.rs +++ b/crate/cli/src/output/cli_output_builder.rs @@ -289,7 +289,7 @@ where #[cfg(feature = "output_progress")] progress_format, #[cfg(feature = "output_progress")] - pb_item_id_width: None, + pb_step_id_width: None, #[cfg(unix)] stdin_tty_with_guard, } diff --git a/crate/cmd/src/ctx/cmd_ctx_builder.rs b/crate/cmd/src/ctx/cmd_ctx_builder.rs index 84169949d..a7feef96a 100644 --- a/crate/cmd/src/ctx/cmd_ctx_builder.rs +++ b/crate/cmd/src/ctx/cmd_ctx_builder.rs @@ -5,7 +5,7 @@ use std::{fmt::Debug, hash::Hash}; use futures::stream::{StreamExt, TryStreamExt}; use interruptible::Interruptibility; use own::{OwnedOrMutRef, OwnedOrRef}; -use peace_cfg::ItemId; +use peace_cfg::StepId; use peace_params::ParamsSpecs; use peace_resources::{ internal::{FlowParamsFile, ProfileParamsFile, WorkspaceParamsFile}, @@ -16,7 +16,7 @@ use peace_resources::{ use peace_rt_model::{ fn_graph::resman::Resource, params::{FlowParams, ProfileParams, WorkspaceParams}, - Flow, ItemGraph, ParamsSpecsSerializer, ParamsSpecsTypeReg, StatesTypeReg, Storage, Workspace, + Flow, StepGraph, ParamsSpecsSerializer, ParamsSpecsTypeReg, StatesTypeReg, Storage, Workspace, WorkspaceInitializer, }; use serde::{de::DeserializeOwned, Serialize}; @@ -140,7 +140,7 @@ where Ok(()) } -/// Serializes item params to storage. +/// Serializes step params to storage. async fn params_specs_serialize( params_specs: &ParamsSpecs, storage: &Storage, @@ -248,23 +248,23 @@ pub(crate) async fn profiles_from_peace_app_dir( Ok(profiles) } -/// Registers each item's `Params` and `State` for stateful +/// Registers each step's `Params` and `State` for stateful /// deserialization. -fn params_and_states_type_reg(item_graph: &ItemGraph) -> (ParamsSpecsTypeReg, StatesTypeReg) +fn params_and_states_type_reg(step_graph: &StepGraph) -> (ParamsSpecsTypeReg, StatesTypeReg) where E: 'static, { - item_graph.iter().fold( + step_graph.iter().fold( (ParamsSpecsTypeReg::new(), StatesTypeReg::new()), - |(mut params_specs_type_reg, mut states_type_reg), item| { - item.params_and_state_register(&mut params_specs_type_reg, &mut states_type_reg); + |(mut params_specs_type_reg, mut states_type_reg), step| { + step.params_and_state_register(&mut params_specs_type_reg, &mut states_type_reg); (params_specs_type_reg, states_type_reg) }, ) } -/// Merges provided item parameters with previously stored item +/// Merges provided step parameters with previously stored step /// parameters. /// /// If a step's parameters are not provided, and nothing was previously @@ -281,86 +281,86 @@ where // precedence. // // We construct a new TypeMap because we want to make sure params specs are - // serialized in order of the items in the graph. - let item_graph = flow.graph(); - let mut params_specs = ParamsSpecs::with_capacity(item_graph.node_count()); + // serialized in order of the steps in the graph. + let step_graph = flow.graph(); + let mut params_specs = ParamsSpecs::with_capacity(step_graph.node_count()); // Collected erroneous data -- parameters may have been valid in the past, but: // - // * item IDs may have changed. - // * items may have been removed, but params specs remain. - // * items may have been added, but params specs forgotten to be added. - let mut item_ids_with_no_params_specs = Vec::::new(); + // * step IDs may have changed. + // * steps may have been removed, but params specs remain. + // * steps may have been added, but params specs forgotten to be added. + let mut step_ids_with_no_params_specs = Vec::::new(); let mut params_specs_stored_mismatches = None; - let mut params_specs_not_usable = Vec::::new(); + let mut params_specs_not_usable = Vec::::new(); if let Some(mut params_specs_stored) = params_specs_stored { - item_graph.iter_insertion().for_each(|item_rt| { - let item_id = item_rt.id(); + step_graph.iter_insertion().for_each(|step_rt| { + let step_id = step_rt.id(); // Removing the entry from stored params specs is deliberate, so filtering for - // stored params specs that no longer have a corresponding item are + // stored params specs that no longer have a corresponding step are // detected. - let params_spec_provided = params_specs_provided.shift_remove_entry(item_id); - let params_spec_stored = params_specs_stored.shift_remove_entry(item_id); + let params_spec_provided = params_specs_provided.shift_remove_entry(step_id); + let params_spec_stored = params_specs_stored.shift_remove_entry(step_id); // Deep merge params specs. let params_spec_to_use = match (params_spec_provided, params_spec_stored) { (None, None) => None, (None, Some(params_spec_stored)) => Some(params_spec_stored), - // Newly added item, or potentially renamed. + // Newly added step, or potentially renamed. (Some(params_spec_provided), None) => Some(params_spec_provided), ( - Some((item_id, mut params_spec_provided)), - Some((_item_id, params_spec_stored)), + Some((step_id, mut params_spec_provided)), + Some((_step_id, params_spec_stored)), ) => { params_spec_provided.merge(&*params_spec_stored); - Some((item_id, params_spec_provided)) + Some((step_id, params_spec_provided)) } }; - if let Some((item_id, params_spec_boxed)) = params_spec_to_use { + if let Some((step_id, params_spec_boxed)) = params_spec_to_use { // `*Spec::MappingFn`s will be present in `params_spec_stored`, but will not // be valid mapping functions as they cannot be serialized / deserialized. // // Also, field wise `ParamsSpec`s may contain `ValueSpec::Stored` for fields // which never had specifications, which are also unusable. if params_spec_boxed.is_usable() { - params_specs.insert_raw(item_id, params_spec_boxed); + params_specs.insert_raw(step_id, params_spec_boxed); } else { - params_specs_not_usable.push(item_id); + params_specs_not_usable.push(step_id); } } else { - // Collect items that do not have parameters. - item_ids_with_no_params_specs.push(item_id.clone()); + // Collect steps that do not have parameters. + step_ids_with_no_params_specs.push(step_id.clone()); } }); - // Stored parameters whose IDs do not correspond to any item IDs in the + // Stored parameters whose IDs do not correspond to any step IDs in the // graph. May be empty. params_specs_stored_mismatches = Some(params_specs_stored); } else { - item_graph.iter_insertion().for_each(|item_rt| { - let item_id = item_rt.id(); + step_graph.iter_insertion().for_each(|step_rt| { + let step_id = step_rt.id(); - if let Some((item_id, params_spec_boxed)) = - params_specs_provided.shift_remove_entry(item_id) + if let Some((step_id, params_spec_boxed)) = + params_specs_provided.shift_remove_entry(step_id) { - params_specs.insert_raw(item_id, params_spec_boxed); + params_specs.insert_raw(step_id, params_spec_boxed); } else { - // Collect items that do not have parameters. - item_ids_with_no_params_specs.push(item_id.clone()); + // Collect steps that do not have parameters. + step_ids_with_no_params_specs.push(step_id.clone()); } }); } - // Provided parameters whose IDs do not correspond to any item IDs in the + // Provided parameters whose IDs do not correspond to any step IDs in the // graph. let params_specs_provided_mismatches = params_specs_provided; - let params_no_issues = item_ids_with_no_params_specs.is_empty() + let params_no_issues = step_ids_with_no_params_specs.is_empty() && params_specs_provided_mismatches.is_empty() && params_specs_stored_mismatches .as_ref() @@ -372,7 +372,7 @@ where Ok(params_specs) } else { Err(peace_rt_model::Error::ParamsSpecsMismatch { - item_ids_with_no_params_specs, + step_ids_with_no_params_specs, params_specs_provided_mismatches, params_specs_stored_mismatches, params_specs_not_usable, @@ -380,18 +380,18 @@ where } } -async fn item_graph_setup( - item_graph: &ItemGraph, +async fn step_graph_setup( + step_graph: &StepGraph, resources: Resources, ) -> Result, E> where E: std::error::Error + 'static, { - let resources = item_graph + let resources = step_graph .stream() .map(Ok::<_, E>) - .try_fold(resources, |mut resources, item| async move { - item.setup(&mut resources).await?; + .try_fold(resources, |mut resources, step| async move { + step.setup(&mut resources).await?; Ok(resources) }) .await?; diff --git a/crate/cmd/src/scopes/multi_profile_no_flow.rs b/crate/cmd/src/scopes/multi_profile_no_flow.rs index 64a4e035c..caa538e2f 100644 --- a/crate/cmd/src/scopes/multi_profile_no_flow.rs +++ b/crate/cmd/src/scopes/multi_profile_no_flow.rs @@ -15,7 +15,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::ctx::CmdCtxTypes; -/// A command that works with multiple profiles, without any items. +/// A command that works with multiple profiles, not scoped to a flow. /// /// ```bash /// path/to/repo/.peace/envman @@ -94,7 +94,7 @@ where >, } -/// A command that works with multiple profiles, without any items. +/// A command that works with multiple profiles, not scoped to a flow. /// /// ```bash /// path/to/repo/.peace/envman diff --git a/crate/cmd/src/scopes/multi_profile_single_flow.rs b/crate/cmd/src/scopes/multi_profile_single_flow.rs index cba3d7416..023dc733a 100644 --- a/crate/cmd/src/scopes/multi_profile_single_flow.rs +++ b/crate/cmd/src/scopes/multi_profile_single_flow.rs @@ -126,16 +126,16 @@ where >, /// Stored current states for each profile for the selected flow. profile_to_states_current_stored: BTreeMap>, - /// Type registry for each item's [`Params`]`::Spec`. + /// Type registry for each step's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Item::Params + /// [`Params`]: peace_cfg::Step::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile params_specs_type_reg: ParamsSpecsTypeReg, - /// Item params specs for each profile for the selected flow. + /// Step params specs for each profile for the selected flow. profile_to_params_specs: BTreeMap>, - /// Type registry for each item's `State`. + /// Type registry for each step's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. @@ -202,16 +202,16 @@ where >, /// Stored current states for each profile for the selected flow. pub profile_to_states_current_stored: &'view BTreeMap>, - /// Type registry for each item's [`Params`]`::Spec`. + /// Type registry for each step's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Item::Params + /// [`Params`]: peace_cfg::Step::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile pub params_specs_type_reg: &'view ParamsSpecsTypeReg, - /// Item params specs for each profile for the selected flow. + /// Step params specs for each profile for the selected flow. pub profile_to_params_specs: &'view BTreeMap>, - /// Type registry for each item's `State`. + /// Type registry for each step's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. @@ -403,7 +403,7 @@ where /// and [`FlowParams`] deserialization. /// /// [`FlowParams`]: peace_rt_model::params::FlowParams - /// [`ItemParams`]: peace_rt_model::ItemParams + /// [`StepParams`]: peace_rt_model::StepParams /// [`ProfileParams`]: peace_rt_model::params::ProfileParams /// [`WorkspaceParams`]: peace_rt_model::params::WorkspaceParams pub fn params_type_regs(&self) -> &ParamsTypeRegs { @@ -418,23 +418,23 @@ where &self.profile_to_states_current_stored } - /// Returns the type registry for each item's [`Params`]`::Spec`. + /// Returns the type registry for each step's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Item::Params + /// [`Params`]: peace_cfg::Step::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile pub fn params_specs_type_reg(&self) -> &ParamsSpecsTypeReg { &self.params_specs_type_reg } - /// Returns the item params specs for each profile for the selected + /// Returns the step params specs for each profile for the selected /// flow. pub fn profile_to_params_specs(&self) -> &BTreeMap> { &self.profile_to_params_specs } - /// Returns the type registry for each item's `State`. + /// Returns the type registry for each step's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. diff --git a/crate/cmd/src/scopes/single_profile_no_flow.rs b/crate/cmd/src/scopes/single_profile_no_flow.rs index 7ad07a042..30eec15f5 100644 --- a/crate/cmd/src/scopes/single_profile_no_flow.rs +++ b/crate/cmd/src/scopes/single_profile_no_flow.rs @@ -15,7 +15,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::ctx::CmdCtxTypes; -/// A command that works with a single profile, without any items. +/// A command that works with a single profile, not scoped to a flow. /// /// ```bash /// path/to/repo/.peace/envman @@ -84,7 +84,7 @@ where >, } -/// A command that works with a single profile, without any items. +/// A command that works with a single profile, not scoped to a flow. /// /// ```bash /// path/to/repo/.peace/envman diff --git a/crate/cmd/src/scopes/single_profile_single_flow.rs b/crate/cmd/src/scopes/single_profile_single_flow.rs index c33a6a0c0..9edc07cd6 100644 --- a/crate/cmd/src/scopes/single_profile_single_flow.rs +++ b/crate/cmd/src/scopes/single_profile_single_flow.rs @@ -101,16 +101,16 @@ where /// Flow params for the selected flow. flow_params: FlowParams<<::FlowParamsKMaybe as KeyMaybe>::Key>, - /// Type registry for each item's [`Params`]`::Spec`. + /// Type registry for each step's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Item::Params + /// [`Params`]: peace_cfg::Step::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile params_specs_type_reg: ParamsSpecsTypeReg, - /// Item params specs for the selected flow. + /// Step params specs for the selected flow. params_specs: ParamsSpecs, - /// Type registry for each item's `State`. + /// Type registry for each step's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. @@ -194,16 +194,16 @@ where pub flow_params: &'view FlowParams< <::FlowParamsKMaybe as KeyMaybe>::Key, >, - /// Type registry for each item's [`Params`]`::Spec`. + /// Type registry for each step's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Item::Params + /// [`Params`]: peace_cfg::Step::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile pub params_specs_type_reg: &'view ParamsSpecsTypeReg, - /// Item params specs for the selected flow. + /// Step params specs for the selected flow. pub params_specs: &'view ParamsSpecs, - /// Type registry for each item's `State`. + /// Type registry for each step's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. @@ -473,29 +473,29 @@ where /// and [`FlowParams`] deserialization. /// /// [`FlowParams`]: peace_rt_model::params::FlowParams - /// [`ItemParams`]: peace_rt_model::ItemParams + /// [`StepParams`]: peace_rt_model::StepParams /// [`ProfileParams`]: peace_rt_model::params::ProfileParams /// [`WorkspaceParams`]: peace_rt_model::params::WorkspaceParams pub fn params_type_regs(&self) -> &ParamsTypeRegs { &self.params_type_regs } - /// Returns the type registry for each item's [`Params`]`::Spec`. + /// Returns the type registry for each step's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Item::Params + /// [`Params`]: peace_cfg::Step::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile pub fn params_specs_type_reg(&self) -> &ParamsSpecsTypeReg { &self.params_specs_type_reg } - /// Returns the item params specs for the selected flow. + /// Returns the step params specs for the selected flow. pub fn params_specs(&self) -> &ParamsSpecs { &self.params_specs } - /// Returns the type registry for each item's `State`. + /// Returns the type registry for each step's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. diff --git a/crate/cmd_model/src/cmd_block_outcome.rs b/crate/cmd_model/src/cmd_block_outcome.rs index 5092d7095..6cc7ddcf6 100644 --- a/crate/cmd_model/src/cmd_block_outcome.rs +++ b/crate/cmd_model/src/cmd_block_outcome.rs @@ -1,6 +1,6 @@ use fn_graph::StreamOutcome; use indexmap::IndexMap; -use peace_cfg::ItemId; +use peace_cfg::StepId; use crate::{StreamOutcomeAndErrors, ValueAndStreamOutcome}; @@ -12,7 +12,7 @@ pub enum CmdBlockOutcome { /// Relevant to command blocks that deal with a single atomic operation, /// e.g. loading a file. Single(T), - /// A value returned per item. + /// A value returned per step. /// /// # Design Note /// @@ -35,19 +35,19 @@ pub enum CmdBlockOutcome { /// having consumers return a `StreamOutcome` allows them to use the /// `FnGraph` streaming methods, without having to split the value out of /// the `StreamOutcome`. - ItemWise { - /// The values returned per item. + StepWise { + /// The values returned per step. stream_outcome: StreamOutcome, /// Errors from the command execution. - errors: IndexMap, + errors: IndexMap, }, } impl CmdBlockOutcome { - /// Returns a new `CmdBlockOutcome::ItemWise` with the given value, and no + /// Returns a new `CmdBlockOutcome::StepWise` with the given value, and no /// errors. - pub fn new_item_wise(stream_outcome: StreamOutcome) -> Self { - Self::ItemWise { + pub fn new_step_wise(stream_outcome: StreamOutcome) -> Self { + Self::StepWise { stream_outcome, errors: IndexMap::new(), } @@ -57,7 +57,7 @@ impl CmdBlockOutcome { pub fn is_ok(&self) -> bool { match self { Self::Single(_) => true, - Self::ItemWise { + Self::StepWise { stream_outcome: _, errors, } => errors.is_empty(), @@ -72,7 +72,7 @@ impl CmdBlockOutcome { value, stream_outcome: None, }), - Self::ItemWise { + Self::StepWise { stream_outcome, errors, } => { @@ -96,7 +96,7 @@ impl CmdBlockOutcome { pub fn is_err(&self) -> bool { match self { Self::Single(_) => false, - Self::ItemWise { + Self::StepWise { stream_outcome: _, errors, } => !errors.is_empty(), @@ -112,12 +112,12 @@ impl CmdBlockOutcome { let u = f(t); CmdBlockOutcome::Single(u) } - Self::ItemWise { + Self::StepWise { stream_outcome, errors, } => { let stream_outcome = stream_outcome.map(f); - CmdBlockOutcome::ItemWise { + CmdBlockOutcome::StepWise { stream_outcome, errors, } diff --git a/crate/cmd_model/src/cmd_outcome.rs b/crate/cmd_model/src/cmd_outcome.rs index 2ee34cfc8..f962bbc90 100644 --- a/crate/cmd_model/src/cmd_outcome.rs +++ b/crate/cmd_model/src/cmd_outcome.rs @@ -1,8 +1,8 @@ use futures::Future; use indexmap::IndexMap; -use peace_cfg::ItemId; +use peace_cfg::StepId; -use crate::{CmdBlockDesc, ItemStreamOutcome}; +use crate::{CmdBlockDesc, StepStreamOutcome}; /// Outcome of a [`CmdExecution`]. /// @@ -25,7 +25,7 @@ pub enum CmdOutcome { /// Execution ended due to an interruption during command block execution. BlockInterrupted { /// The stream outcome of the interrupted command block. - item_stream_outcome: ItemStreamOutcome, + step_stream_outcome: StepStreamOutcome, /// Descriptors of the `CmdBlock`s that were processed. /// /// This does not include the `CmdBlock` that was interrupted. @@ -44,13 +44,13 @@ pub enum CmdOutcome { /// Descriptors of the `CmdBlock`s that were not processed. cmd_blocks_not_processed: Vec, }, - /// Execution ended due to one or more item errors. + /// Execution ended due to one or more step errors. /// /// It is also possible for the stream to be interrupted when an error - /// occurs, so the value is wrapped in a `ItemStreamOutcome`. - ItemError { + /// occurs, so the value is wrapped in a `StepStreamOutcome`. + StepError { /// The outcome value. - item_stream_outcome: ItemStreamOutcome, + step_stream_outcome: StepStreamOutcome, /// Descriptors of the `CmdBlock`s that were processed. /// /// This does not include the `CmdBlock` that erred. @@ -59,8 +59,8 @@ pub enum CmdOutcome { /// /// The first block in this list is the one that erred. cmd_blocks_not_processed: Vec, - /// Item error(s) from the last command block's execution. - errors: IndexMap, + /// Step error(s) from the last command block's execution. + errors: IndexMap, }, } @@ -72,21 +72,21 @@ impl CmdOutcome { cmd_blocks_processed: _, } => Some(value), CmdOutcome::BlockInterrupted { - item_stream_outcome, + step_stream_outcome, cmd_blocks_processed: _, cmd_blocks_not_processed: _, - } => Some(item_stream_outcome.value()), + } => Some(step_stream_outcome.value()), CmdOutcome::ExecutionInterrupted { value, cmd_blocks_processed: _, cmd_blocks_not_processed: _, } => value.as_ref(), - CmdOutcome::ItemError { - item_stream_outcome, + CmdOutcome::StepError { + step_stream_outcome, cmd_blocks_processed: _, cmd_blocks_not_processed: _, errors: _, - } => Some(item_stream_outcome.value()), + } => Some(step_stream_outcome.value()), } } @@ -103,9 +103,9 @@ impl CmdOutcome { ) } - /// Returns whether the command encountered item errors during execution. + /// Returns whether the command encountered step errors during execution. pub fn is_err(&self) -> bool { - matches!(self, Self::ItemError { .. }) + matches!(self, Self::StepError { .. }) } /// Maps the inner value to another, maintaining any collected errors. @@ -125,13 +125,13 @@ impl CmdOutcome { } } Self::BlockInterrupted { - item_stream_outcome, + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } => { - let item_stream_outcome = item_stream_outcome.map(f); + let step_stream_outcome = step_stream_outcome.map(f); CmdOutcome::BlockInterrupted { - item_stream_outcome, + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } @@ -148,15 +148,15 @@ impl CmdOutcome { cmd_blocks_not_processed, } } - Self::ItemError { - item_stream_outcome, + Self::StepError { + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, } => { - let item_stream_outcome = item_stream_outcome.map(f); - CmdOutcome::ItemError { - item_stream_outcome, + let step_stream_outcome = step_stream_outcome.map(f); + CmdOutcome::StepError { + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, @@ -184,15 +184,15 @@ impl CmdOutcome { } } Self::BlockInterrupted { - item_stream_outcome, + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } => { - let (item_stream_outcome, value) = item_stream_outcome.replace(()); + let (step_stream_outcome, value) = step_stream_outcome.replace(()); let value = f(value).await; - let (item_stream_outcome, ()) = item_stream_outcome.replace(value); + let (step_stream_outcome, ()) = step_stream_outcome.replace(value); CmdOutcome::BlockInterrupted { - item_stream_outcome, + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } @@ -212,17 +212,17 @@ impl CmdOutcome { cmd_blocks_not_processed, } } - Self::ItemError { - item_stream_outcome, + Self::StepError { + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, } => { - let (item_stream_outcome, value) = item_stream_outcome.replace(()); + let (step_stream_outcome, value) = step_stream_outcome.replace(()); let value = f(value).await; - let (item_stream_outcome, ()) = item_stream_outcome.replace(value); - CmdOutcome::ItemError { - item_stream_outcome, + let (step_stream_outcome, ()) = step_stream_outcome.replace(value); + CmdOutcome::StepError { + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, @@ -248,16 +248,16 @@ impl CmdOutcome, E> { Err(e) => Err(e), }, Self::BlockInterrupted { - item_stream_outcome, + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } => { - let (item_stream_outcome, value) = item_stream_outcome.replace(()); + let (step_stream_outcome, value) = step_stream_outcome.replace(()); match value { Ok(value) => { - let (item_stream_outcome, ()) = item_stream_outcome.replace(value); + let (step_stream_outcome, ()) = step_stream_outcome.replace(value); Ok(CmdOutcome::BlockInterrupted { - item_stream_outcome, + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, }) @@ -277,18 +277,18 @@ impl CmdOutcome, E> { }), Err(e) => Err(e), }, - Self::ItemError { - item_stream_outcome, + Self::StepError { + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, } => { - let (item_stream_outcome, value) = item_stream_outcome.replace(()); + let (step_stream_outcome, value) = step_stream_outcome.replace(()); match value { Ok(value) => { - let (item_stream_outcome, ()) = item_stream_outcome.replace(value); - Ok(CmdOutcome::ItemError { - item_stream_outcome, + let (step_stream_outcome, ()) = step_stream_outcome.replace(value); + Ok(CmdOutcome::StepError { + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, diff --git a/crate/cmd_model/src/lib.rs b/crate/cmd_model/src/lib.rs index b562e647c..0a3329213 100644 --- a/crate/cmd_model/src/lib.rs +++ b/crate/cmd_model/src/lib.rs @@ -9,7 +9,7 @@ pub use indexmap; pub use crate::{ cmd_block_desc::CmdBlockDesc, cmd_block_outcome::CmdBlockOutcome, cmd_execution_error::CmdExecutionError, cmd_execution_id::CmdExecutionId, - cmd_outcome::CmdOutcome, item_stream_outcome::ItemStreamOutcome, + cmd_outcome::CmdOutcome, step_stream_outcome::StepStreamOutcome, stream_outcome_and_errors::StreamOutcomeAndErrors, value_and_stream_outcome::ValueAndStreamOutcome, }; @@ -19,6 +19,6 @@ mod cmd_block_outcome; mod cmd_execution_error; mod cmd_execution_id; mod cmd_outcome; -mod item_stream_outcome; +mod step_stream_outcome; mod stream_outcome_and_errors; mod value_and_stream_outcome; diff --git a/crate/cmd_model/src/step_stream_outcome.rs b/crate/cmd_model/src/step_stream_outcome.rs index 9f6afcd7d..b0ece1e26 100644 --- a/crate/cmd_model/src/step_stream_outcome.rs +++ b/crate/cmd_model/src/step_stream_outcome.rs @@ -1,66 +1,66 @@ use fn_graph::StreamOutcomeState; -use peace_cfg::ItemId; +use peace_cfg::StepId; /// How a `Flow` stream operation ended and IDs that were processed. /// -/// Currently this is constructed by `ItemStreamOutcomeMapper`. +/// Currently this is constructed by `StepStreamOutcomeMapper`. #[derive(Clone, Debug, PartialEq, Eq)] -pub struct ItemStreamOutcome { +pub struct StepStreamOutcome { /// The value of the outcome. pub value: T, /// How a `Flow` stream operation ended. pub state: StreamOutcomeState, - /// IDs of the items that were processed. - pub item_ids_processed: Vec, - /// IDs of the items that were not processed. - pub item_ids_not_processed: Vec, + /// IDs of the steps that were processed. + pub step_ids_processed: Vec, + /// IDs of the steps that were not processed. + pub step_ids_not_processed: Vec, } -impl ItemStreamOutcome { +impl StepStreamOutcome { /// Returns a `StepStreamOutcome` that is `Finished`. - pub fn finished_with(value: T, item_ids_processed: Vec) -> Self { + pub fn finished_with(value: T, step_ids_processed: Vec) -> Self { Self { value, state: StreamOutcomeState::Finished, - item_ids_processed, - item_ids_not_processed: Vec::new(), + step_ids_processed, + step_ids_not_processed: Vec::new(), } } /// Maps this outcome's value to another. - pub fn map(self, f: impl FnOnce(T) -> TNew) -> ItemStreamOutcome { - let ItemStreamOutcome { + pub fn map(self, f: impl FnOnce(T) -> TNew) -> StepStreamOutcome { + let StepStreamOutcome { value, state, - item_ids_processed, - item_ids_not_processed, + step_ids_processed, + step_ids_not_processed, } = self; let value = f(value); - ItemStreamOutcome { + StepStreamOutcome { value, state, - item_ids_processed, - item_ids_not_processed, + step_ids_processed, + step_ids_not_processed, } } /// Replaces the value from this outcome with another. - pub fn replace(self, value_new: TNew) -> (ItemStreamOutcome, T) { - let ItemStreamOutcome { + pub fn replace(self, value_new: TNew) -> (StepStreamOutcome, T) { + let StepStreamOutcome { value: value_existing, state, - item_ids_processed, - item_ids_not_processed, + step_ids_processed, + step_ids_not_processed, } = self; ( - ItemStreamOutcome { + StepStreamOutcome { value: value_new, state, - item_ids_processed, - item_ids_not_processed, + step_ids_processed, + step_ids_not_processed, }, value_existing, ) @@ -71,22 +71,22 @@ impl ItemStreamOutcome { pub fn replace_with( self, f: impl FnOnce(T) -> (TNew, U), - ) -> (ItemStreamOutcome, U) { - let ItemStreamOutcome { + ) -> (StepStreamOutcome, U) { + let StepStreamOutcome { value, state, - item_ids_processed, - item_ids_not_processed, + step_ids_processed, + step_ids_not_processed, } = self; let (value, extracted) = f(value); ( - ItemStreamOutcome { + StepStreamOutcome { value, state, - item_ids_processed, - item_ids_not_processed, + step_ids_processed, + step_ids_not_processed, }, extracted, ) @@ -108,16 +108,16 @@ impl ItemStreamOutcome { self.state } - pub fn item_ids_processed(&self) -> &[ItemId] { - self.item_ids_processed.as_ref() + pub fn step_ids_processed(&self) -> &[StepId] { + self.step_ids_processed.as_ref() } - pub fn item_ids_not_processed(&self) -> &[ItemId] { - self.item_ids_not_processed.as_ref() + pub fn step_ids_not_processed(&self) -> &[StepId] { + self.step_ids_not_processed.as_ref() } } -impl Default for ItemStreamOutcome +impl Default for StepStreamOutcome where T: Default, { @@ -125,8 +125,8 @@ where Self { value: T::default(), state: StreamOutcomeState::NotStarted, - item_ids_processed: Vec::new(), - item_ids_not_processed: Vec::new(), + step_ids_processed: Vec::new(), + step_ids_not_processed: Vec::new(), } } } diff --git a/crate/cmd_model/src/stream_outcome_and_errors.rs b/crate/cmd_model/src/stream_outcome_and_errors.rs index 852ec4f3d..a503a3748 100644 --- a/crate/cmd_model/src/stream_outcome_and_errors.rs +++ b/crate/cmd_model/src/stream_outcome_and_errors.rs @@ -1,12 +1,12 @@ use fn_graph::StreamOutcome; use indexmap::IndexMap; -use peace_cfg::ItemId; +use peace_cfg::StepId; -/// `CmdBlock` stream outcome and item wise errors. +/// `CmdBlock` stream outcome and step wise errors. #[derive(Clone, Debug, PartialEq, Eq)] pub struct StreamOutcomeAndErrors { /// The `CmdBlock` stream outcome. pub stream_outcome: StreamOutcome, /// The errors during processing, - pub errors: IndexMap, + pub errors: IndexMap, } diff --git a/crate/cmd_model/src/value_and_stream_outcome.rs b/crate/cmd_model/src/value_and_stream_outcome.rs index 17e06f133..10cfb3a48 100644 --- a/crate/cmd_model/src/value_and_stream_outcome.rs +++ b/crate/cmd_model/src/value_and_stream_outcome.rs @@ -5,7 +5,7 @@ use fn_graph::StreamOutcome; pub struct ValueAndStreamOutcome { /// The value returned by the `CmdBlock`. pub value: T, - /// If the block streams each item in its logic, then this contains the + /// If the block streams each step in its logic, then this contains the /// stream outcome. pub stream_outcome: Option>, } diff --git a/crate/cmd_rt/src/cmd_block.rs b/crate/cmd_rt/src/cmd_block.rs index 0f26f53fe..7b2430063 100644 --- a/crate/cmd_rt/src/cmd_block.rs +++ b/crate/cmd_rt/src/cmd_block.rs @@ -22,26 +22,26 @@ mod cmd_block_rt; mod cmd_block_rt_box; mod cmd_block_wrapper; -/// Runs one [`Item::*`] function for one iteration of items. +/// Runs one [`Step::*`] function for one iteration of steps. /// /// A command may consist of: /// /// 1. Discovering the current state of an environment. -/// 2. Ensuring new items that are not blocked, e.g. launch new servers before +/// 2. Ensuring new steps that are not blocked, e.g. launch new servers before /// taking old servers away. -/// 3. Cleaning unused items that block new items from being ensured, e.g. +/// 3. Cleaning unused steps that block new steps from being ensured, e.g. /// terminating servers before resizing a subnet's CIDR block. -/// 4. Ensuring new / modified items that are newly unblocked, e.g. launching +/// 4. Ensuring new / modified steps that are newly unblocked, e.g. launching /// new servers in the resized subnet. -/// 5. Cleaning unused items that are no longer needed, e.g. removing an old +/// 5. Cleaning unused steps that are no longer needed, e.g. removing an old /// service. /// -/// Each of these is an iteration through items, running one of the [`Item::*`] +/// Each of these is an iteration through steps, running one of the [`Step::*`] /// functions. /// /// A `CmdBlock` is the unit of one iteration logic. /// -/// [`Item::*`]: peace_cfg::Item +/// [`Step::*`]: peace_cfg::Step #[async_trait(?Send)] pub trait CmdBlock: Debug { /// Type parameters passed to the `CmdCtx`. @@ -160,19 +160,19 @@ pub trait CmdBlock: Debug { vec![tynm::type_name::()] } - /// Producer function to process all items. + /// Producer function to process all steps. /// /// This is infallible because errors are expected to be returned associated /// with a step. This may change if there are errors that are related to - /// the block that are not associated with a specific item. + /// the block that are not associated with a specific step. /// /// # Implementors /// /// `StreamOutcome<()>` should be returned if the `CmdBlock` streams the - /// items, as this captures whether or not the block execution was + /// steps, as this captures whether or not the block execution was /// interrupted. /// - /// If the block does not stream items, `None` should be returned. + /// If the block does not stream steps, `None` should be returned. async fn exec( &self, input: Self::InputT, diff --git a/crate/cmd_rt/src/cmd_block/cmd_block_error.rs b/crate/cmd_rt/src/cmd_block/cmd_block_error.rs index c4f9a031a..7ec1b507b 100644 --- a/crate/cmd_rt/src/cmd_block/cmd_block_error.rs +++ b/crate/cmd_rt/src/cmd_block/cmd_block_error.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use fn_graph::StreamOutcome; use indexmap::IndexMap; -use peace_cfg::ItemId; +use peace_cfg::StepId; use peace_resources::ResourceFetchError; /// Error while executing a `CmdBlock`. @@ -35,19 +35,19 @@ where /// Error originated from `CmdBlock` exec code. #[error("`CmdBlock` block execution or collation logic failed.")] Exec(E), - /// Error originated from at least one item. + /// Error originated from at least one step. /// /// The `CmdBlock::Outcome` is mapped to the `ExecutionOutcome` using /// `fn_partial_exec_handler`. - #[error("`CmdBlock` item logic failed.")] - ItemError { + #[error("`CmdBlock` step logic failed.")] + StepError { /// The outcome value. stream_outcome: StreamOutcome, - /// Item error(s) from the last command block's execution. - errors: IndexMap, + /// Step error(s) from the last command block's execution. + errors: IndexMap, }, /// An interrupt signal was received while the `CmdBlock` was executing. - #[error("`CmdBlock` item logic failed.")] + #[error("`CmdBlock` step logic failed.")] Interrupt { /// The stream outcome of the interrupted command block. stream_outcome: StreamOutcome, diff --git a/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs b/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs index 1bd33d5fd..adb63362c 100644 --- a/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs +++ b/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs @@ -24,7 +24,7 @@ cfg_if::cfg_if! { /// * Being in the `peace_cmd` crate, the type erased [`CmdBlockRt`] trait can /// be implemented on this type within this crate. /// * The partial execution handler specifies how a command execution should -/// finish, if execution is interrupted or there is an error with one item +/// finish, if execution is interrupted or there is an error with one step /// within the flow. /// /// [`CmdBlockRt`]: crate::CmdBlockRt @@ -111,7 +111,7 @@ where cmd_block.outcome_insert(cmd_view.resources, block_outcome); Ok(()) } - CmdBlockOutcome::ItemWise { + CmdBlockOutcome::StepWise { stream_outcome, errors, } => { @@ -140,11 +140,11 @@ where } } } else { - // If possible, `CmdBlock` outcomes with item errors need to be mapped to - // the `CmdExecution` outcome type, so we still return the item errors. + // If possible, `CmdBlock` outcomes with step errors need to be mapped to + // the `CmdExecution` outcome type, so we still return the step errors. // // e.g. `StatesCurrentMut` should be mapped into `StatesEnsured` when some - // items fail to be ensured. + // steps fail to be ensured. // // Note, when discovering current and goal states for diffing, and a step // error occurs, mapping the partially accumulated `(StatesCurrentMut, @@ -152,7 +152,7 @@ where // meaningful. let stream_outcome = stream_outcome.map(self.fn_partial_exec_handler); - Err(CmdBlockError::ItemError { + Err(CmdBlockError::StepError { stream_outcome, errors, }) diff --git a/crate/cmd_rt/src/cmd_execution.rs b/crate/cmd_rt/src/cmd_execution.rs index 52c1f0bde..a3e309485 100644 --- a/crate/cmd_rt/src/cmd_execution.rs +++ b/crate/cmd_rt/src/cmd_execution.rs @@ -11,7 +11,7 @@ use peace_cmd::{ use peace_cmd_model::{CmdBlockDesc, CmdOutcome}; use peace_resources::{resources::ts::SetUp, Resources}; -use crate::{CmdBlockError, CmdBlockRtBox, ItemStreamOutcomeMapper}; +use crate::{CmdBlockError, CmdBlockRtBox, StepStreamOutcomeMapper}; cfg_if::cfg_if! { if #[cfg(feature = "output_progress")] { @@ -353,7 +353,7 @@ where } CmdBlockError::Exec(error) => Err(error), CmdBlockError::Interrupt { stream_outcome } => { - let item_stream_outcome = ItemStreamOutcomeMapper::map(flow, stream_outcome); + let step_stream_outcome = StepStreamOutcomeMapper::map(flow, stream_outcome); let cmd_blocks_processed = cmd_blocks .range(0..cmd_block_index) .map(|cmd_block_rt| cmd_block_rt.cmd_block_desc()) @@ -364,18 +364,18 @@ where .map(|cmd_block_rt| cmd_block_rt.cmd_block_desc()) .collect::>(); let cmd_outcome = CmdOutcome::BlockInterrupted { - item_stream_outcome, + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, }; Ok(cmd_outcome) } - CmdBlockError::ItemError { + CmdBlockError::StepError { stream_outcome, errors, } => { - let item_stream_outcome = ItemStreamOutcomeMapper::map(flow, stream_outcome); + let step_stream_outcome = StepStreamOutcomeMapper::map(flow, stream_outcome); let cmd_blocks_processed = cmd_blocks .range(0..cmd_block_index) .map(|cmd_block_rt| cmd_block_rt.cmd_block_desc()) @@ -386,8 +386,8 @@ where .map(|cmd_block_rt| cmd_block_rt.cmd_block_desc()) .collect::>(); - let cmd_outcome = CmdOutcome::ItemError { - item_stream_outcome, + let cmd_outcome = CmdOutcome::StepError { + step_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, diff --git a/crate/cmd_rt/src/cmd_execution/cmd_execution_builder.rs b/crate/cmd_rt/src/cmd_execution/cmd_execution_builder.rs index 9b0f89dde..c3a83371f 100644 --- a/crate/cmd_rt/src/cmd_execution/cmd_execution_builder.rs +++ b/crate/cmd_rt/src/cmd_execution/cmd_execution_builder.rs @@ -23,7 +23,7 @@ where /// /// This is intended for `*Cmd`s that do not have meaningful progress to /// render, such as deserializing a single file on disk, and there is no - /// benefit to presenting empty progress bars for each item to the user + /// benefit to presenting empty progress bars for each step to the user /// /// Defaults to `true`. #[cfg(feature = "output_progress")] @@ -91,7 +91,7 @@ where /// /// This is intended for `*Cmd`s that do not have meaningful progress to /// render, such as deserializing a single file on disk, and there is no - /// benefit to presenting empty progress bars for each item to the user. + /// benefit to presenting empty progress bars for each step to the user. /// /// When this method is called multiple times, the last call wins. #[cfg(feature = "output_progress")] diff --git a/crate/cmd_rt/src/lib.rs b/crate/cmd_rt/src/lib.rs index 7c19a9ed7..ca26dd376 100644 --- a/crate/cmd_rt/src/lib.rs +++ b/crate/cmd_rt/src/lib.rs @@ -7,12 +7,12 @@ pub use tynm; pub use crate::{ cmd_block::{CmdBlock, CmdBlockError, CmdBlockRt, CmdBlockRtBox, CmdBlockWrapper}, cmd_execution::{CmdExecution, CmdExecutionBuilder}, - item_stream_outcome_mapper::ItemStreamOutcomeMapper, + step_stream_outcome_mapper::StepStreamOutcomeMapper, }; mod cmd_block; mod cmd_execution; -mod item_stream_outcome_mapper; +mod step_stream_outcome_mapper; cfg_if::cfg_if! { if #[cfg(feature = "output_progress")] { diff --git a/crate/cmd_rt/src/progress.rs b/crate/cmd_rt/src/progress.rs index 5f120d45e..a2bd75d7d 100644 --- a/crate/cmd_rt/src/progress.rs +++ b/crate/cmd_rt/src/progress.rs @@ -6,7 +6,7 @@ use peace_cfg::{ CmdProgressUpdate, ProgressDelta, ProgressMsgUpdate, ProgressStatus, ProgressTracker, ProgressUpdate, ProgressUpdateAndId, }, - ItemId, + StepId, }; use peace_rt_model::{output::OutputWrite, IndexMap}; use tokio::sync::mpsc::Receiver; @@ -18,7 +18,7 @@ impl Progress { // TODO: write test for this pub async fn progress_render( output: &mut O, - progress_trackers: &mut IndexMap, + progress_trackers: &mut IndexMap, mut cmd_progress_rx: Receiver, ) where O: OutputWrite, @@ -32,14 +32,14 @@ impl Progress { async fn handle_cmd_progress_update( output: &mut O, - progress_trackers: &mut IndexMap, + progress_trackers: &mut IndexMap, cmd_progress_update: CmdProgressUpdate, ) -> ControlFlow<()> where O: OutputWrite, { match cmd_progress_update { - CmdProgressUpdate::Item { + CmdProgressUpdate::Step { progress_update_and_id, } => { Self::handle_progress_update_and_id( @@ -53,10 +53,10 @@ impl Progress { } CmdProgressUpdate::Interrupt => { stream::iter(progress_trackers.iter_mut()) - .fold(output, |output, (item_id, progress_tracker)| async move { - let item_id = item_id.clone(); + .fold(output, |output, (step_id, progress_tracker)| async move { + let step_id = step_id.clone(); let progress_update_and_id = ProgressUpdateAndId { - item_id, + step_id, progress_update: ProgressUpdate::Interrupt, msg_update: ProgressMsgUpdate::NoChange, }; @@ -76,10 +76,10 @@ impl Progress { } CmdProgressUpdate::ResetToPending => { stream::iter(progress_trackers.iter_mut()) - .fold(output, |output, (item_id, progress_tracker)| async move { - let item_id = item_id.clone(); + .fold(output, |output, (step_id, progress_tracker)| async move { + let step_id = step_id.clone(); let progress_update_and_id = ProgressUpdateAndId { - item_id, + step_id, progress_update: ProgressUpdate::ResetToPending, msg_update: ProgressMsgUpdate::Clear, }; @@ -102,14 +102,14 @@ impl Progress { async fn handle_progress_update_and_id( output: &mut O, - progress_trackers: &mut IndexMap, + progress_trackers: &mut IndexMap, progress_update_and_id: ProgressUpdateAndId, ) where O: OutputWrite, { - let item_id = &progress_update_and_id.item_id; - let Some(progress_tracker) = progress_trackers.get_mut(item_id) else { - panic!("Expected `progress_tracker` to exist for item: `{item_id}`."); + let step_id = &progress_update_and_id.step_id; + let Some(progress_tracker) = progress_trackers.get_mut(step_id) else { + panic!("Expected `progress_tracker` to exist for step: `{step_id}`."); }; Self::handle_progress_tracker_progress_update( @@ -128,7 +128,7 @@ impl Progress { O: OutputWrite, { let ProgressUpdateAndId { - item_id: _, + step_id: _, progress_update, msg_update, } = &progress_update_and_id; diff --git a/crate/cmd_rt/src/step_stream_outcome_mapper.rs b/crate/cmd_rt/src/step_stream_outcome_mapper.rs index 3e7a55aa4..163d0e1ad 100644 --- a/crate/cmd_rt/src/step_stream_outcome_mapper.rs +++ b/crate/cmd_rt/src/step_stream_outcome_mapper.rs @@ -1,5 +1,5 @@ use fn_graph::StreamOutcome; -use peace_cmd_model::ItemStreamOutcome; +use peace_cmd_model::StepStreamOutcome; use peace_rt_model::Flow; /// Maps a `StreamOutcome` to a `StepStreamOutcome`. @@ -16,11 +16,11 @@ use peace_rt_model::Flow; /// / v /// rt_model_core /// ``` -pub struct ItemStreamOutcomeMapper; +pub struct StepStreamOutcomeMapper; -impl ItemStreamOutcomeMapper { - /// Maps `FnId`s into `ItemId`s for a better information abstraction level. - pub fn map(flow: &Flow, stream_outcome: StreamOutcome) -> ItemStreamOutcome +impl StepStreamOutcomeMapper { + /// Maps `FnId`s into `StepId`s for a better information abstraction level. + pub fn map(flow: &Flow, stream_outcome: StreamOutcome) -> StepStreamOutcome where E: 'static, { @@ -31,30 +31,30 @@ impl ItemStreamOutcomeMapper { fn_ids_not_processed, } = stream_outcome; - let item_ids_processed = fn_ids_processed + let step_ids_processed = fn_ids_processed .into_iter() .filter_map(|fn_id| { flow.graph() .node_weight(fn_id) - .map(|item| item.id()) + .map(|step| step.id()) .cloned() }) .collect::>(); - let item_ids_not_processed = fn_ids_not_processed + let step_ids_not_processed = fn_ids_not_processed .into_iter() .filter_map(|fn_id| { flow.graph() .node_weight(fn_id) - .map(|item| item.id()) + .map(|step| step.id()) .cloned() }) .collect::>(); - ItemStreamOutcome { + StepStreamOutcome { value, state, - item_ids_processed, - item_ids_not_processed, + step_ids_processed, + step_ids_not_processed, } } } diff --git a/crate/code_gen/src/cmd/impl_build.rs b/crate/code_gen/src/cmd/impl_build.rs index 239ef320b..3e1c07a7f 100644 --- a/crate/code_gen/src/cmd/impl_build.rs +++ b/crate/code_gen/src/cmd/impl_build.rs @@ -549,7 +549,7 @@ fn impl_build_for( // .await?; #flow_params_serialize - // Track items in memory. + // Track steps in memory. let mut resources = peace_resources::Resources::new(); // === WorkspaceParamsSelected === // // crate::ctx::cmd_ctx_builder::workspace_params_insert(workspace_params, &mut resources); @@ -600,10 +600,10 @@ fn impl_build_for( // === MultiProfileSingleFlow === // // let flow_id = flow.flow_id(); - // let item_graph = flow.graph(); + // let step_graph = flow.graph(); // // let (params_specs_type_reg, states_type_reg) = - // crate::ctx::cmd_ctx_builder::params_and_states_type_reg(item_graph); + // crate::ctx::cmd_ctx_builder::params_and_states_type_reg(step_graph); // // let params_specs_type_reg_ref = ¶ms_specs_type_reg; // let profile_to_params_specs = futures::stream::iter( @@ -682,20 +682,20 @@ fn impl_build_for( // >() // .await?; // - // // Call each `Item`'s initialization function. - // let resources = crate::ctx::cmd_ctx_builder::item_graph_setup( - // item_graph, + // // Call each `Step`'s initialization function. + // let resources = crate::ctx::cmd_ctx_builder::step_graph_setup( + // step_graph, // resources // ) // .await?; // // === SingleProfileSingleFlow === // - // // Set up resources for the flow's item graph + // // Set up resources for the flow's step graph // let flow_id = flow.flow_id(); - // let item_graph = flow.graph(); + // let step_graph = flow.graph(); // // let (params_specs_type_reg, states_type_reg) = - // crate::ctx::cmd_ctx_builder::params_and_states_type_reg(item_graph); + // crate::ctx::cmd_ctx_builder::params_and_states_type_reg(step_graph); // // // Params specs loading and storage. // let params_specs_type_reg_ref = ¶ms_specs_type_reg; @@ -741,9 +741,9 @@ fn impl_build_for( // resources.insert(states_current_stored); // } // - // // Call each `Item`'s initialization function. - // let resources = crate::ctx::cmd_ctx_builder::item_graph_setup( - // item_graph, + // // Call each `Step`'s initialization function. + // let resources = crate::ctx::cmd_ctx_builder::step_graph_setup( + // step_graph, // resources // ) // .await?; @@ -754,12 +754,12 @@ fn impl_build_for( // let multi_progress = indicatif::MultiProgress::with_draw_target( // indicatif::ProgressDrawTarget::hidden() // ); - // let progress_trackers = item_graph.iter_insertion().fold( - // peace_rt_model::IndexMap::with_capacity(item_graph.node_count()), - // |mut progress_trackers, item| { + // let progress_trackers = step_graph.iter_insertion().fold( + // peace_rt_model::IndexMap::with_capacity(step_graph.node_count()), + // |mut progress_trackers, step| { // let progress_bar = multi_progress.add(indicatif::ProgressBar::hidden()); // let progress_tracker = peace_core::progress::ProgressTracker::new(progress_bar); - // progress_trackers.insert(item.id().clone(), progress_tracker); + // progress_trackers.insert(step.id().clone(), progress_tracker); // progress_trackers // }, // ); @@ -1600,17 +1600,17 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream proc_macro2::TokenStream::new() } Scope::MultiProfileSingleFlow => { - // * Reads previous item params and stores them in a `Map`. + // * Reads previous step params and stores them in a `Map`. // * Reads previously stored current states and stores them in a `Map`. // // These are then held in the scope for easy access for consumers. quote! { let flow_id = flow.flow_id(); - let item_graph = flow.graph(); + let step_graph = flow.graph(); let (params_specs_type_reg, states_type_reg) = - crate::ctx::cmd_ctx_builder::params_and_states_type_reg(item_graph); + crate::ctx::cmd_ctx_builder::params_and_states_type_reg(step_graph); let params_specs_type_reg_ref = ¶ms_specs_type_reg; let profile_to_params_specs = futures::stream::iter( @@ -1689,9 +1689,9 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream >() .await?; - // Call each `Item`'s initialization function. - let resources = crate::ctx::cmd_ctx_builder::item_graph_setup( - item_graph, + // Call each `Step`'s initialization function. + let resources = crate::ctx::cmd_ctx_builder::step_graph_setup( + step_graph, resources ) .await?; @@ -1703,24 +1703,24 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream // // It is not possible to insert stored current states into resources when // running a command with multiple flows, as the flows will have - // different items and their state (type)s will be different. + // different steps and their state (type)s will be different. // // An example is workspace initialization, where the stored current states per - // item for workspace initialization are likely different to application + // step for workspace initialization are likely different to application // specific flows. // // We currently don't support inserting resources for `MultiProfileSingleFlow` // commands. That would require either multiple `Resources` maps, or a // `Resources` map that contains `Map`. // - // It also requires multiple item graph setups to work without conflicting + // It also requires multiple step graph setups to work without conflicting // with each other. quote! { let flow_id = flow.flow_id(); - let item_graph = flow.graph(); + let step_graph = flow.graph(); let (params_specs_type_reg, states_type_reg) = - crate::ctx::cmd_ctx_builder::params_and_states_type_reg(item_graph); + crate::ctx::cmd_ctx_builder::params_and_states_type_reg(step_graph); // Params specs loading and storage. let params_specs_type_reg_ref = ¶ms_specs_type_reg; @@ -1766,9 +1766,9 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream resources.insert(states_current_stored); } - // Call each `Item`'s initialization function. - let resources = crate::ctx::cmd_ctx_builder::item_graph_setup( - item_graph, + // Call each `Step`'s initialization function. + let resources = crate::ctx::cmd_ctx_builder::step_graph_setup( + step_graph, resources ) .await?; @@ -1779,12 +1779,12 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream let multi_progress = indicatif::MultiProgress::with_draw_target( indicatif::ProgressDrawTarget::hidden() ); - let progress_trackers = item_graph.iter_insertion().fold( - peace_rt_model::IndexMap::with_capacity(item_graph.node_count()), - |mut progress_trackers, item| { + let progress_trackers = step_graph.iter_insertion().fold( + peace_rt_model::IndexMap::with_capacity(step_graph.node_count()), + |mut progress_trackers, step| { let progress_bar = multi_progress.add(indicatif::ProgressBar::hidden()); let progress_tracker = peace_core::progress::ProgressTracker::new(progress_bar); - progress_trackers.insert(item.id().clone(), progress_tracker); + progress_trackers.insert(step.id().clone(), progress_tracker); progress_trackers }, ); diff --git a/crate/code_gen/src/cmd/impl_common_fns.rs b/crate/code_gen/src/cmd/impl_common_fns.rs index aaeceb90b..99e4af8c6 100644 --- a/crate/code_gen/src/cmd/impl_common_fns.rs +++ b/crate/code_gen/src/cmd/impl_common_fns.rs @@ -36,17 +36,17 @@ pub fn impl_common_fns(scope_struct: &ScopeStruct) -> proc_macro2::TokenStream { common_fns.extend(quote! { /// Sets a step's parameters. /// - /// Note: this **must** be called for each item in the flow. - pub fn with_item_params( + /// Note: this **must** be called for each step in the flow. + pub fn with_step_params( mut self, - item_id: peace_cfg::ItemId, + step_id: peace_cfg::StepId, params_spec: as peace_params::Params>::Spec, ) -> Self where - I: peace_cfg::Item, + I: peace_cfg::Step, AppError: From, { - self.scope_builder.params_specs_provided.insert(item_id, params_spec); + self.scope_builder.params_specs_provided.insert(step_id, params_spec); self } }); diff --git a/crate/code_gen/src/cmd/scope.rs b/crate/code_gen/src/cmd/scope.rs index d40d0578d..81b5ddbd9 100644 --- a/crate/code_gen/src/cmd/scope.rs +++ b/crate/code_gen/src/cmd/scope.rs @@ -6,13 +6,13 @@ use crate::cmd::{FlowCount, ProfileCount}; #[allow(clippy::enum_variant_names)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Scope { - /// A command that works with multiple profiles, without any items. + /// A command that works with multiple profiles, not scoped to a flow. MultiProfileNoFlow, /// A command that works with multiple profiles, and a single flow. MultiProfileSingleFlow, /// A command that only works with workspace parameters. NoProfileNoFlow, - /// A command that works with a single profile, without any items. + /// A command that works with a single profile, not scoped to a flow. SingleProfileNoFlow, /// A command that works with one profile and one flow. SingleProfileSingleFlow, diff --git a/crate/code_gen/src/cmd/struct_definition.rs b/crate/code_gen/src/cmd/struct_definition.rs index f4b2c53c6..02818ae60 100644 --- a/crate/code_gen/src/cmd/struct_definition.rs +++ b/crate/code_gen/src/cmd/struct_definition.rs @@ -37,7 +37,7 @@ use crate::cmd::scope_struct::ScopeStruct; /// pub(crate) profile_params_selection: CmdCtxBuilderTypesT::ProfileParamsSelection, /// /// Flow parameters. /// pub(crate) flow_params_selection: CmdCtxBuilderTypesT::FlowParamsSelection, -/// /// Map of item ID to its parameters. `TypeMap` newtype. +/// /// Map of step ID to its parameters. `TypeMap` newtype. /// pub(crate) params_specs_provided: peace_params::ParamsSpecs, /// } /// ``` @@ -129,7 +129,7 @@ mod fields { pub fn params_specs_push(fields_named: &mut FieldsNamed, scope: Scope) { if scope.flow_count() == FlowCount::One { let fields_params_specs: FieldsNamed = parse_quote!({ - /// Map of item ID to its parameters. `TypeMap` newtype. + /// Map of step ID to its parameters. `TypeMap` newtype. pub(crate) params_specs_provided: peace_params::ParamsSpecs }); fields_named.named.extend(fields_params_specs.named); diff --git a/crate/core/src/apply_check.rs b/crate/core/src/apply_check.rs index aaa860aa0..36c0cc24b 100644 --- a/crate/core/src/apply_check.rs +++ b/crate/core/src/apply_check.rs @@ -6,15 +6,15 @@ use crate::progress::ProgressLimit; /// Whether the `apply` function needs to be executed. #[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum ApplyCheck { - /// Item is not in goal state. + /// Step is not in goal state. #[cfg(not(feature = "output_progress"))] ExecRequired, - /// Item is not in goal state. + /// Step is not in goal state. #[cfg(feature = "output_progress")] ExecRequired { /// Unit of measurement and limit to indicate progress. progress_limit: ProgressLimit, }, - /// Item is already in goal state. + /// Step is already in goal state. ExecNotRequired, } diff --git a/crate/core/src/lib.rs b/crate/core/src/lib.rs index 333f07cfa..012e5ca9f 100644 --- a/crate/core/src/lib.rs +++ b/crate/core/src/lib.rs @@ -3,8 +3,8 @@ //! This crate exists because: //! //! * `peace_cfg` has a dependency on `peace_resources` for `Resources`, used in -//! `Item::setup`. -//! * `peace_resources` has a dependency on `ItemId`, as uses `TypeMap` for the `States` maps. //! //! When [peace#67] is implemented, the `progress` module can be moved out @@ -13,13 +13,13 @@ //! [peace#67]: https://github.com/azriel91/peace/issues/67 // Re-exports -pub use peace_static_check_macros::{app_name, flow_id, item_id, profile}; +pub use peace_static_check_macros::{app_name, flow_id, step_id, profile}; pub use crate::{ app_name::{AppName, AppNameInvalidFmt}, apply_check::ApplyCheck, flow_id::{FlowId, FlowIdInvalidFmt}, - item_id::{ItemId, ItemIdInvalidFmt}, + step_id::{StepId, StepIdInvalidFmt}, profile::{Profile, ProfileInvalidFmt}, }; @@ -29,7 +29,7 @@ pub mod progress; mod app_name; mod apply_check; mod flow_id; -mod item_id; +mod step_id; mod profile; /// Implements common behaviour for an ID type. diff --git a/crate/core/src/progress/cmd_progress_update.rs b/crate/core/src/progress/cmd_progress_update.rs index 4f7af6c8b..666562988 100644 --- a/crate/core/src/progress/cmd_progress_update.rs +++ b/crate/core/src/progress/cmd_progress_update.rs @@ -7,13 +7,13 @@ use crate::progress::ProgressUpdateAndId; /// This is sent at the `CmdExecution` level. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum CmdProgressUpdate { - /// `ProgressUpdateAndId` for a single item. + /// `ProgressUpdateAndId` for a single step. /// /// # Design Note /// /// This isn't a tuple newtype as `serde_yaml` `0.9` is unable to serialize /// newtype enum variants. - Item { + Step { /// The update. progress_update_and_id: ProgressUpdateAndId, }, @@ -26,7 +26,7 @@ pub enum CmdProgressUpdate { impl From for CmdProgressUpdate { fn from(progress_update_and_id: ProgressUpdateAndId) -> Self { - Self::Item { + Self::Step { progress_update_and_id, } } diff --git a/crate/core/src/progress/progress_complete.rs b/crate/core/src/progress/progress_complete.rs index 867a6bf42..df190bbd5 100644 --- a/crate/core/src/progress/progress_complete.rs +++ b/crate/core/src/progress/progress_complete.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; /// * The end user is using invalid values (need for education). /// * The environment is flakey (need for stabilization). /// -/// Ideally [rust#84277] is implemented so `Item` implementations can use +/// Ideally [rust#84277] is implemented so `Step` implementations can use /// `?` when returning each variant. /// /// [rust#84277]: https://github.com/rust-lang/rust/issues/84277 diff --git a/crate/core/src/progress/progress_delta.rs b/crate/core/src/progress/progress_delta.rs index f847139ac..9fec83207 100644 --- a/crate/core/src/progress/progress_delta.rs +++ b/crate/core/src/progress/progress_delta.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -/// The amount that the item progressed by. +/// The amount that the step progressed by. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum ProgressDelta { /// Ticks the progress bar without incrementing its value. diff --git a/crate/core/src/progress/progress_sender.rs b/crate/core/src/progress/progress_sender.rs index e2294745a..fa6995959 100644 --- a/crate/core/src/progress/progress_sender.rs +++ b/crate/core/src/progress/progress_sender.rs @@ -4,23 +4,23 @@ use crate::{ progress::{ CmdProgressUpdate, ProgressDelta, ProgressMsgUpdate, ProgressUpdate, ProgressUpdateAndId, }, - ItemId, + StepId, }; /// Submits progress for a step's `ApplyFns::exec` method. #[derive(Clone, Copy, Debug)] pub struct ProgressSender<'exec> { - /// ID of the item this belongs to. - item_id: &'exec ItemId, + /// ID of the step this belongs to. + step_id: &'exec StepId, /// Channel sender to send progress updates to. progress_tx: &'exec Sender, } impl<'exec> ProgressSender<'exec> { /// Returns a new `ProgressSender`. - pub fn new(item_id: &'exec ItemId, progress_tx: &'exec Sender) -> Self { + pub fn new(step_id: &'exec StepId, progress_tx: &'exec Sender) -> Self { Self { - item_id, + step_id, progress_tx, } } @@ -29,7 +29,7 @@ impl<'exec> ProgressSender<'exec> { pub fn inc(&self, unit_count: u64, msg_update: ProgressMsgUpdate) { let _progress_send_unused = self.progress_tx.try_send( ProgressUpdateAndId { - item_id: self.item_id.clone(), + step_id: self.step_id.clone(), progress_update: ProgressUpdate::Delta(ProgressDelta::Inc(unit_count)), msg_update, } @@ -48,7 +48,7 @@ impl<'exec> ProgressSender<'exec> { pub fn tick(&self, msg_update: ProgressMsgUpdate) { let _progress_send_unused = self.progress_tx.try_send( ProgressUpdateAndId { - item_id: self.item_id.clone(), + step_id: self.step_id.clone(), progress_update: ProgressUpdate::Delta(ProgressDelta::Tick), msg_update, } @@ -60,7 +60,7 @@ impl<'exec> ProgressSender<'exec> { pub fn reset(&self) { let _progress_send_unused = self.progress_tx.try_send( ProgressUpdateAndId { - item_id: self.item_id.clone(), + step_id: self.step_id.clone(), progress_update: ProgressUpdate::Reset, msg_update: ProgressMsgUpdate::Clear, } @@ -72,7 +72,7 @@ impl<'exec> ProgressSender<'exec> { pub fn reset_to_pending(&self) { let _progress_send_unused = self.progress_tx.try_send( ProgressUpdateAndId { - item_id: self.item_id.clone(), + step_id: self.step_id.clone(), progress_update: ProgressUpdate::ResetToPending, msg_update: ProgressMsgUpdate::Clear, } diff --git a/crate/core/src/progress/progress_status.rs b/crate/core/src/progress/progress_status.rs index 212bcef47..c4dc1e02e 100644 --- a/crate/core/src/progress/progress_status.rs +++ b/crate/core/src/progress/progress_status.rs @@ -27,11 +27,11 @@ use crate::progress::ProgressComplete; /// be `Copy` -- not sure yet. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum ProgressStatus { - /// This item is registered for execution. + /// This step is registered for execution. /// /// This status is used when we don't know the progress limit. Initialized, - /// The item was waiting for execution, when the command was interrupted. + /// The step was waiting for execution, when the command was interrupted. Interrupted, /// Execution has not yet begun. /// @@ -40,8 +40,8 @@ pub enum ProgressStatus { /// * The framework to begin executing the logic. /// * A predecessor's execution completion. ExecPending, - /// Execution has started for this item, but we haven't received - /// `ProgressDelta` update from the item exec logic. + /// Execution has started for this step, but we haven't received + /// `ProgressDelta` update from the step exec logic. Queued, /// Execution is in progress. /// @@ -49,7 +49,7 @@ pub enum ProgressStatus { /// /// * **Units total:** Unknown (spinner) / known (progress bar). /// * **Units current** - /// * **Function:** `Item::{state_current, state_goal, apply}`. + /// * **Function:** `Step::{state_current, state_goal, apply}`. /// /// Certain functions will not be applicable, e.g. when `StateCurrent` /// is feature gated, then the function won't be available when the @@ -57,7 +57,7 @@ pub enum ProgressStatus { Running, /// Progress updates have not been received for a given period. /// - /// Item implementations are responsible for sending progress updates, + /// Step implementations are responsible for sending progress updates, /// but if there are no progress updates, or an identical "it's running" /// progress update is continuously received, then Peace may determine that /// the task may have stalled, and user attention is required. @@ -72,6 +72,6 @@ pub enum ProgressStatus { /// This status is best conveyed alongside additional information: /// /// * **Completion Status**: Success, Failed. - /// * **Function:** `Item::{state_current, state_goal, apply}`. + /// * **Function:** `Step::{state_current, state_goal, apply}`. Complete(ProgressComplete), } diff --git a/crate/core/src/progress/progress_tracker.rs b/crate/core/src/progress/progress_tracker.rs index a213d299e..559eccb3d 100644 --- a/crate/core/src/progress/progress_tracker.rs +++ b/crate/core/src/progress/progress_tracker.rs @@ -8,7 +8,7 @@ use crate::progress::{ProgressLimit, ProgressStatus}; /// Tracks progress for a step's `ApplyFns::exec` method. #[derive(Debug)] pub struct ProgressTracker { - /// Status of the item's execution progress. + /// Status of the step's execution progress. progress_status: ProgressStatus, /// Internal progress bar to update. progress_bar: ProgressBar, diff --git a/crate/core/src/progress/progress_update_and_id.rs b/crate/core/src/progress/progress_update_and_id.rs index 7d34a43c5..b5607c139 100644 --- a/crate/core/src/progress/progress_update_and_id.rs +++ b/crate/core/src/progress/progress_update_and_id.rs @@ -2,14 +2,14 @@ use serde::{Deserialize, Serialize}; use crate::{ progress::{ProgressMsgUpdate, ProgressUpdate}, - ItemId, + StepId, }; -/// An item ID and its progress update. +/// An step ID and its progress update. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub struct ProgressUpdateAndId { - /// ID of the item whose progress is updated. - pub item_id: ItemId, + /// ID of the step whose progress is updated. + pub step_id: StepId, /// Delta update for the progress tracker. pub progress_update: ProgressUpdate, /// Whether to change the progress message. diff --git a/crate/core/src/step_id.rs b/crate/core/src/step_id.rs index ac82feb2b..f3d89e42c 100644 --- a/crate/core/src/step_id.rs +++ b/crate/core/src/step_id.rs @@ -9,21 +9,21 @@ use serde::{Deserialize, Serialize}; /// /// # Examples /// -/// The following are all examples of valid `ItemId`s: +/// The following are all examples of valid `StepId`s: /// /// ```rust -/// # use peace_core::{item_id, ItemId}; +/// # use peace_core::{step_id, StepId}; /// # -/// let _snake = item_id!("snake_case"); -/// let _camel = item_id!("camelCase"); -/// let _pascal = item_id!("PascalCase"); +/// let _snake = step_id!("snake_case"); +/// let _camel = step_id!("camelCase"); +/// let _pascal = step_id!("PascalCase"); /// ``` /// /// # Design Note /// /// TODO: Experiment with upgrades. /// -/// For backward compatibility and migrating items from old IDs to new IDs, e.g. +/// For backward compatibility and migrating steps from old IDs to new IDs, e.g. /// when they were deployed with an old version of the automation software, /// there needs to be a way to: /// @@ -31,8 +31,8 @@ use serde::{Deserialize, Serialize}; /// * Either clean up that state, or migrate that state into a Step with the /// new ID. /// -/// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html +/// [`Step`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Step.html #[derive(Clone, Debug, Hash, PartialEq, Eq, Deserialize, Serialize)] -pub struct ItemId(Cow<'static, str>); +pub struct StepId(Cow<'static, str>); -crate::id_newtype!(ItemId, ItemIdInvalidFmt, item_id, code_inline); +crate::id_newtype!(StepId, StepIdInvalidFmt, step_id, code_inline); diff --git a/crate/data/src/accessors.rs b/crate/data/src/accessors.rs index 07890eedc..7ee8fb1e4 100644 --- a/crate/data/src/accessors.rs +++ b/crate/data/src/accessors.rs @@ -9,7 +9,7 @@ //! * `ROpt<'_, T>`: Immutable access to an `Option` resource. //! * `WOpt<'_, T>`: Mutable access to an `Option` resource. //! -//! Notably if you want to insert a resource during item execution, you +//! Notably if you want to insert a resource during step execution, you //! should use `WOpt` instead of `WMaybe`, and correspondingly read it using //! `ROpt`. pub use self::{r_maybe::RMaybe, r_opt::ROpt, w_maybe::WMaybe, w_opt::WOpt}; diff --git a/crate/data/src/accessors/r_maybe.rs b/crate/data/src/accessors/r_maybe.rs index e21ea9a1f..68c855e12 100644 --- a/crate/data/src/accessors/r_maybe.rs +++ b/crate/data/src/accessors/r_maybe.rs @@ -4,7 +4,7 @@ use fn_graph::{ resman::{BorrowFail, Ref}, DataAccess, DataAccessDyn, Resources, TypeIds, }; -use peace_core::ItemId; +use peace_core::StepId; use crate::Data; @@ -42,7 +42,7 @@ impl<'borrow, T> Data<'borrow> for RMaybe<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(_item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { + fn borrow(_step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { resources .try_borrow::() .map_err(|borrow_fail| match borrow_fail { diff --git a/crate/data/src/accessors/w_maybe.rs b/crate/data/src/accessors/w_maybe.rs index 13d06d8c3..8ecaebd14 100644 --- a/crate/data/src/accessors/w_maybe.rs +++ b/crate/data/src/accessors/w_maybe.rs @@ -4,7 +4,7 @@ use fn_graph::{ resman::{BorrowFail, RefMut}, DataAccess, DataAccessDyn, Resources, TypeIds, }; -use peace_core::ItemId; +use peace_core::StepId; use crate::Data; @@ -51,7 +51,7 @@ impl<'borrow, T> Data<'borrow> for WMaybe<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(_item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { + fn borrow(_step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { resources .try_borrow_mut::() .map_err(|borrow_fail| match borrow_fail { diff --git a/crate/data/src/data.rs b/crate/data/src/data.rs index 15ff4f6e7..76d9f4cca 100644 --- a/crate/data/src/data.rs +++ b/crate/data/src/data.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; use fn_graph::{DataAccess, DataAccessDyn, DataBorrow, Resources, R, W}; -use peace_core::ItemId; +use peace_core::StepId; /// Defines the logic to instantiate and retrieve runtime data. /// @@ -13,23 +13,23 @@ use peace_core::ItemId; pub trait Data<'borrow>: DataAccess + DataAccessDyn + Send { /// Borrows each of `Self`'s fields from the provided [`Resources`]. /// - /// This takes in the `item_id`, so that the type that implements this + /// This takes in the `step_id`, so that the type that implements this /// trait may further filter specific data within the borrowed data, scope - /// to the item. + /// to the step. /// /// # Parameters /// - /// * `item_id`: ID of the item this borrow is used for. + /// * `step_id`: ID of the step this borrow is used for. /// * `resources`: `Any` map to borrow the data from. - fn borrow(item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self; + fn borrow(step_id: &'borrow StepId, resources: &'borrow Resources) -> Self; } impl<'borrow> Data<'borrow> for () { - fn borrow(_item_id: &'borrow ItemId, _resources: &'borrow Resources) -> Self {} + fn borrow(_step_id: &'borrow StepId, _resources: &'borrow Resources) -> Self {} } impl<'borrow> Data<'borrow> for &'borrow () { - fn borrow(_item_id: &'borrow ItemId, _resources: &'borrow Resources) -> Self { + fn borrow(_step_id: &'borrow StepId, _resources: &'borrow Resources) -> Self { &() } } @@ -38,7 +38,7 @@ impl<'borrow, T> Data<'borrow> for R<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(_item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { + fn borrow(_step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { ::borrow(resources) } } @@ -47,7 +47,7 @@ impl<'borrow, T> Data<'borrow> for W<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(_item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { + fn borrow(_step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { ::borrow(resources) } } diff --git a/crate/data/src/marker.rs b/crate/data/src/marker.rs index 25ce33224..9808c1c83 100644 --- a/crate/data/src/marker.rs +++ b/crate/data/src/marker.rs @@ -1,9 +1,9 @@ //! Markers for `State`s inserted into `Resources`. //! -//! For `SingleProfileSingleFlow` commands, `Current(None)` and -//! `Goal(None)` are inserted into `Resources` when the +//! For `SingleProfileSingleFlow` commands, `Current(None)` and +//! `Goal(None)` are inserted into `Resources` when the //! command context is built, and automatically mutated to `Some` when either -//! `Item::state_current` or `Item::state_goal` is executed. +//! `Step::state_current` or `Step::state_goal` is executed. // Corresponds to variants in `crate/params/src/value_resolution_mode.rs`. // Remember to update there when updating here. diff --git a/crate/data/src/marker/apply_dry.rs b/crate/data/src/marker/apply_dry.rs index 5e3d1d1dc..fcd701a26 100644 --- a/crate/data/src/marker/apply_dry.rs +++ b/crate/data/src/marker/apply_dry.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// An `ApplyDry` is set to `Some` whenever a step is dry applied, +/// An `ApplyDry` is set to `Some` whenever a step is dry applied, /// enabling a subsequent successor's params to access that value when the /// successor's `apply_dry` function is run. /// diff --git a/crate/data/src/marker/clean.rs b/crate/data/src/marker/clean.rs index bf8c4defb..dafc72a1c 100644 --- a/crate/data/src/marker/clean.rs +++ b/crate/data/src/marker/clean.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Clean` is set to `Some` whenever a step's clean state is +/// A `Clean` is set to `Some` whenever a step's clean state is /// needed, e.g. preparing for applying the clean state. enabling a subsequent /// successor's params to access that value when the successor's `state_clean` /// function is run. diff --git a/crate/data/src/marker/current.rs b/crate/data/src/marker/current.rs index 707df55fb..4bf9e6560 100644 --- a/crate/data/src/marker/current.rs +++ b/crate/data/src/marker/current.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Current` is set to `Some` whenever a step's current state +/// A `Current` is set to `Some` whenever a step's current state /// is discovered. enabling a subsequent successor's params to access that value /// when the successor's **goal** state function is run. /// diff --git a/crate/data/src/marker/goal.rs b/crate/data/src/marker/goal.rs index 6ba975021..7aad0caa6 100644 --- a/crate/data/src/marker/goal.rs +++ b/crate/data/src/marker/goal.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Goal` is set to `Some` whenever a step's goal state +/// A `Goal` is set to `Some` whenever a step's goal state /// is discovered. enabling a subsequent successor's params to access that value /// when the successor's goal state function is run. /// diff --git a/crate/data_derive/src/lib.rs b/crate/data_derive/src/lib.rs index 05091fe23..2828f8583 100644 --- a/crate/data_derive/src/lib.rs +++ b/crate/data_derive/src/lib.rs @@ -121,7 +121,7 @@ fn impl_data_access(ast: &DeriveInput) -> proc_macro2::TokenStream { for #name #ty_generics #where_clause { - fn borrow(item_id: & #impl_borrow_lt #peace_cfg_path::ItemId, resources: & #impl_borrow_lt #peace_data_path::Resources) -> Self { + fn borrow(step_id: & #impl_borrow_lt #peace_cfg_path::StepId, resources: & #impl_borrow_lt #peace_data_path::Resources) -> Self { #borrow_return } } @@ -185,7 +185,7 @@ fn data_borrow_impl<'ast>( let borrow_return = quote! { #name { - #( #field_names_tokens: Data::borrow(item_id, resources) ),* + #( #field_names_tokens: Data::borrow(step_id, resources) ),* #(, #phantom_data_fields: ::std::marker::PhantomData)* } }; @@ -199,7 +199,7 @@ fn data_borrow_impl<'ast>( .map(|n| quote!(#n)) .collect::>(); - let borrow = vec![quote! { Data::borrow(item_id, resources) }; count]; + let borrow = vec![quote! { Data::borrow(step_id, resources) }; count]; let borrow_return = quote! { #name ( #( #borrow ),* ) }; diff --git a/crate/flow_model/src/flow_info.rs b/crate/flow_model/src/flow_info.rs index 7ae0728cb..2880598af 100644 --- a/crate/flow_model/src/flow_info.rs +++ b/crate/flow_model/src/flow_info.rs @@ -3,11 +3,11 @@ use peace_core::FlowId; use serde::{Deserialize, Serialize}; -use crate::ItemInfo; +use crate::StepInfo; /// Serializable representation of values in a [`Flow`]. /// -/// This includes values passed into, or produced by `Item`s in the `Flow`. +/// This includes values passed into, or produced by `Step`s in the `Flow`. /// /// [`Flow`]: https://docs.rs/peace_rt_model/latest/peace_rt_model/struct.Flow.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] @@ -15,12 +15,12 @@ pub struct FlowInfo { /// ID of the flow. pub flow_id: FlowId, /// Serialized representation of the flow graph. - pub graph_info: GraphInfo, + pub graph_info: GraphInfo, } impl FlowInfo { /// Returns a new `FlowInfo`. - pub fn new(flow_id: FlowId, graph_info: GraphInfo) -> Self { + pub fn new(flow_id: FlowId, graph_info: GraphInfo) -> Self { Self { flow_id, graph_info, diff --git a/crate/flow_model/src/flow_spec_info.rs b/crate/flow_model/src/flow_spec_info.rs index f630b52d2..e7488f4b0 100644 --- a/crate/flow_model/src/flow_spec_info.rs +++ b/crate/flow_model/src/flow_spec_info.rs @@ -9,7 +9,7 @@ use peace_core::FlowId; use serde::{Deserialize, Serialize}; -use crate::ItemSpecInfo; +use crate::StepSpecInfo; /// Serializable representation of how a [`Flow`] is configured. /// @@ -19,12 +19,12 @@ pub struct FlowSpecInfo { /// ID of the flow. pub flow_id: FlowId, /// Serialized representation of the flow graph. - pub graph_info: GraphInfo, + pub graph_info: GraphInfo, } impl FlowSpecInfo { /// Returns a new `FlowSpecInfo`. - pub fn new(flow_id: FlowId, graph_info: GraphInfo) -> Self { + pub fn new(flow_id: FlowId, graph_info: GraphInfo) -> Self { Self { flow_id, graph_info, @@ -35,12 +35,12 @@ impl FlowSpecInfo { /// execution. pub fn to_progress_info_graph(&self) -> InfoGraph { let graph_info = &self.graph_info; - let item_count = graph_info.node_count(); + let step_count = graph_info.node_count(); let hierarchy = graph_info.iter_insertion_with_indices().fold( - NodeHierarchy::with_capacity(item_count), - |mut hierarchy, (_node_index, item_spec_info)| { - let node_id = item_spec_info_to_node_id(item_spec_info); + NodeHierarchy::with_capacity(step_count), + |mut hierarchy, (_node_index, step_spec_info)| { + let node_id = step_spec_info_to_node_id(step_spec_info); // Progress nodes have no nested nodes. hierarchy.insert(node_id, NodeHierarchy::new()); hierarchy @@ -62,15 +62,15 @@ impl FlowSpecInfo { /// execution. pub fn to_outcome_info_graph(&self) -> InfoGraph { let graph_info = &self.graph_info; - let item_count = graph_info.node_count(); + let step_count = graph_info.node_count(); - let mut visited = HashSet::with_capacity(item_count); + let mut visited = HashSet::with_capacity(step_count); let visited = &mut visited; let hierarchy = graph_info .iter_insertion_with_indices() - .filter_map(|(node_index, item_spec_info)| { + .filter_map(|(node_index, step_spec_info)| { let node_hierarchy = outcome_node_hierarchy(graph_info, visited, node_index); - let node_id = item_spec_info_to_node_id(item_spec_info); + let node_id = step_spec_info_to_node_id(step_spec_info); node_hierarchy.map(|node_hierarchy| (node_id, node_hierarchy)) }) .fold( @@ -96,7 +96,7 @@ impl FlowSpecInfo { /// Returns a `NodeHierarchy` for the given node, if it has not already been /// visited. fn outcome_node_hierarchy( - graph_info: &GraphInfo, + graph_info: &GraphInfo, visited: &mut HashSet, node_index: FnId, ) -> Option { @@ -120,18 +120,18 @@ fn outcome_node_hierarchy( // * Host machines: // // A file transfer would have a source host, source path, dest host, dest - // path, and these exist in the same Item's parameters. + // path, and these exist in the same Step's parameters. // // * Physical nesting: // // - Configuration that lives inside a server. // - Cloud resource that lives inside a subnet. // - // Should this be provided by the item or tool developer? + // Should this be provided by the step or tool developer? // - // Probably the item. The item knows its parameters (which may be mapped - // from other items' state), so the containment is returned based on the - // item knowing its parent container is from a source / destination + // Probably the step. The step knows its parameters (which may be mapped + // from other steps' state), so the containment is returned based on the + // step knowing its parent container is from a source / destination // parameter. if matches!( graph_info.edge_weight(edge_index).copied(), @@ -146,9 +146,9 @@ fn outcome_node_hierarchy( if let Some(child_node_hierarchy) = outcome_node_hierarchy(graph_info, visited, child_node_index) { - let item_spec_info = &graph_info[child_node_index]; + let step_spec_info = &graph_info[child_node_index]; hierarchy.insert( - item_spec_info_to_node_id(item_spec_info), + step_spec_info_to_node_id(step_spec_info), child_node_hierarchy, ); } @@ -157,11 +157,11 @@ fn outcome_node_hierarchy( Some(hierarchy) } -/// Returns the list of edges between items in the graph. -fn outcome_node_edges(graph_info: &GraphInfo) -> Edges { +/// Returns the list of edges between steps in the graph. +fn outcome_node_edges(graph_info: &GraphInfo) -> Edges { graph_info.iter_insertion_with_indices().fold( Edges::with_capacity(graph_info.node_count()), - |mut edges, (node_index, item_spec_info)| { + |mut edges, (node_index, step_spec_info)| { // let children = graph_info.children(node_index); children @@ -181,14 +181,14 @@ fn outcome_node_edges(graph_info: &GraphInfo) -> Edges { } }) .for_each(|child_node_index| { - let item_id = item_spec_info_to_node_id(item_spec_info); - let child_item_id = item_spec_info_to_node_id(&graph_info[child_node_index]); + let step_id = step_spec_info_to_node_id(step_spec_info); + let child_step_id = step_spec_info_to_node_id(&graph_info[child_node_index]); edges.insert( - EdgeId::try_from(format!("{item_id}__{child_item_id}")).expect( - "Expected `peace` `ItemId`s concatenated \ + EdgeId::try_from(format!("{step_id}__{child_step_id}")).expect( + "Expected `peace` `StepId`s concatenated \ to be valid `dot_ix` `EdgeId`s.", ), - [item_id, child_item_id], + [step_id, child_step_id], ); }); @@ -197,15 +197,15 @@ fn outcome_node_edges(graph_info: &GraphInfo) -> Edges { ) } -/// Returns the list of edges between items in the graph for progress. +/// Returns the list of edges between steps in the graph for progress. /// /// For progress graphs, an edge is rendered between pairs of predecessor and -/// successor items, regardless of whether their dependency is `Edge::Logic` +/// successor steps, regardless of whether their dependency is `Edge::Logic` /// (adjacent) or `Edge::Contains` (nested). -fn progress_node_edges(graph_info: &GraphInfo) -> Edges { +fn progress_node_edges(graph_info: &GraphInfo) -> Edges { graph_info.iter_insertion_with_indices().fold( Edges::with_capacity(graph_info.node_count()), - |mut edges, (node_index, item_spec_info)| { + |mut edges, (node_index, step_spec_info)| { // let children = graph_info.children(node_index); children @@ -228,14 +228,14 @@ fn progress_node_edges(graph_info: &GraphInfo) -> Edges { } }) .for_each(|child_node_index| { - let item_id = item_spec_info_to_node_id(item_spec_info); - let child_item_id = item_spec_info_to_node_id(&graph_info[child_node_index]); + let step_id = step_spec_info_to_node_id(step_spec_info); + let child_step_id = step_spec_info_to_node_id(&graph_info[child_node_index]); edges.insert( - EdgeId::try_from(format!("{item_id}__{child_item_id}")).expect( - "Expected `peace` `ItemId`s concatenated \ + EdgeId::try_from(format!("{step_id}__{child_step_id}")).expect( + "Expected `peace` `StepId`s concatenated \ to be valid `dot_ix` `EdgeId`s.", ), - [item_id, child_item_id], + [step_id, child_step_id], ); }); @@ -244,24 +244,24 @@ fn progress_node_edges(graph_info: &GraphInfo) -> Edges { ) } -/// Returns the list of edges between items in the graph. -fn node_names(graph_info: &GraphInfo) -> NodeNames { +/// Returns the list of edges between steps in the graph. +fn node_names(graph_info: &GraphInfo) -> NodeNames { graph_info.iter_insertion_with_indices().fold( NodeNames::with_capacity(graph_info.node_count()), - |mut node_names, (_node_index, item_spec_info)| { - let item_id = item_spec_info_to_node_id(item_spec_info); + |mut node_names, (_node_index, step_spec_info)| { + let step_id = step_spec_info_to_node_id(step_spec_info); // Note: This does not have to be the ID, it can be a human readable name. - let node_name = item_id.to_string(); + let node_name = step_id.to_string(); - node_names.insert(item_id, node_name); + node_names.insert(step_id, node_name); node_names }, ) } -fn item_spec_info_to_node_id(item_spec_info: &ItemSpecInfo) -> NodeId { - NodeId::try_from(item_spec_info.item_id.to_string()) - .expect("Expected `peace` `ItemId`s to be valid `dot_ix` `NodeId`s.`") +fn step_spec_info_to_node_id(step_spec_info: &StepSpecInfo) -> NodeId { + NodeId::try_from(step_spec_info.step_id.to_string()) + .expect("Expected `peace` `StepId`s to be valid `dot_ix` `NodeId`s.`") } diff --git a/crate/flow_model/src/lib.rs b/crate/flow_model/src/lib.rs index 971056353..38e361464 100644 --- a/crate/flow_model/src/lib.rs +++ b/crate/flow_model/src/lib.rs @@ -8,11 +8,11 @@ pub use dot_ix; pub use fn_graph::GraphInfo; pub use crate::{ - flow_info::FlowInfo, flow_spec_info::FlowSpecInfo, item_info::ItemInfo, - item_spec_info::ItemSpecInfo, + flow_info::FlowInfo, flow_spec_info::FlowSpecInfo, step_info::StepInfo, + step_spec_info::StepSpecInfo, }; mod flow_info; mod flow_spec_info; -mod item_info; -mod item_spec_info; +mod step_info; +mod step_spec_info; diff --git a/crate/flow_model/src/step_info.rs b/crate/flow_model/src/step_info.rs index c58ffe246..48d18e94b 100644 --- a/crate/flow_model/src/step_info.rs +++ b/crate/flow_model/src/step_info.rs @@ -1,18 +1,18 @@ -use peace_core::ItemId; +use peace_core::StepId; use serde::{Deserialize, Serialize}; /// Serializable representation of values used for / produced by a [`Step`]. /// -/// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html +/// [`Step`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Step.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct ItemInfo { - /// ID of the `Item`. - pub item_id: ItemId, +pub struct StepInfo { + /// ID of the `Step`. + pub step_id: StepId, } -impl ItemInfo { - /// Returns a new `ItemInfo`. - pub fn new(item_id: ItemId) -> Self { - Self { item_id } +impl StepInfo { + /// Returns a new `StepInfo`. + pub fn new(step_id: StepId) -> Self { + Self { step_id } } } diff --git a/crate/flow_model/src/step_spec_info.rs b/crate/flow_model/src/step_spec_info.rs index 21cf029df..6129eede4 100644 --- a/crate/flow_model/src/step_spec_info.rs +++ b/crate/flow_model/src/step_spec_info.rs @@ -1,18 +1,18 @@ -use peace_core::ItemId; +use peace_core::StepId; use serde::{Deserialize, Serialize}; /// Serializable representation of how a [`Step`] is configured. /// -/// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html +/// [`Step`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Step.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct ItemSpecInfo { - /// ID of the `Item`. - pub item_id: ItemId, +pub struct StepSpecInfo { + /// ID of the `Step`. + pub step_id: StepId, } -impl ItemSpecInfo { - /// Returns a new `ItemSpecInfo`. - pub fn new(item_id: ItemId) -> Self { - Self { item_id } +impl StepSpecInfo { + /// Returns a new `StepSpecInfo`. + pub fn new(step_id: StepId) -> Self { + Self { step_id } } } diff --git a/crate/fmt/src/lib.rs b/crate/fmt/src/lib.rs index 44c53275c..d1c4511f8 100644 --- a/crate/fmt/src/lib.rs +++ b/crate/fmt/src/lib.rs @@ -24,7 +24,7 @@ mod presenter; /// ```rust,ignore /// use peace_fmt::{present, Presentable}; /// -/// present!(output, "a str", item, "\n"); +/// present!(output, "a str", step, "\n"); /// ``` #[macro_export] macro_rules! present { @@ -40,7 +40,7 @@ macro_rules! present { /// ```rust,ignore /// use peace_fmt::{present, Presentable}; /// -/// presentln!(output, "a str", item, "\n"); +/// presentln!(output, "a str", step, "\n"); /// ``` #[macro_export] macro_rules! presentln { diff --git a/crate/fmt/src/presentable.rs b/crate/fmt/src/presentable.rs index adf522a5d..f1a555446 100644 --- a/crate/fmt/src/presentable.rs +++ b/crate/fmt/src/presentable.rs @@ -48,7 +48,7 @@ mod tuple_impl; /// /// # Examples /// -/// Presenting a list item with a name and value: +/// Presenting a list step with a name and value: /// /// ```rust /// # use peace_fmt::{Presentable, Presenter}; @@ -56,13 +56,13 @@ mod tuple_impl; /// // use peace::fmt::{Presentable, Presenter}; /// /// #[derive(Clone, Deserialize, Serialize)] -/// struct Item { +/// struct Step { /// name: String, /// desc: String, /// } /// /// #[async_trait::async_trait(?Send)] -/// impl Presentable for Item { +/// impl Presentable for Step { /// async fn present<'output, PR>(&self, presenter: &mut PR) -> Result<(), PR::Error> /// where /// PR: Presenter<'output>, diff --git a/crate/fmt/src/presenter.rs b/crate/fmt/src/presenter.rs index 1b761ba1d..d14baadfe 100644 --- a/crate/fmt/src/presenter.rs +++ b/crate/fmt/src/presenter.rs @@ -54,14 +54,14 @@ pub trait Presenter<'output> { /// /// # Purposes /// - /// * An ID with no spaces, e.g. "my_item" + /// * An ID with no spaces, e.g. "my_step" async fn id(&mut self, id: &str) -> Result<(), Self::Error>; /// Presents text as a step name. /// /// # Purposes /// - /// * A display name with spaces, e.g. "My Item" + /// * A display name with spaces, e.g. "My Step" async fn name(&mut self, name: &str) -> Result<(), Self::Error>; /// Presents text as plain text. @@ -95,7 +95,7 @@ pub trait Presenter<'output> { /// /// # Purposes /// - /// * A list of steps. + /// * A list of items. async fn list_numbered<'f, P, I>(&mut self, iter: I) -> Result<(), Self::Error> where P: Presentable + ?Sized + 'f, @@ -106,7 +106,7 @@ pub trait Presenter<'output> { /// /// # Purposes /// - /// * A list of steps. + /// * A list of items. async fn list_numbered_with<'f, P, I, T, F>( &mut self, iter: I, diff --git a/crate/params/src/any_spec_rt.rs b/crate/params/src/any_spec_rt.rs index b25245fce..4b4375955 100644 --- a/crate/params/src/any_spec_rt.rs +++ b/crate/params/src/any_spec_rt.rs @@ -3,7 +3,7 @@ use crate::AnySpecDataType; /// Runtime logic of how to look up values for each field in this struct. /// /// This trait is automatically implemented by `#[derive(Params)]` on an -/// `Item::Params`, as well as in the `peace_params` crate for standard +/// `Step::Params`, as well as in the `peace_params` crate for standard /// library types. pub trait AnySpecRt { /// Whether this `Spec` is usable to resolve values. @@ -17,7 +17,7 @@ pub trait AnySpecRt { /// /// This means where `self` is `Self::Value`, `Self::InMemory`, /// `Self::MappingFn`, and `Self::FieldWise`, these would take priority over - /// any stored item variants. + /// any stored spec values. /// /// For `Self::FieldWise`, a recursive merge would happen per field /// `ValueSpec`. diff --git a/crate/params/src/field_wise_spec_rt.rs b/crate/params/src/field_wise_spec_rt.rs index 0a84bcca8..64c5b2dfc 100644 --- a/crate/params/src/field_wise_spec_rt.rs +++ b/crate/params/src/field_wise_spec_rt.rs @@ -8,7 +8,7 @@ use crate::{AnySpecRt, ParamsResolveError, ValueResolutionCtx}; /// Runtime logic of how to look up values for each field in this struct. /// /// This trait is automatically implemented by `#[derive(Params)]` on an -/// `Item::Params`, as well as manual implementations for standard library +/// `Step::Params`, as well as manual implementations for standard library /// types. pub trait FieldWiseSpecRt: AnySpecRt { /// The original value type. `MyParamsFieldWiseSpec::ValueType` is @@ -17,7 +17,7 @@ pub trait FieldWiseSpecRt: AnySpecRt { /// The `Params` type, but with each of its fields wrapped in `Option`. type Partial: Clone + Debug + Default + Serialize + DeserializeOwned + Send + Sync + 'static; - /// Resolves the values to construct the item `Params`. + /// Resolves the values to construct the step `Params`. /// /// This function returns an error if any value is not present in /// [`Resources`]. For cases where missing values are not an error, see @@ -29,7 +29,7 @@ pub trait FieldWiseSpecRt: AnySpecRt { resources: &Resources, value_resolution_ctx: &mut ValueResolutionCtx, ) -> Result; - /// Resolves the values to construct the item `Params`. + /// Resolves the values to construct the step `Params`. /// /// Values that are not present in `Resources` will be `None`. fn resolve_partial( diff --git a/crate/params/src/lib.rs b/crate/params/src/lib.rs index fce5e15d7..b3196ffcd 100644 --- a/crate/params/src/lib.rs +++ b/crate/params/src/lib.rs @@ -4,12 +4,12 @@ //! framework. //! //! This crate defines types and traits for implementors and users to work with -//! item params. +//! step params. //! //! # Design //! //! When a step is defined, implementors define the parameters type for -//! that item. +//! that step. //! //! For Peace to derive additional functionality from that type, this crate: //! @@ -37,20 +37,20 @@ //! : : '----------------------------' : : //! : : : : //! : : .-------------------. : : -//! : : | struct MyItem; | : : +//! : : | struct MyStep; | : : //! : : | | : ---. : -//! : : | impl Item for | : | : -//! : : | MyItem { | : | : +//! : : | impl Step for | : | : +//! : : | MyStep { | : | : //! : : | type Params = | : ' : //! : : | MyParams; | : exposes API : //! : : | } | : with constraints : //! : : '-------------------' : from : -//! : : : : //! : | cmd_ctx_builder | : : . : -//! : | .with_item_params | <-------------------------------------' : +//! : | .with_step_params | <-------------------------------------' : //! : | ::( | : : : -//! : | item_id, | : : : +//! : | step_id, | : : : //! : | my_p_spec_builder | : : : //! : | .with_f(123) | : : : //! : | .with_from(..) | : : : diff --git a/crate/params/src/mapping_fn_impl.rs b/crate/params/src/mapping_fn_impl.rs index a77966b06..a1f7befd6 100644 --- a/crate/params/src/mapping_fn_impl.rs +++ b/crate/params/src/mapping_fn_impl.rs @@ -315,7 +315,7 @@ macro_rules! arg_resolve { // Either: // // * `A0` in the function is incorrect, so `Current` is not registered by any - // item, or + // step, or // * There is a bug in Peace. BorrowFail::ValueNotFound => match borrow_direct { Ok(arg) => BorrowedData::Direct(arg), @@ -323,7 +323,7 @@ macro_rules! arg_resolve { // Either: // // * `A0` in the function is incorrect, so `Current` is not registered - // by any item, or + // by any step, or // * There is a bug in Peace. BorrowFail::ValueNotFound => { return Err(ParamsResolveError::FromMap { @@ -380,7 +380,7 @@ macro_rules! try_arg_resolve { // Either: // // * `A0` in the function is incorrect, so `Current` is not registered by any - // item, or + // step, or // * There is a bug in Peace. BorrowFail::ValueNotFound => match borrow_direct { Ok(arg) => BorrowedData::Direct(arg), @@ -388,7 +388,7 @@ macro_rules! try_arg_resolve { // Either: // // * `A0` in the function is incorrect, so `Current` is not registered - // by any item, or + // by any step, or // * There is a bug in Peace. BorrowFail::ValueNotFound => return Ok(None), BorrowFail::BorrowConflictImm | BorrowFail::BorrowConflictMut => { diff --git a/crate/params/src/params_spec.rs b/crate/params/src/params_spec.rs index d5daa5ef3..eb410f15e 100644 --- a/crate/params/src/params_spec.rs +++ b/crate/params/src/params_spec.rs @@ -17,7 +17,7 @@ use crate::{ /// For deserialization: /// /// 1. A `ParamsSpecsTypeReg` is constructed, and deserialization functions are -/// registered from `ItemId` to `ParamsSpecDe`, where `F` and `U` +/// registered from `StepId` to `ParamsSpecDe`, where `F` and `U` /// are derived from the `ValueSpec` provided by the user. /// /// 2. `value_specs.yaml` is deserialized using that type registry. @@ -26,7 +26,7 @@ use crate::{ /// `AnySpecRtBoxed` to be passed around in a `CmdCtx`. /// /// 4. These `AnySpecRtBoxed`s are downcasted back to `ValueSpec` when -/// resolving values for item params and params partials. +/// resolving values for step params and params partials. #[derive(Clone, Serialize, Deserialize)] #[serde(from = "crate::ParamsSpecDe", bound = "T: Params")] pub enum ParamsSpec diff --git a/crate/params/src/params_spec_fieldless.rs b/crate/params/src/params_spec_fieldless.rs index 7cde56617..bc2bc5978 100644 --- a/crate/params/src/params_spec_fieldless.rs +++ b/crate/params/src/params_spec_fieldless.rs @@ -17,7 +17,7 @@ use crate::{ /// For deserialization: /// /// 1. A `ParamsSpecsTypeReg` is constructed, and deserialization functions are -/// registered from `ItemId` to `ParamsSpecFieldlessDe`, where `F` +/// registered from `StepId` to `ParamsSpecFieldlessDe`, where `F` /// and `U` are derived from the `ValueSpec` provided by the user. /// /// 2. `value_specs.yaml` is deserialized using that type registry. @@ -27,7 +27,7 @@ use crate::{ /// around in a `CmdCtx`. /// /// 4. These `AnySpecRtBoxed`s are downcasted back to `ParamsSpecFieldless` -/// when resolving values for item params and params partials. +/// when resolving values for step params and params partials. #[derive(Clone, Serialize, Deserialize)] #[serde(from = "crate::ParamsSpecFieldlessDe")] pub enum ParamsSpecFieldless diff --git a/crate/params/src/params_specs.rs b/crate/params/src/params_specs.rs index 56e9a7b10..398f244ea 100644 --- a/crate/params/src/params_specs.rs +++ b/crate/params/src/params_specs.rs @@ -1,32 +1,32 @@ use std::ops::{Deref, DerefMut}; -use peace_core::ItemId; +use peace_core::StepId; use peace_resources::type_reg::untagged::TypeMap; use serde::Serialize; use crate::AnySpecRtBoxed; -/// Map of item ID to its params' specs. `TypeMap` newtype. /// /// The concrete `*ValueSpec` type can be obtained by calling -/// `.get(item_id)` with the correct type: +/// `.get(step_id)` with the correct type: /// /// ```rust,ignore -/// let item_params_spec = MyItemParams::spec().build(); +/// let step_params_spec = MyStepParams::spec().build(); /// let mut params_specs = ParamsSpecs::new(); -/// params_specs.insert(item_id!("my_item"), item_params_spec); +/// params_specs.insert(step_id!("my_step"), step_params_spec); /// /// // later /// -/// let item_params_spec = params_specs.get::(&item_id!("my_item")); +/// let step_params_spec = params_specs.get::(&step_id!("my_step")); /// ``` /// /// The information may not be of the same type across flows, as flows are /// different in what they are doing. #[derive(Clone, Debug, Default, Serialize)] #[serde(transparent)] // Needed to serialize as a map instead of a list. -pub struct ParamsSpecs(TypeMap); +pub struct ParamsSpecs(TypeMap); impl ParamsSpecs { /// Returns a new `ParamsSpecs` map. @@ -44,13 +44,13 @@ impl ParamsSpecs { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } impl Deref for ParamsSpecs { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 @@ -63,8 +63,8 @@ impl DerefMut for ParamsSpecs { } } -impl From> for ParamsSpecs { - fn from(type_map: TypeMap) -> Self { +impl From> for ParamsSpecs { + fn from(type_map: TypeMap) -> Self { Self(type_map) } } diff --git a/crate/params/src/value_resolution_ctx.rs b/crate/params/src/value_resolution_ctx.rs index 7f9edc240..91c22f56e 100644 --- a/crate/params/src/value_resolution_ctx.rs +++ b/crate/params/src/value_resolution_ctx.rs @@ -1,6 +1,6 @@ use std::fmt; -use peace_core::ItemId; +use peace_core::StepId; use crate::{FieldNameAndType, ValueResolutionMode}; @@ -10,9 +10,9 @@ pub struct ValueResolutionCtx { /// When resolving `Value`s, whether to look up `Current` or /// `Goal`. value_resolution_mode: ValueResolutionMode, - /// ID of the item whose params are being resolved. - item_id: ItemId, - /// Name of the `Item::Params` type. + /// ID of the step whose params are being resolved. + step_id: StepId, + /// Name of the `Step::Params` type. params_type_name: String, /// Hierarchy of fields traversed to resolve this value. resolution_chain: Vec, @@ -21,12 +21,12 @@ pub struct ValueResolutionCtx { impl ValueResolutionCtx { pub fn new( value_resolution_mode: ValueResolutionMode, - item_id: ItemId, + step_id: StepId, params_type_name: String, ) -> Self { Self { value_resolution_mode, - item_id, + step_id, params_type_name, resolution_chain: Vec::new(), } @@ -36,8 +36,8 @@ impl ValueResolutionCtx { self.value_resolution_mode } - pub fn item_id(&self) -> &ItemId { - &self.item_id + pub fn step_id(&self) -> &StepId { + &self.step_id } pub fn params_type_name(&self) -> &str { diff --git a/crate/params/src/value_spec.rs b/crate/params/src/value_spec.rs index 21e1f543e..15523a151 100644 --- a/crate/params/src/value_spec.rs +++ b/crate/params/src/value_spec.rs @@ -17,7 +17,7 @@ use crate::{ /// For deserialization: /// /// 1. A `ParamsSpecsTypeReg` is constructed, and deserialization functions are -/// registered from `ItemId` to `ValueSpecDe`, where `F` and `U` are +/// registered from `StepId` to `ValueSpecDe`, where `F` and `U` are /// derived from the `ValueSpec` provided by the user. /// /// 2. `value_specs.yaml` is deserialized using that type registry. @@ -26,7 +26,7 @@ use crate::{ /// `AnySpecRtBoxed` to be passed around in a `CmdCtx`. /// /// 4. These `AnySpecRtBoxed`s are downcasted back to `ValueSpec` when -/// resolving values for item params and params partials. +/// resolving values for step params and params partials. #[derive(Clone, Serialize, Deserialize)] #[serde(from = "crate::ValueSpecDe")] pub enum ValueSpec diff --git a/crate/params/src/value_spec_rt.rs b/crate/params/src/value_spec_rt.rs index b996855ad..0551a7ddb 100644 --- a/crate/params/src/value_spec_rt.rs +++ b/crate/params/src/value_spec_rt.rs @@ -7,7 +7,7 @@ use crate::{AnySpecRt, ParamsResolveError, ValueResolutionCtx}; /// Runtime logic of how to look up values for each field in this struct. /// /// This trait is automatically implemented by `#[derive(Params)]` on an -/// `Item::Params`, as well as in the `peace_params` crate for standard +/// `Step::Params`, as well as in the `peace_params` crate for standard /// library types. pub trait ValueSpecRt: AnySpecRt { /// The original value type. `MyParamsValueSpec::ValueType` is `MyParams`. diff --git a/crate/params_derive/src/impl_field_wise_builder.rs b/crate/params_derive/src/impl_field_wise_builder.rs index a0d10d638..24cbb7927 100644 --- a/crate/params_derive/src/impl_field_wise_builder.rs +++ b/crate/params_derive/src/impl_field_wise_builder.rs @@ -404,7 +404,7 @@ fn builder_field_methods( // .build(); // // let mut cmd_ctx = // .. - // .with_item_params::<_>(item_id, params_spec) + // .with_step_params::<_>(step_id, params_spec) // .await?; // ``` quote! { diff --git a/crate/params_derive/src/impl_from_params_for_params_partial.rs b/crate/params_derive/src/impl_from_params_for_params_partial.rs index cdf7e65d6..db90c143d 100644 --- a/crate/params_derive/src/impl_from_params_for_params_partial.rs +++ b/crate/params_derive/src/impl_from_params_for_params_partial.rs @@ -6,7 +6,7 @@ use syn::{ use crate::util::{fields_deconstruct, fields_deconstruct_some, variant_match_arm}; /// `impl From for ParamsPartial`, so that users can use -/// `params_partial.try_into()` in `Item::try_state_*` without needing to +/// `params_partial.try_into()` in `Step::try_state_*` without needing to /// deconstruct the `Params::Partial`. pub fn impl_from_params_for_params_partial( ast: &DeriveInput, diff --git a/crate/params_derive/src/impl_try_from_params_partial_for_params.rs b/crate/params_derive/src/impl_try_from_params_partial_for_params.rs index fef8db15f..7f94f89b2 100644 --- a/crate/params_derive/src/impl_try_from_params_partial_for_params.rs +++ b/crate/params_derive/src/impl_try_from_params_partial_for_params.rs @@ -9,7 +9,7 @@ use crate::util::{ }; /// `impl TryFrom for Params`, so that users can use -/// `params_partial.try_into()` in `Item::try_state_*` without needing to +/// `params_partial.try_into()` in `Step::try_state_*` without needing to /// deconstruct the `Params::Partial`. pub fn impl_try_from_params_partial_for_params( ast: &DeriveInput, diff --git a/crate/params_derive/src/lib.rs b/crate/params_derive/src/lib.rs index bc827eafc..6c54f2e65 100644 --- a/crate/params_derive/src/lib.rs +++ b/crate/params_derive/src/lib.rs @@ -89,7 +89,7 @@ mod util; )] pub fn value_spec(input: TokenStream) -> TokenStream { let mut ast = syn::parse(input) - .expect("`Params` derive: Failed to parse item as struct, enum, or union."); + .expect("`Params` derive: Failed to parse input as struct, enum, or union."); let gen = impl_value(&mut ast, ImplMode::Fieldwise); @@ -123,7 +123,7 @@ pub fn value_spec(input: TokenStream) -> TokenStream { )] pub fn value_spec_fieldless(input: TokenStream) -> TokenStream { let mut ast = syn::parse(input) - .expect("`ParamsFieldless` derive: Failed to parse item as struct, enum, or union."); + .expect("`ParamsFieldless` derive: Failed to parse input as struct, enum, or union."); let gen = impl_value(&mut ast, ImplMode::Fieldless); @@ -133,7 +133,7 @@ pub fn value_spec_fieldless(input: TokenStream) -> TokenStream { #[proc_macro] pub fn value_impl(input: TokenStream) -> TokenStream { let mut ast = syn::parse(input) - .expect("`peace_params::value_impl`: Failed to parse item as struct, enum, or union."); + .expect("`peace_params::value_impl`: Failed to parse input as struct, enum, or union."); let gen = impl_value(&mut ast, ImplMode::Fieldless); @@ -362,7 +362,7 @@ fn t_partial( &[ parse_quote! { #[doc="\ - Item parameters that may not necessarily have values.\n\ + Step parameters that may not necessarily have values.\n\ \n\ This is used for `try_state_current` and `try_state_goal` where values \n\ could be referenced from predecessors, which may not yet be available, such \n\ @@ -414,7 +414,7 @@ fn t_partial_external( &[ parse_quote! { #[doc="\ - Item parameters that may not necessarily have values.\n\ + Step parameters that may not necessarily have values.\n\ \n\ This is used for `try_state_current` and `try_state_goal` where values \n\ could be referenced from predecessors, which may not yet be available, such \n\ diff --git a/crate/params_derive/src/util.rs b/crate/params_derive/src/util.rs index 81fd00ebb..cb2e3589b 100644 --- a/crate/params_derive/src/util.rs +++ b/crate/params_derive/src/util.rs @@ -37,7 +37,7 @@ static STD_LIB_TYPES: &[&str] = &[ /// This attribute must be: /// /// * attached to std library types defined outside the `peace_params` crate. -/// * attached to each `Params`' field defined outside the item crate. +/// * attached to each `Params`' field defined outside the step crate. pub fn is_fieldless_type(ast: &DeriveInput) -> bool { is_known_fieldless_std_lib_spec(&ast.ident) || is_tagged_fieldless(&ast.attrs) } @@ -57,7 +57,7 @@ fn is_known_fieldless_std_lib_spec(ty_name: &Ident) -> bool { /// /// * attached to std library types defined outside the `peace_params` crate, if /// it isn't already covered by `STD_LIB_TYPES`. -/// * attached to each field in `Params` that is defined outside the item crate. +/// * attached to each field in `Params` that is defined outside the step crate. pub fn is_tagged_fieldless(attrs: &[Attribute]) -> bool { attrs.iter().any(|attr| { if attr.path().is_ident("value_spec") { diff --git a/crate/resources/src/internal/state_diffs_mut.rs b/crate/resources/src/internal/state_diffs_mut.rs index 270dfc24e..65e1ffa47 100644 --- a/crate/resources/src/internal/state_diffs_mut.rs +++ b/crate/resources/src/internal/state_diffs_mut.rs @@ -1,10 +1,10 @@ use std::ops::{Deref, DerefMut}; -use peace_core::ItemId; +use peace_core::StepId; use serde::Serialize; use type_reg::untagged::{BoxDtDisplay, TypeMap}; -/// Diffs of `State`s for each `Item`s. `TypeMap` +/// Diffs of `State`s for each `Step`s. `TypeMap` /// newtype. /// /// # Implementors @@ -15,7 +15,7 @@ use type_reg::untagged::{BoxDtDisplay, TypeMap}; /// [`StateDiffs`]: crate::StateDiffs /// [`Resources`]: crate::Resources #[derive(Debug, Default, Serialize)] -pub struct StateDiffsMut(TypeMap); +pub struct StateDiffsMut(TypeMap); impl StateDiffsMut { /// Returns a new `StateDiffsMut` map. @@ -32,13 +32,13 @@ impl StateDiffsMut { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } impl Deref for StateDiffsMut { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 @@ -51,16 +51,16 @@ impl DerefMut for StateDiffsMut { } } -impl From> for StateDiffsMut { - fn from(type_map: TypeMap) -> Self { +impl From> for StateDiffsMut { + fn from(type_map: TypeMap) -> Self { Self(type_map) } } -impl Extend<(ItemId, BoxDtDisplay)> for StateDiffsMut { - fn extend>(&mut self, iter: T) { - iter.into_iter().for_each(|(item_id, state_diff)| { - self.insert_raw(item_id, state_diff); +impl Extend<(StepId, BoxDtDisplay)> for StateDiffsMut { + fn extend>(&mut self, iter: T) { + iter.into_iter().for_each(|(step_id, state_diff)| { + self.insert_raw(step_id, state_diff); }); } } diff --git a/crate/resources/src/internal/states_mut.rs b/crate/resources/src/internal/states_mut.rs index f76b7eb1c..c9a103c2b 100644 --- a/crate/resources/src/internal/states_mut.rs +++ b/crate/resources/src/internal/states_mut.rs @@ -3,17 +3,17 @@ use std::{ ops::{Deref, DerefMut}, }; -use peace_core::ItemId; +use peace_core::StepId; use serde::Serialize; use type_reg::untagged::{BoxDtDisplay, TypeMap}; -/// `State`s for all `Item`s. `TypeMap` newtype. +/// `State`s for all `Step`s. `TypeMap` newtype. /// /// # Implementors /// -/// To reference State from another `Item`, in `Item::Data`, you should +/// To reference State from another `Step`, in `Step::Data`, you should /// reference [`Current`] or [`Goal`], where `T` is the predecessor -/// item's state. +/// step's state. /// /// # Type Parameters /// @@ -26,7 +26,7 @@ use type_reg::untagged::{BoxDtDisplay, TypeMap}; /// [`StatesCurrent`]: crate::StatesCurrent /// [`StatesRw`]: crate::StatesRw #[derive(Debug, Serialize)] -pub struct StatesMut(TypeMap, PhantomData); +pub struct StatesMut(TypeMap, PhantomData); impl StatesMut { /// Returns a new `StatesMut` map. @@ -43,7 +43,7 @@ impl StatesMut { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } @@ -55,7 +55,7 @@ impl Default for StatesMut { } impl Deref for StatesMut { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 @@ -68,16 +68,16 @@ impl DerefMut for StatesMut { } } -impl From> for StatesMut { - fn from(type_map: TypeMap) -> Self { +impl From> for StatesMut { + fn from(type_map: TypeMap) -> Self { Self(type_map, PhantomData) } } -impl Extend<(ItemId, BoxDtDisplay)> for StatesMut { - fn extend>(&mut self, iter: T) { - iter.into_iter().for_each(|(item_id, state)| { - self.insert_raw(item_id, state); +impl Extend<(StepId, BoxDtDisplay)> for StatesMut { + fn extend>(&mut self, iter: T) { + iter.into_iter().for_each(|(step_id, state)| { + self.insert_raw(step_id, state); }); } } diff --git a/crate/resources/src/lib.rs b/crate/resources/src/lib.rs index 16339077a..491236a93 100644 --- a/crate/resources/src/lib.rs +++ b/crate/resources/src/lib.rs @@ -7,11 +7,11 @@ pub use resman::*; pub use type_reg; -pub use crate::{item_rt_id::ItemRtId, resources::Resources}; +pub use crate::{step_rt_id::StepRtId, resources::Resources}; pub mod internal; pub mod paths; pub mod resources; pub mod states; -mod item_rt_id; +mod step_rt_id; diff --git a/crate/resources/src/paths.rs b/crate/resources/src/paths.rs index 4231c1008..49b54e805 100644 --- a/crate/resources/src/paths.rs +++ b/crate/resources/src/paths.rs @@ -38,7 +38,7 @@ //! | | |- 00000007_2022-08-23T13_07_31_artifact_publish.yaml //! | | //! | |- .meta.yaml # Store the last discovered time so we can inform the user. -//! | | # Should time be stored per item, or per invocation? +//! | | # Should time be stored per step, or per invocation? //! | | //! | |- dev_env # flow name //! | | |- states_goal.yaml diff --git a/crate/resources/src/paths/params_specs_file.rs b/crate/resources/src/paths/params_specs_file.rs index 71e475cfd..605575574 100644 --- a/crate/resources/src/paths/params_specs_file.rs +++ b/crate/resources/src/paths/params_specs_file.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use crate::paths::FlowDir; -/// Path to the file that stores items' states. +/// Path to the file that stores steps' states. /// /// Typically `$workspace_dir/.peace/$profile/$flow_id/params_specs.yaml`. /// diff --git a/crate/resources/src/paths/states_current_file.rs b/crate/resources/src/paths/states_current_file.rs index f0dd95368..f0e79a59a 100644 --- a/crate/resources/src/paths/states_current_file.rs +++ b/crate/resources/src/paths/states_current_file.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use crate::paths::FlowDir; -/// Path to the file that stores items' states. +/// Path to the file that stores steps' states. /// /// Typically `$workspace_dir/.peace/$profile/$flow_id/states_current.yaml`. /// diff --git a/crate/resources/src/paths/states_goal_file.rs b/crate/resources/src/paths/states_goal_file.rs index 3e2a9687d..55b3718b6 100644 --- a/crate/resources/src/paths/states_goal_file.rs +++ b/crate/resources/src/paths/states_goal_file.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use crate::paths::FlowDir; -/// Path to the file that stores items' states. +/// Path to the file that stores steps' states. /// /// Typically `$workspace_dir/.peace/$profile/$flow_id/states_goal.yaml`. /// diff --git a/crate/resources/src/resources.rs b/crate/resources/src/resources.rs index d8ca41f37..130807f65 100644 --- a/crate/resources/src/resources.rs +++ b/crate/resources/src/resources.rs @@ -20,7 +20,7 @@ pub mod ts; /// /// * `TS`: The type state of the `Resources` map. /// -/// [`ItemId`]: peace_cfg::ItemId +/// [`StepId`]: peace_cfg::StepId #[derive(Debug)] pub struct Resources { inner: resman::Resources, @@ -64,7 +64,7 @@ impl DerefMut for Resources { } } -// For `ItemGraph` after resources have been set up. +// For `StepGraph` after resources have been set up. impl From> for Resources { fn from(resources: Resources) -> Self { Self { diff --git a/crate/resources/src/resources/ts.rs b/crate/resources/src/resources/ts.rs index 1b96acc9e..92b7dc1db 100644 --- a/crate/resources/src/resources/ts.rs +++ b/crate/resources/src/resources/ts.rs @@ -12,6 +12,6 @@ #[derive(Debug)] pub struct Empty; -/// `Item::setup` has been run over [`Resources`]. +/// `Step::setup` has been run over [`Resources`]. #[derive(Debug)] pub struct SetUp; diff --git a/crate/resources/src/states.rs b/crate/resources/src/states.rs index 8a5f30f88..15ba7fecb 100644 --- a/crate/resources/src/states.rs +++ b/crate/resources/src/states.rs @@ -13,7 +13,7 @@ pub mod ts; use std::{marker::PhantomData, ops::Deref}; -use peace_core::ItemId; +use peace_core::StepId; use peace_fmt::{Presentable, Presenter}; use serde::Serialize; use type_reg::untagged::{BoxDtDisplay, TypeMap}; @@ -33,7 +33,7 @@ mod states_goal_stored; mod states_previous; mod states_serde; -/// Map of `State`s for all `Item`s. `TypeMap` newtype. +/// Map of `State`s for all `Step`s. `TypeMap` newtype. /// /// # Type Parameters /// @@ -45,41 +45,41 @@ mod states_serde; /// /// # Design /// -/// When states are serialized, we want there to be an entry for each item. +/// When states are serialized, we want there to be an entry for each step. /// -/// 1. This means the `States` map should contain an entry for each item, -/// regardless of whether a `State` is recorded for that item. +/// 1. This means the `States` map should contain an entry for each step, +/// regardless of whether a `State` is recorded for that step. /// -/// 2. Inserting an `Option<_>` layer around the `Item::State` turns the map -/// into a `Map>`. +/// 2. Inserting an `Option<_>` layer around the `Step::State` turns the map +/// into a `Map>`. /// -/// 3. Calling `states.get(item_id)` returns `Option>`, the -/// outer layer for whether the item had an entry, and the inner layer for +/// 3. Calling `states.get(step_id)` returns `Option>`, the +/// outer layer for whether the step had an entry, and the inner layer for /// whether there was any `State` recorded. /// -/// 4. If we can guarantee the item ID is valid -- an ID of a step in the flow +/// 4. If we can guarantee the step ID is valid -- an ID of a step in the flow /// -- we could remove that outer `Option` layer. Currently we cannot make /// this guarantee, as: /// -/// - item IDs are constructed by developer code, without any constraints -/// for which items are inserted into the Flow, and which are inserted +/// - step IDs are constructed by developer code, without any constraints +/// for which steps are inserted into the Flow, and which are inserted /// into `States` -- although insertion into `States` is largely managed /// by `peace`. /// -/// - `States` may contain different items across different versions of an +/// - `States` may contain different steps across different versions of an /// automation tool, so it is possible (and valid) to: /// -/// + Deserialize `States` that contain states for `Item`s that are no +/// + Deserialize `States` that contain states for `Step`s that are no /// longer in the flow. -/// + Deserialize `States` that do not contain states for `Item`s that +/// + Deserialize `States` that do not contain states for `Step`s that /// are newly added to the flow. -/// + Have a combination of the above for renamed items. +/// + Have a combination of the above for renamed steps. /// /// 5. For clarity of each of these `Option` layers, we can wrap them in a /// newtype. /// /// 6. For code cleanliness, this additional layer requires calling -/// [`flatten()`] on `states.get(item_id)`. +/// [`flatten()`] on `states.get(step_id)`. /// /// 7. We *could* introduce a different type during serialization that handles /// this additional layer, to remove the additional `flatten()`. How do we @@ -92,31 +92,31 @@ mod states_serde; /// /// ## `StatesSerde` Separate Type /// -/// Newtype for `Map>`. +/// Newtype for `Map>`. /// -/// ### Item Additions +/// ### Step Additions /// -/// * Flow contains the `Item`. -/// * Stored state doesn't contain an entry for the item. -/// * Deserialized `StatesSerde` should contain `(item_id!("new"), None)` -- may +/// * Flow contains the `Step`. +/// * Stored state doesn't contain an entry for the step. +/// * Deserialized `StatesSerde` should contain `(step_id!("new"), None)` -- may /// need custom deserialization code. /// -/// ### Item Removals +/// ### Step Removals /// -/// * Flow does not contain the `Item`. -/// * Stored state contains an entry for the item, but cannot be deserialized. +/// * Flow does not contain the `Step`. +/// * Stored state contains an entry for the step, but cannot be deserialized. /// * Deserialized `StatesSerde` would not contain any entry. -/// * Deserialization will return the unable to be deserialized item state in +/// * Deserialization will return the unable to be deserialized step state in /// the return value. Meaning, `StatesSerde` will contain it in a separate /// "removed" field. /// /// After deserialization, `StatesSerde` is explicitly mapped into `States`, and -/// we can inform the developer and/or user of the removed items if it is +/// we can inform the developer and/or user of the removed steps if it is /// useful. /// -/// ## `States` With Optional Item State +/// ## `States` With Optional Step State /// -/// Developers will frequently use `states.get(item_id).flatten()` to access +/// Developers will frequently use `states.get(step_id).flatten()` to access /// state. /// /// Deserialization has all the same properties as the `StatesSerde` separate @@ -128,16 +128,16 @@ mod states_serde; /// encountered? If so, then: /// /// * `peace` should store the version of the flow in the stored states files -/// * items that have ever been used in flows must be shipped in the automation +/// * steps that have ever been used in flows must be shipped in the automation /// software, in order to support safe upgrades. /// /// How would this work? /// -/// * Newly added items just work. -/// * Removed items need to be removed: +/// * Newly added steps just work. +/// * Removed steps need to be removed: /// - Successors may need their parameters specified from new predecessors. -/// - If removing multiple items, we need to clean them in reverse. -/// * Renamed items may need to be re-applied, or potentially cleaned and +/// - If removing multiple steps, we need to clean them in reverse. +/// * Renamed steps may need to be re-applied, or potentially cleaned and /// re-ensured. This doesn't support data retention if a predecessor needs to /// be cleaned, forcing successors to be cleaned, and reensured after. Unless, /// `peace` supports backup and restore. @@ -146,7 +146,7 @@ mod states_serde; #[derive(Debug, Serialize)] #[serde(transparent)] // Needed to serialize as a map instead of a list. pub struct States( - pub(crate) TypeMap, + pub(crate) TypeMap, pub(crate) PhantomData, ); @@ -165,7 +165,7 @@ impl States { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } @@ -176,7 +176,7 @@ impl Clone for States { clone.0.extend( self.0 .iter() - .map(|(item_id, state)| (item_id.clone(), state.clone())), + .map(|(step_id, state)| (step_id.clone(), state.clone())), ); clone @@ -190,15 +190,15 @@ impl Default for States { } impl Deref for States { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 } } -impl From> for States { - fn from(type_map: TypeMap) -> Self { +impl From> for States { + fn from(type_map: TypeMap) -> Self { Self(type_map, PhantomData) } } @@ -216,8 +216,8 @@ impl Presentable for States { PR: Presenter<'output>, { presenter - .list_numbered_with(self.iter(), |(item_id, state)| { - (item_id, format!(": {state}")) + .list_numbered_with(self.iter(), |(step_id, state)| { + (step_id, format!(": {state}")) }) .await } diff --git a/crate/resources/src/states/state_diffs.rs b/crate/resources/src/states/state_diffs.rs index 34b56948a..d209a86d9 100644 --- a/crate/resources/src/states/state_diffs.rs +++ b/crate/resources/src/states/state_diffs.rs @@ -1,13 +1,13 @@ use std::ops::Deref; -use peace_core::ItemId; +use peace_core::StepId; use peace_fmt::{Presentable, Presenter}; use serde::Serialize; use type_reg::untagged::{BoxDtDisplay, TypeMap}; use crate::internal::StateDiffsMut; -/// Diffs of `State`s for each `Item`s. `TypeMap` +/// Diffs of `State`s for each `Step`s. `TypeMap` /// newtype. /// /// [`External`] fields are not necessarily used in `StateDiff` computations. @@ -20,7 +20,7 @@ use crate::internal::StateDiffsMut; /// [`External`]: peace_cfg::state::External /// [`Resources`]: crate::Resources #[derive(Debug, Default, Serialize)] -pub struct StateDiffs(TypeMap); +pub struct StateDiffs(TypeMap); impl StateDiffs { /// Returns a new `StateDiffs` map. @@ -37,21 +37,21 @@ impl StateDiffs { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } impl Deref for StateDiffs { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 } } -impl From> for StateDiffs { - fn from(type_map: TypeMap) -> Self { +impl From> for StateDiffs { + fn from(type_map: TypeMap) -> Self { Self(type_map) } } @@ -69,8 +69,8 @@ impl Presentable for StateDiffs { PR: Presenter<'output>, { presenter - .list_numbered_with(self.iter(), |(item_id, state_diff)| { - (item_id, format!(": {state_diff}")) + .list_numbered_with(self.iter(), |(step_id, state_diff)| { + (step_id, format!(": {state_diff}")) }) .await } diff --git a/crate/resources/src/states/states_clean.rs b/crate/resources/src/states/states_clean.rs index e619b2a3c..5a78a02ab 100644 --- a/crate/resources/src/states/states_clean.rs +++ b/crate/resources/src/states/states_clean.rs @@ -1,8 +1,8 @@ use crate::states::{ts::Clean, States}; -/// Clean `State`s for all `Item`s. +/// Clean `State`s for all `Step`s. /// -/// These are the states that each item would be in, if `Item::apply` were to be +/// These are the states that each step would be in, if `Step::apply` were to be /// run with `state_clean` as the target state. /// /// **Note:** Not to be confused with [`StatesCleaned`]. diff --git a/crate/resources/src/states/states_cleaned.rs b/crate/resources/src/states/states_cleaned.rs index 26b13e4ce..f642f9329 100644 --- a/crate/resources/src/states/states_cleaned.rs +++ b/crate/resources/src/states/states_cleaned.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::Cleaned, States, StatesCurrent}; -/// Cleaned `State`s for all `Item`s. `TypeMap` newtype. +/// Cleaned `State`s for all `Step`s. `TypeMap` newtype. /// /// These are the `State`s collected after `CleanOpSpec::exec` has been run. /// diff --git a/crate/resources/src/states/states_cleaned_dry.rs b/crate/resources/src/states/states_cleaned_dry.rs index 97f235eed..771ed9ec0 100644 --- a/crate/resources/src/states/states_cleaned_dry.rs +++ b/crate/resources/src/states/states_cleaned_dry.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::CleanedDry, States, StatesCurrent}; -/// Dry-run ensured `State`s for all `Item`s. +/// Dry-run ensured `State`s for all `Step`s. /// /// These are the `State`s collected after `CleanOpSpec::exec_dry` has been /// run. diff --git a/crate/resources/src/states/states_current.rs b/crate/resources/src/states/states_current.rs index 13281fa5f..7d0b7cf44 100644 --- a/crate/resources/src/states/states_current.rs +++ b/crate/resources/src/states/states_current.rs @@ -5,7 +5,7 @@ use crate::states::{ States, }; -/// Current `State`s for all `Item`s. +/// Current `State`s for all `Step`s. /// /// This is strictly only present when the [`States`] are discovered in the /// current execution. `States` read from the [`StatesCurrentFile`] are @@ -15,7 +15,7 @@ use crate::states::{ /// # Implementors /// /// If a `Step`'s state discovery depends on the `State` of a previous -/// `Item`, then you should insert the predecessor's state into +/// `Step`, then you should insert the predecessor's state into /// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]: /// /// ```rust @@ -42,7 +42,7 @@ use crate::states::{ /// /// You may reference [`StatesCurrent`] in `ApplyFns::Data` for reading. It /// is not mutable as `StatesCurrent` must remain unchanged so that all -/// `Item`s operate over consistent data. +/// `Step`s operate over consistent data. /// /// [`Data`]: peace_data::Data /// [`Resources`]: crate::Resources diff --git a/crate/resources/src/states/states_current_stored.rs b/crate/resources/src/states/states_current_stored.rs index 9ee60eff4..3b547cd13 100644 --- a/crate/resources/src/states/states_current_stored.rs +++ b/crate/resources/src/states/states_current_stored.rs @@ -5,7 +5,7 @@ use crate::states::{ States, }; -/// Stored current `State`s for all `Item`s. +/// Stored current `State`s for all `Step`s. /// /// This is loaded into [`Resources`] at the beginning of any command execution, /// from the [`StatesCurrentFile`]. @@ -20,7 +20,7 @@ use crate::states::{ /// # Implementors /// /// If a `Step`'s state discovery depends on the `State` of a previous -/// `Item`, then you should insert the predecessor's state into +/// `Step`, then you should insert the predecessor's state into /// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]: /// /// ```rust @@ -47,7 +47,7 @@ use crate::states::{ /// /// You may reference [`StatesCurrentStored`] in `ApplyFns::Data` for reading. /// It is not mutable as `StatesCurrentStored` must remain unchanged so that all -/// `Item`s operate over consistent data. +/// `Step`s operate over consistent data. /// /// [`StatesCurrentFile`]: crate::paths::StatesCurrentFile /// [`Data`]: peace_data::Data diff --git a/crate/resources/src/states/states_ensured.rs b/crate/resources/src/states/states_ensured.rs index c97ef2545..34a965d6b 100644 --- a/crate/resources/src/states/states_ensured.rs +++ b/crate/resources/src/states/states_ensured.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::Ensured, States, StatesCurrent}; -/// Ensured `State`s for all `Item`s. `TypeMap` newtype. +/// Ensured `State`s for all `Step`s. `TypeMap` newtype. /// /// These are the `State`s collected after `ApplyFns::exec` has been run. /// diff --git a/crate/resources/src/states/states_ensured_dry.rs b/crate/resources/src/states/states_ensured_dry.rs index af7ed3307..b0043c964 100644 --- a/crate/resources/src/states/states_ensured_dry.rs +++ b/crate/resources/src/states/states_ensured_dry.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::EnsuredDry, States, StatesCurrent}; -/// Dry-run ensured `State`s for all `Item`s. +/// Dry-run ensured `State`s for all `Step`s. /// /// These are the `State`s collected after `ApplyFns::exec_dry` has been /// run. diff --git a/crate/resources/src/states/states_goal.rs b/crate/resources/src/states/states_goal.rs index 16e3698b9..21e02b701 100644 --- a/crate/resources/src/states/states_goal.rs +++ b/crate/resources/src/states/states_goal.rs @@ -5,15 +5,15 @@ use crate::states::{ States, }; -/// Goal `State`s for all `Item`s. +/// Goal `State`s for all `Step`s. /// -/// These are the states that each item would be in, if `Item::apply` were to be +/// These are the states that each step would be in, if `Step::apply` were to be /// run with `state_goal` as the target state. /// /// # Implementors /// /// If a `Step`'s goal state discovery depends on the goal `State` of -/// a previous `Item`, then you should insert the predecessor's goal +/// a previous `Step`, then you should insert the predecessor's goal /// state into [`Resources`], and reference that in the subsequent /// `TryFnSpec`'s [`Data`]: /// @@ -41,7 +41,7 @@ use crate::states::{ /// /// You may reference [`StatesGoal`] in `ApplyFns::Data` for reading. It /// is not mutable as `StatesGoal` must remain unchanged so that all -/// `Item`s operate over consistent data. +/// `Step`s operate over consistent data. /// /// [`Data`]: peace_data::Data /// [`Resources`]: crate::Resources diff --git a/crate/resources/src/states/states_goal_stored.rs b/crate/resources/src/states/states_goal_stored.rs index 4e366efa0..157c27008 100644 --- a/crate/resources/src/states/states_goal_stored.rs +++ b/crate/resources/src/states/states_goal_stored.rs @@ -5,9 +5,9 @@ use crate::states::{ States, }; -/// Stored goal `State`s for all `Item`s. +/// Stored goal `State`s for all `Step`s. /// -/// These are the states that each item would be in, if `Item::apply` were to be +/// These are the states that each step would be in, if `Step::apply` were to be /// run with `state_goal` as the target state. /// /// This is loaded into [`Resources`] at the beginning of any command execution, diff --git a/crate/resources/src/states/states_previous.rs b/crate/resources/src/states/states_previous.rs index 35185845c..54143551a 100644 --- a/crate/resources/src/states/states_previous.rs +++ b/crate/resources/src/states/states_previous.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::Previous, States, StatesCurrent}; -/// Previous `State`s for all `Item`s. +/// Previous `State`s for all `Step`s. /// /// This is present when an `ApplyCmd` (`EnsureCmd` or `CleanCmd`) is run, /// whereby the current states have changed to the newly ensured states. diff --git a/crate/resources/src/states/states_serde.rs b/crate/resources/src/states/states_serde.rs index 4428cd2f3..3ce04ab53 100644 --- a/crate/resources/src/states/states_serde.rs +++ b/crate/resources/src/states/states_serde.rs @@ -2,33 +2,33 @@ use std::{fmt::Debug, ops::Deref}; -use peace_core::ItemId; +use peace_core::StepId; use serde::Serialize; use type_reg::{ common::UnknownEntriesSome, untagged::{BoxDtDisplay, TypeMapOpt}, }; -/// Map of `State`s for all `Item`s. `TypeMapOpt` +/// Map of `State`s for all `Step`s. `TypeMapOpt` /// newtype. /// -/// Conceptually you can think of this as a `Map>`. +/// Conceptually you can think of this as a `Map>`. /// /// This map should: /// -/// * Always contain an entry for every item in the flow. -/// * Contain an unknown entry for deserialized unknown items. +/// * Always contain an entry for every step in the flow. +/// * Contain an unknown entry for deserialized unknown steps. /// /// This map can be initialized either through one of: /// /// * Deserialization. -/// * `From<&ItemGraph>`: All states are initialized to `None`. -/// * [`FromIterator::<(ItemId, Option)>::from_iter`]. +/// * `From<&StepGraph>`: All states are initialized to `None`. +/// * [`FromIterator::<(StepId, Option)>::from_iter`]. /// -/// [`FromIterator::<(ItemId, Option)>::from_iter`]: std::iter::FromIterator +/// [`FromIterator::<(StepId, Option)>::from_iter`]: std::iter::FromIterator #[derive(Debug, Serialize)] #[serde(transparent)] // Needed to serialize as a map instead of a list. -pub struct StatesSerde(TypeMapOpt>) +pub struct StatesSerde(TypeMapOpt>) where ValueT: Clone + Debug + PartialEq + Eq; @@ -45,7 +45,7 @@ where } /// Returns the inner map. - pub fn into_inner(self) -> TypeMapOpt> { + pub fn into_inner(self) -> TypeMapOpt> { self.0 } } @@ -59,7 +59,7 @@ where clone.0.extend( self.0 .iter() - .map(|(item_id, state)| (item_id.clone(), state.clone())), + .map(|(step_id, state)| (step_id.clone(), state.clone())), ); clone @@ -70,34 +70,34 @@ impl Deref for StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, { - type Target = TypeMapOpt>; + type Target = TypeMapOpt>; fn deref(&self) -> &Self::Target { &self.0 } } -impl FromIterator<(ItemId, Option)> for StatesSerde +impl FromIterator<(StepId, Option)> for StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, { - fn from_iter)>>(iter: T) -> Self { + fn from_iter)>>(iter: T) -> Self { iter.into_iter().fold( Self(TypeMapOpt::new_typed()), - |mut states_serde, (item_id, state_boxed)| { - states_serde.0.insert_raw(item_id, state_boxed); + |mut states_serde, (step_id, state_boxed)| { + states_serde.0.insert_raw(step_id, state_boxed); states_serde }, ) } } -impl From>> +impl From>> for StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, { - fn from(type_map_opt: TypeMapOpt>) -> Self { + fn from(type_map_opt: TypeMapOpt>) -> Self { Self(type_map_opt) } } diff --git a/crate/resources/src/states/ts.rs b/crate/resources/src/states/ts.rs index 08dd9ee09..12cc0b697 100644 --- a/crate/resources/src/states/ts.rs +++ b/crate/resources/src/states/ts.rs @@ -6,47 +6,47 @@ use serde::{Deserialize, Serialize}; -/// Clean / blank states of items. +/// Clean / blank states of steps. /// /// Not to be confused with [`Cleaned`]. #[derive(Debug, Deserialize, Serialize)] pub struct Clean; -/// Stored current states of items. +/// Stored current states of steps. #[derive(Debug, Deserialize, Serialize)] pub struct CurrentStored; -/// Current states of items. +/// Current states of steps. #[derive(Debug, Deserialize, Serialize)] pub struct Current; -/// Stored goal states of items. +/// Stored goal states of steps. #[derive(Debug, Deserialize, Serialize)] pub struct GoalStored; -/// Goal states of items. +/// Goal states of steps. #[derive(Debug, Deserialize, Serialize)] pub struct Goal; -/// States of items after running the `EnsureCmd`. +/// States of steps after running the `EnsureCmd`. #[derive(Debug, Deserialize, Serialize)] pub struct Ensured; -/// States of items after dry-running `EnsureCmd`. +/// States of steps after dry-running `EnsureCmd`. #[derive(Debug, Deserialize, Serialize)] pub struct EnsuredDry; -/// States of items after running the `CleanCmd`. +/// States of steps after running the `CleanCmd`. /// /// Not to be confused with [`Clean`]. #[derive(Debug, Deserialize, Serialize)] pub struct Cleaned; -/// States of items after dry-running `CleanCmd`. +/// States of steps after dry-running `CleanCmd`. #[derive(Debug, Deserialize, Serialize)] pub struct CleanedDry; -/// Previous states of items. +/// Previous states of steps. /// /// This is intended as a record of `States` before an `ApplyCmd` (`EnsureCmd` /// or `CleanCmd`) are run. diff --git a/crate/resources/src/step_rt_id.rs b/crate/resources/src/step_rt_id.rs index 332a5dccf..4c42fbd83 100644 --- a/crate/resources/src/step_rt_id.rs +++ b/crate/resources/src/step_rt_id.rs @@ -5,14 +5,14 @@ use peace_data::fn_graph::FnId; /// Runtime identifier for a [`Step`]. [`FnId`] newtype. /// /// This is a cheap identifier to copy around, instead of cloning -/// [`ItemId`]. +/// [`StepId`]. /// -/// [`ItemId`]: peace_cfg::ItemId +/// [`StepId`]: peace_cfg::StepId #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub struct ItemRtId(FnId); +pub struct StepRtId(FnId); -impl ItemRtId { - /// Returns a new `ItemRtId`. +impl StepRtId { + /// Returns a new `StepRtId`. pub fn new(fn_id: FnId) -> Self { Self(fn_id) } @@ -23,7 +23,7 @@ impl ItemRtId { } } -impl Deref for ItemRtId { +impl Deref for StepRtId { type Target = FnId; fn deref(&self) -> &Self::Target { @@ -31,19 +31,19 @@ impl Deref for ItemRtId { } } -impl DerefMut for ItemRtId { +impl DerefMut for StepRtId { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl From for ItemRtId { +impl From for StepRtId { fn from(index: usize) -> Self { Self(FnId::new(index)) } } -impl From for ItemRtId { +impl From for StepRtId { fn from(fn_id: FnId) -> Self { Self(fn_id) } diff --git a/crate/rt/src/cmd_blocks.rs b/crate/rt/src/cmd_blocks.rs index 54be86333..c13925bf9 100644 --- a/crate/rt/src/cmd_blocks.rs +++ b/crate/rt/src/cmd_blocks.rs @@ -1,6 +1,6 @@ -//! Blocks of logic that run one [`Item`] function +//! Blocks of logic that run one [`Step`] function //! -//! [`Item`]: peace_cfg::Item +//! [`Step`]: peace_cfg::Step pub use self::{ apply_exec_cmd_block::ApplyExecCmdBlock, diff --git a/crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs b/crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs index f81310299..3df4c772d 100644 --- a/crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs @@ -2,7 +2,7 @@ use std::{fmt::Debug, marker::PhantomData}; use fn_graph::{StreamOpts, StreamOutcome}; use futures::join; -use peace_cfg::{ApplyCheck, FnCtx, ItemId}; +use peace_cfg::{ApplyCheck, FnCtx, StepId}; use peace_cmd::{ctx::CmdCtxTypesConstrained, scopes::SingleProfileSingleFlowView}; use peace_cmd_model::CmdBlockOutcome; use peace_cmd_rt::{async_trait, CmdBlock}; @@ -17,8 +17,8 @@ use peace_resources::{ ResourceFetchError, Resources, }; use peace_rt_model::{ - outcomes::{ItemApplyBoxed, ItemApplyPartialBoxed}, - ItemBoxed, ItemRt, + outcomes::{StepApplyBoxed, StepApplyPartialBoxed}, + StepBoxed, StepRt, }; use tokio::sync::mpsc::{self, Receiver}; @@ -123,40 +123,40 @@ where /// up: /// /// ```rust,ignore - /// async fn item_apply_exec( + /// async fn step_apply_exec( /// resources: &Resources, - /// outcomes_tx: &Sender::AppError>>, - /// item: FnRef<'_, ItemBoxed<::AppError>>, + /// outcomes_tx: &Sender::AppError>>, + /// step: FnRef<'_, StepBoxed<::AppError>>, /// f: F, /// ) -> bool /// where - /// F: (Fn(&dyn ItemRt<::AppError>, fn_ctx: OpCtx<'_>, &Resources, &mut ItemApplyBoxed) -> Fut) + Copy, + /// F: (Fn(&dyn StepRt<::AppError>, fn_ctx: OpCtx<'_>, &Resources, &mut StepApplyBoxed) -> Fut) + Copy, /// Fut: Future::AppError>>, /// ``` - async fn item_apply_exec( - item_apply_exec_ctx: ItemApplyExecCtx< + async fn step_apply_exec( + step_apply_exec_ctx: StepApplyExecCtx< '_, ::AppError, >, - item: &ItemBoxed<::AppError>, + step: &StepBoxed<::AppError>, ) -> Result<(), ()> { - let ItemApplyExecCtx { + let StepApplyExecCtx { params_specs, resources, apply_for_internal, #[cfg(feature = "output_progress")] progress_tx, outcomes_tx, - } = item_apply_exec_ctx; + } = step_apply_exec_ctx; - let item_id = item.id(); + let step_id = step.id(); - // Indicate this item is running, so that an `Interrupt` message from + // Indicate this step is running, so that an `Interrupt` message from // `CmdExecution` does not cause it to be rendered as `Interrupted`. #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item_id.clone(), + step_id: step_id.clone(), progress_update: ProgressUpdate::Queued, msg_update: ProgressMsgUpdate::NoChange, } @@ -164,28 +164,28 @@ where ); let apply_fn = if StatesTs::dry_run() { - ItemRt::apply_exec_dry + StepRt::apply_exec_dry } else { - ItemRt::apply_exec + StepRt::apply_exec }; let fn_ctx = FnCtx::new( - item_id, + step_id, #[cfg(feature = "output_progress")] - ProgressSender::new(item_id, progress_tx), + ProgressSender::new(step_id, progress_tx), ); - let item_apply = match apply_for_internal { + let step_apply = match apply_for_internal { ApplyForInternal::Ensure => { - ItemRt::ensure_prepare(&**item, params_specs, resources, fn_ctx).await + StepRt::ensure_prepare(&**step, params_specs, resources, fn_ctx).await } ApplyForInternal::Clean { states_current } => { - ItemRt::clean_prepare(&**item, states_current, params_specs, resources).await + StepRt::clean_prepare(&**step, states_current, params_specs, resources).await } }; - match item_apply { - Ok(mut item_apply) => { - match item_apply.apply_check() { + match step_apply { + Ok(mut step_apply) => { + match step_apply.apply_check() { #[cfg(not(feature = "output_progress"))] ApplyCheck::ExecRequired => {} #[cfg(feature = "output_progress")] @@ -193,7 +193,7 @@ where // Update `OutputWrite`s with progress limit. let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item_id.clone(), + step_id: step_id.clone(), progress_update: ProgressUpdate::Limit(progress_limit), msg_update: ProgressMsgUpdate::Set(String::from("in progress")), } @@ -204,7 +204,7 @@ where #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item_id.clone(), + step_id: step_id.clone(), progress_update: ProgressUpdate::Complete( ProgressComplete::Success, ), @@ -217,9 +217,9 @@ where // In case of an interrupt or power failure, we may not have written states // to disk. outcomes_tx - .send(ItemApplyOutcome::Success { - item_id: item.id().clone(), - item_apply, + .send(StepApplyOutcome::Success { + step_id: step.id().clone(), + step_apply, }) .await .expect("unreachable: `outcomes_rx` is in a sibling task."); @@ -228,14 +228,14 @@ where return Ok(()); } } - match apply_fn(&**item, params_specs, resources, fn_ctx, &mut item_apply).await { + match apply_fn(&**step, params_specs, resources, fn_ctx, &mut step_apply).await { Ok(()) => { // apply succeeded #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item_id.clone(), + step_id: step_id.clone(), progress_update: ProgressUpdate::Complete( ProgressComplete::Success, ), @@ -245,9 +245,9 @@ where ); outcomes_tx - .send(ItemApplyOutcome::Success { - item_id: item.id().clone(), - item_apply, + .send(StepApplyOutcome::Success { + step_id: step.id().clone(), + step_apply, }) .await .expect("unreachable: `outcomes_rx` is in a sibling task."); @@ -260,7 +260,7 @@ where #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item_id.clone(), + step_id: step_id.clone(), progress_update: ProgressUpdate::Complete(ProgressComplete::Fail), msg_update: ProgressMsgUpdate::Set( error @@ -273,9 +273,9 @@ where ); outcomes_tx - .send(ItemApplyOutcome::Fail { - item_id: item.id().clone(), - item_apply, + .send(StepApplyOutcome::Fail { + step_id: step.id().clone(), + step_apply, error, }) .await @@ -286,11 +286,11 @@ where } } } - Err((error, item_apply_partial)) => { + Err((error, step_apply_partial)) => { #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item.id().clone(), + step_id: step.id().clone(), progress_update: ProgressUpdate::Complete(ProgressComplete::Fail), msg_update: ProgressMsgUpdate::Set( error @@ -303,9 +303,9 @@ where ); outcomes_tx - .send(ItemApplyOutcome::PrepareFail { - item_id: item.id().clone(), - item_apply_partial, + .send(StepApplyOutcome::PrepareFail { + step_id: step.id().clone(), + step_apply_partial, error, }) .await @@ -318,7 +318,7 @@ where async fn outcome_collate_task( mut outcomes_rx: Receiver< - ItemApplyOutcome<::AppError>, + StepApplyOutcome<::AppError>, >, mut states_applied_mut: StatesMut, mut states_target_mut: StatesMut, @@ -326,17 +326,17 @@ where ( States, States, - IndexMap::AppError>, + IndexMap::AppError>, ), ::AppError, > { let mut errors = IndexMap::new(); - while let Some(item_outcome) = outcomes_rx.recv().await { + while let Some(step_outcome) = outcomes_rx.recv().await { Self::outcome_collate( &mut states_applied_mut, &mut states_target_mut, &mut errors, - item_outcome, + step_outcome, )?; } @@ -349,38 +349,38 @@ where fn outcome_collate( states_applied_mut: &mut StatesMut, states_target_mut: &mut StatesMut, - errors: &mut IndexMap::AppError>, - outcome_partial: ItemApplyOutcome<::AppError>, + errors: &mut IndexMap::AppError>, + outcome_partial: StepApplyOutcome<::AppError>, ) -> Result<(), ::AppError> { let apply_for = StatesTs::apply_for(); match outcome_partial { - ItemApplyOutcome::PrepareFail { - item_id, - item_apply_partial, + StepApplyOutcome::PrepareFail { + step_id, + step_apply_partial, error, } => { - errors.insert(item_id.clone(), error); + errors.insert(step_id.clone(), error); // Save `state_target` (which is `state_goal`) if we are not cleaning // up. match apply_for { ApplyFor::Ensure => { - if let Some(state_target) = item_apply_partial.state_target() { - states_target_mut.insert_raw(item_id, state_target); + if let Some(state_target) = step_apply_partial.state_target() { + states_target_mut.insert_raw(step_id, state_target); } } ApplyFor::Clean => {} } } - ItemApplyOutcome::Success { - item_id, - item_apply, + StepApplyOutcome::Success { + step_id, + step_apply, } => { - if let Some(state_applied) = item_apply.state_applied() { - states_applied_mut.insert_raw(item_id.clone(), state_applied); + if let Some(state_applied) = step_apply.state_applied() { + states_applied_mut.insert_raw(step_id.clone(), state_applied); } else { - // Item was already in the goal state. + // Step was already in the goal state. // No change to current state. } @@ -388,28 +388,28 @@ where // up. match apply_for { ApplyFor::Ensure => { - let state_target = item_apply.state_target(); - states_target_mut.insert_raw(item_id, state_target); + let state_target = step_apply.state_target(); + states_target_mut.insert_raw(step_id, state_target); } ApplyFor::Clean => {} } } - ItemApplyOutcome::Fail { - item_id, - item_apply, + StepApplyOutcome::Fail { + step_id, + step_apply, error, } => { - errors.insert(item_id.clone(), error); - if let Some(state_applied) = item_apply.state_applied() { - states_applied_mut.insert_raw(item_id.clone(), state_applied); + errors.insert(step_id.clone(), error); + if let Some(state_applied) = step_apply.state_applied() { + states_applied_mut.insert_raw(step_id.clone(), state_applied); } // Save `state_target` (which is state_target) if we are not cleaning // up. match apply_for { ApplyFor::Ensure => { - let state_target = item_apply.state_target(); - states_target_mut.insert_raw(item_id, state_target); + let state_target = step_apply.state_target(); + states_target_mut.insert_raw(step_id, state_target); } ApplyFor::Clean => {} } @@ -493,7 +493,7 @@ where .. } = cmd_view; - let item_graph = flow.graph(); + let step_graph = flow.graph(); let resources_ref = &*resources; let apply_for = StatesTs::apply_for(); let apply_for_internal = match apply_for { @@ -502,8 +502,8 @@ where }; let (outcomes_tx, outcomes_rx) = mpsc::channel::< - ItemApplyOutcome<::AppError>, - >(item_graph.node_count()); + StepApplyOutcome<::AppError>, + >(step_graph.node_count()); let stream_opts = { let stream_opts = StreamOpts::new() @@ -516,10 +516,10 @@ where }; let (stream_outcome_result, outcome_collate) = { - let item_apply_exec_task = async move { - let stream_outcome = item_graph - .try_for_each_concurrent_with(BUFFERED_FUTURES_MAX, stream_opts, |item| { - let item_apply_exec_ctx = ItemApplyExecCtx { + let step_apply_exec_task = async move { + let stream_outcome = step_graph + .try_for_each_concurrent_with(BUFFERED_FUTURES_MAX, stream_opts, |step| { + let step_apply_exec_ctx = StepApplyExecCtx { params_specs, resources: resources_ref, apply_for_internal: &apply_for_internal, @@ -527,7 +527,7 @@ where progress_tx, outcomes_tx: &outcomes_tx, }; - Self::item_apply_exec(item_apply_exec_ctx, item) + Self::step_apply_exec(step_apply_exec_ctx, step) }) .await; @@ -538,7 +538,7 @@ where let outcome_collate_task = Self::outcome_collate_task(outcomes_rx, states_applied_mut, states_target_mut); - join!(item_apply_exec_task, outcome_collate_task) + join!(step_apply_exec_task, outcome_collate_task) }; let (states_applied, states_target, errors) = outcome_collate?; @@ -550,7 +550,7 @@ where stream_outcome.map(|()| (states_previous, states_applied, states_target)) }; - Ok(CmdBlockOutcome::ItemWise { + Ok(CmdBlockOutcome::StepWise { stream_outcome, errors, }) @@ -573,37 +573,37 @@ enum ApplyForInternal { Clean { states_current: StatesCurrent }, } -struct ItemApplyExecCtx<'f, E> { - /// Map of item ID to its params' specs. +struct StepApplyExecCtx<'f, E> { + /// Map of step ID to its params' specs. params_specs: &'f ParamsSpecs, /// Map of all types at runtime. resources: &'f Resources, /// Whether the `ApplyCmd` is for `Ensure` or `Clean`. apply_for_internal: &'f ApplyForInternal, - /// Channel sender for `CmdBlock` item outcomes. + /// Channel sender for `CmdBlock` step outcomes. #[cfg(feature = "output_progress")] progress_tx: &'f Sender, - outcomes_tx: &'f Sender>, + outcomes_tx: &'f Sender>, } #[derive(Debug)] -pub enum ItemApplyOutcome { +pub enum StepApplyOutcome { /// Error occurred when discovering current state, goal states, state /// diff, or `ApplyCheck`. PrepareFail { - item_id: ItemId, - item_apply_partial: ItemApplyPartialBoxed, + step_id: StepId, + step_apply_partial: StepApplyPartialBoxed, error: E, }, /// Ensure execution succeeded. Success { - item_id: ItemId, - item_apply: ItemApplyBoxed, + step_id: StepId, + step_apply: StepApplyBoxed, }, /// Ensure execution failed. Fail { - item_id: ItemId, - item_apply: ItemApplyBoxed, + step_id: StepId, + step_apply: StepApplyBoxed, error: E, }, } diff --git a/crate/rt/src/cmd_blocks/apply_state_sync_check_cmd_block.rs b/crate/rt/src/cmd_blocks/apply_state_sync_check_cmd_block.rs index 98d5a52c2..36567f79d 100644 --- a/crate/rt/src/cmd_blocks/apply_state_sync_check_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/apply_state_sync_check_cmd_block.rs @@ -9,7 +9,7 @@ use peace_resources::{ ResourceFetchError, Resources, }; use peace_rt_model::Error; -use peace_rt_model_core::{ApplyCmdError, ItemsStateStoredStale, StateStoredAndDiscovered}; +use peace_rt_model_core::{ApplyCmdError, StepsStateStoredStale, StateStoredAndDiscovered}; cfg_if::cfg_if! { if #[cfg(feature = "output_progress")] { @@ -122,42 +122,42 @@ impl where CmdCtxTypesT: CmdCtxTypesConstrained, { - fn items_state_stored_stale( + fn steps_state_stored_stale( cmd_view: &SingleProfileSingleFlowView<'_, CmdCtxTypesT>, states_stored: &States, states_discovered: &States, #[cfg(feature = "output_progress")] progress_tx: &Sender, - ) -> Result::AppError> { - let items_state_stored_stale = cmd_view.flow.graph().iter_insertion().try_fold( - ItemsStateStoredStale::new(), - |mut items_state_stored_stale, item_rt| { - let item_id = item_rt.id(); - let state_stored = states_stored.get_raw(item_id); - let state_discovered = states_discovered.get_raw(item_id); + ) -> Result::AppError> { + let steps_state_stored_stale = cmd_view.flow.graph().iter_insertion().try_fold( + StepsStateStoredStale::new(), + |mut steps_state_stored_stale, step_rt| { + let step_id = step_rt.id(); + let state_stored = states_stored.get_raw(step_id); + let state_discovered = states_discovered.get_raw(step_id); match (state_stored, state_discovered) { (None, None) => { - // Item not discoverable, may be dependent on + // Step not discoverable, may be dependent on // predecessor } (None, Some(state_discovered)) => { - let item_id = item_id.clone(); + let step_id = step_id.clone(); let state_discovered = state_discovered.clone(); - items_state_stored_stale.insert( - item_id, + steps_state_stored_stale.insert( + step_id, StateStoredAndDiscovered::OnlyDiscoveredExists { state_discovered }, ); } (Some(state_stored), None) => { - let item_id = item_id.clone(); + let step_id = step_id.clone(); let state_stored = state_stored.clone(); - items_state_stored_stale.insert( - item_id, + steps_state_stored_stale.insert( + step_id, StateStoredAndDiscovered::OnlyStoredExists { state_stored }, ); } (Some(state_stored), Some(state_discovered)) => { - let state_eq = item_rt.state_eq(state_stored, state_discovered); + let state_eq = step_rt.state_eq(state_stored, state_discovered); match state_eq { Ok(true) => { #[cfg(feature = "output_progress")] @@ -165,7 +165,7 @@ where let state_type = tynm::type_name::(); let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item_id.clone(), + step_id: step_id.clone(), progress_update: ProgressUpdate::Delta( ProgressDelta::Tick, ), @@ -183,7 +183,7 @@ where let state_type = tynm::type_name::(); let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item_id.clone(), + step_id: step_id.clone(), progress_update: ProgressUpdate::Complete( ProgressComplete::Fail, ), @@ -195,11 +195,11 @@ where ); } - let item_id = item_id.clone(); + let step_id = step_id.clone(); let state_stored = state_stored.clone(); let state_discovered = state_discovered.clone(); - items_state_stored_stale.insert( - item_id, + steps_state_stored_stale.insert( + step_id, StateStoredAndDiscovered::ValuesDiffer { state_stored, state_discovered, @@ -211,11 +211,11 @@ where } } - Ok(items_state_stored_stale) + Ok(steps_state_stored_stale) }, )?; - Ok(items_state_stored_stale) + Ok(steps_state_stored_stale) } } @@ -303,7 +303,7 @@ where > { let (states_current_stored, states_current) = &mut input; - let state_current_stale_result = Self::items_state_stored_stale( + let state_current_stale_result = Self::steps_state_stored_stale( cmd_view, states_current_stored, states_current, @@ -311,12 +311,12 @@ where progress_tx, ); match state_current_stale_result { - Ok(items_state_stored_stale) => { - if items_state_stored_stale.stale() { + Ok(steps_state_stored_stale) => { + if steps_state_stored_stale.stale() { return outcome_collate( input, OutcomeResult::StatesCurrentOutOfSync { - items_state_stored_stale, + steps_state_stored_stale, }, ); } @@ -377,7 +377,7 @@ where > { let (states_goal_stored, states_goal) = &mut input; - let state_goal_stale_result = Self::items_state_stored_stale( + let state_goal_stale_result = Self::steps_state_stored_stale( cmd_view, states_goal_stored, states_goal, @@ -385,12 +385,12 @@ where progress_tx, ); match state_goal_stale_result { - Ok(items_state_stored_stale) => { - if items_state_stored_stale.stale() { + Ok(steps_state_stored_stale) => { + if steps_state_stored_stale.stale() { return outcome_collate( input, OutcomeResult::StatesGoalOutOfSync { - items_state_stored_stale, + steps_state_stored_stale, }, ); } @@ -471,7 +471,7 @@ where > { let (states_current_stored, states_current, states_goal_stored, states_goal) = &mut input; - let state_current_stale_result = Self::items_state_stored_stale( + let state_current_stale_result = Self::steps_state_stored_stale( cmd_view, states_current_stored, states_current, @@ -479,12 +479,12 @@ where progress_tx, ); match state_current_stale_result { - Ok(items_state_stored_stale) => { - if items_state_stored_stale.stale() { + Ok(steps_state_stored_stale) => { + if steps_state_stored_stale.stale() { return outcome_collate( input, OutcomeResult::StatesCurrentOutOfSync { - items_state_stored_stale, + steps_state_stored_stale, }, ); } @@ -494,7 +494,7 @@ where } }; - let state_goal_stale_result = Self::items_state_stored_stale( + let state_goal_stale_result = Self::steps_state_stored_stale( cmd_view, states_goal_stored, states_goal, @@ -502,12 +502,12 @@ where progress_tx, ); match state_goal_stale_result { - Ok(items_state_stored_stale) => { - if items_state_stored_stale.stale() { + Ok(steps_state_stored_stale) => { + if steps_state_stored_stale.stale() { return outcome_collate( input, OutcomeResult::StatesGoalOutOfSync { - items_state_stored_stale, + steps_state_stored_stale, }, ); } @@ -527,17 +527,17 @@ enum OutcomeResult { Ok, /// Stored current states are not in sync with the actual current state. StatesCurrentOutOfSync { - /// Items whose stored current state is out of sync with the discovered + /// Steps whose stored current state is out of sync with the discovered /// state. - items_state_stored_stale: ItemsStateStoredStale, + steps_state_stored_stale: StepsStateStoredStale, }, /// Stored goal states are not in sync with the actual goal state. StatesGoalOutOfSync { - /// Items whose stored goal state is out of sync with the discovered + /// Steps whose stored goal state is out of sync with the discovered /// state. - items_state_stored_stale: ItemsStateStoredStale, + steps_state_stored_stale: StepsStateStoredStale, }, - /// Error downcasting a boxed item state to its concrete stype. + /// Error downcasting a boxed step state to its concrete stype. StatesDowncastError { /// The error from state downcast. error: E, @@ -574,17 +574,17 @@ where match outcome_result { OutcomeResult::Ok => Ok(CmdBlockOutcome::Single(states_stored_and_discovered)), OutcomeResult::StatesCurrentOutOfSync { - items_state_stored_stale, + steps_state_stored_stale, } => Err(AppErrorT::from(Error::ApplyCmdError( ApplyCmdError::StatesCurrentOutOfSync { - items_state_stored_stale, + steps_state_stored_stale, }, ))), OutcomeResult::StatesGoalOutOfSync { - items_state_stored_stale, + steps_state_stored_stale, } => Err(AppErrorT::from(Error::ApplyCmdError( ApplyCmdError::StatesGoalOutOfSync { - items_state_stored_stale, + steps_state_stored_stale, }, ))), OutcomeResult::StatesDowncastError { error } => Err(error), diff --git a/crate/rt/src/cmd_blocks/diff_cmd_block.rs b/crate/rt/src/cmd_blocks/diff_cmd_block.rs index 7c551b57b..71ed6ddf3 100644 --- a/crate/rt/src/cmd_blocks/diff_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/diff_cmd_block.rs @@ -2,7 +2,7 @@ use std::{fmt::Debug, marker::PhantomData}; use fn_graph::{StreamOpts, StreamOutcome}; use futures::FutureExt; -use peace_cfg::ItemId; +use peace_cfg::StepId; use peace_cmd::{ ctx::CmdCtxTypesConstrained, interruptible::InterruptibilityState, scopes::SingleProfileSingleFlowView, @@ -54,21 +54,21 @@ impl DiffCmdBlock, flow: &Flow<::AppError>, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result, ::AppError> { let stream_outcome_result = flow .graph() @@ -77,16 +77,16 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state) .interrupted_next_item_include(false), - |mut state_diffs_mut, item| { + |mut state_diffs_mut, step| { async move { let _params_specs = ¶ms_specs; - let state_diff_opt = item + let state_diff_opt = step .state_diff_exec(params_specs, resources, states_a, states_b) .await?; if let Some(state_diff) = state_diff_opt { - state_diffs_mut.insert_raw(item.id().clone(), state_diff); + state_diffs_mut.insert_raw(step.id().clone(), state_diff); } Result::<_, ::AppError>::Ok( @@ -184,7 +184,7 @@ where .await? .map(move |state_diffs| (state_diffs, (states_ts0, states_ts1))); - Ok(CmdBlockOutcome::new_item_wise(stream_outcome)) + Ok(CmdBlockOutcome::new_step_wise(stream_outcome)) } } diff --git a/crate/rt/src/cmd_blocks/states_clean_insertion_cmd_block.rs b/crate/rt/src/cmd_blocks/states_clean_insertion_cmd_block.rs index 4b7101241..888b9539c 100644 --- a/crate/rt/src/cmd_blocks/states_clean_insertion_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/states_clean_insertion_cmd_block.rs @@ -20,9 +20,9 @@ cfg_if::cfg_if! { } } -/// Inserts [`StatesClean`]s for each item. +/// Inserts [`StatesClean`]s for each step. /// -/// This calls [`Item::state_clean`] for each item, and groups them together +/// This calls [`Step::state_clean`] for each step, and groups them together /// into `StatesClean`. #[derive(Debug)] pub struct StatesCleanInsertionCmdBlock(PhantomData); @@ -86,18 +86,18 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state.reborrow()) .interrupted_next_item_include(false), - |(mut states_clean_mut, mut errors), item_rt| { + |(mut states_clean_mut, mut errors), step_rt| { async move { - let item_id = item_rt.id().clone(); + let step_id = step_rt.id().clone(); let state_clean_boxed_result = - item_rt.state_clean(params_specs, resources).await; + step_rt.state_clean(params_specs, resources).await; match state_clean_boxed_result { Ok(state_clean_boxed) => { - states_clean_mut.insert_raw(item_id, state_clean_boxed); + states_clean_mut.insert_raw(step_id, state_clean_boxed); } Err(error) => { - errors.insert(item_id, error); + errors.insert(step_id, error); } } @@ -111,7 +111,7 @@ where let stream_outcome = stream_outcome.map(StatesClean::from); - Ok(CmdBlockOutcome::ItemWise { + Ok(CmdBlockOutcome::StepWise { stream_outcome, errors, }) diff --git a/crate/rt/src/cmd_blocks/states_current_read_cmd_block.rs b/crate/rt/src/cmd_blocks/states_current_read_cmd_block.rs index 93ebb1751..008c9909e 100644 --- a/crate/rt/src/cmd_blocks/states_current_read_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/states_current_read_cmd_block.rs @@ -1,6 +1,6 @@ use std::{fmt::Debug, marker::PhantomData}; -use peace_cfg::{FlowId, ItemId}; +use peace_cfg::{FlowId, StepId}; use peace_cmd::{ctx::CmdCtxTypesConstrained, scopes::SingleProfileSingleFlowView}; use peace_cmd_model::CmdBlockOutcome; use peace_cmd_rt::{async_trait, CmdBlock}; @@ -41,7 +41,7 @@ where pub(crate) async fn deserialize_internal( resources: &mut Resources, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, ) -> Result::AppError> { let flow_id = resources.borrow::(); let flow_dir = resources.borrow::(); diff --git a/crate/rt/src/cmd_blocks/states_discover_cmd_block.rs b/crate/rt/src/cmd_blocks/states_discover_cmd_block.rs index 5d44ad563..b4f374f3d 100644 --- a/crate/rt/src/cmd_blocks/states_discover_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/states_discover_cmd_block.rs @@ -1,7 +1,7 @@ use std::{fmt::Debug, marker::PhantomData}; use futures::join; -use peace_cfg::{FnCtx, ItemId}; +use peace_cfg::{FnCtx, StepId}; use peace_cmd::{ctx::CmdCtxTypesConstrained, scopes::SingleProfileSingleFlowView}; use peace_cmd_model::CmdBlockOutcome; use peace_cmd_rt::{async_trait, CmdBlock}; @@ -15,7 +15,7 @@ use peace_resources::{ type_reg::untagged::BoxDtDisplay, ResourceFetchError, Resources, }; -use peace_rt_model::{fn_graph::StreamOpts, ItemBoxed}; +use peace_rt_model::{fn_graph::StreamOpts, StepBoxed}; use peace_rt_model_core::IndexMap; use tokio::sync::mpsc::{self, Receiver}; @@ -129,25 +129,25 @@ where self } - async fn item_states_discover( + async fn step_states_discover( #[cfg(feature = "output_progress")] progress_tx: &Sender, #[cfg(feature = "output_progress")] progress_complete_on_success: bool, params_specs: &peace_params::ParamsSpecs, resources: &Resources, outcomes_tx: &tokio::sync::mpsc::Sender< - ItemDiscoverOutcome<::AppError>, + StepDiscoverOutcome<::AppError>, >, - item: &ItemBoxed<::AppError>, + step: &StepBoxed<::AppError>, ) { - let item_id = item.id(); + let step_id = step.id(); let fn_ctx = FnCtx::new( - item_id, + step_id, #[cfg(feature = "output_progress")] - ProgressSender::new(item_id, progress_tx), + ProgressSender::new(step_id, progress_tx), ); let (states_current_result, states_goal_result) = - DiscoverFor::discover(item, params_specs, resources, fn_ctx).await; + DiscoverFor::discover(step, params_specs, resources, fn_ctx).await; // Send progress update. #[cfg(feature = "output_progress")] @@ -156,15 +156,15 @@ where states_current_result.as_ref(), states_goal_result.as_ref(), progress_tx, - item_id, + step_id, ); - let mut item_error = None; + let mut step_error = None; let state_current = if let Some(states_current_result) = states_current_result { match states_current_result { Ok(state_current_opt) => state_current_opt, Err(error) => { - item_error = Some(error); + step_error = Some(error); None } } @@ -179,8 +179,8 @@ where // It's probably more crucial to store the // `states_current` // error than the states goal error, if both err. - if item_error.is_none() { - item_error = Some(error); + if step_error.is_none() { + step_error = Some(error); } None } @@ -189,10 +189,10 @@ where None }; - if let Some(error) = item_error { + if let Some(error) = step_error { outcomes_tx - .send(ItemDiscoverOutcome::Fail { - item_id: item_id.clone(), + .send(StepDiscoverOutcome::Fail { + step_id: step_id.clone(), state_current, state_goal, error, @@ -201,8 +201,8 @@ where .expect("unreachable: `outcomes_rx` is in a sibling task."); } else { outcomes_tx - .send(ItemDiscoverOutcome::Success { - item_id: item_id.clone(), + .send(StepDiscoverOutcome::Success { + step_id: step_id.clone(), state_current, state_goal, }) @@ -221,7 +221,7 @@ where &Result, ::AppError>, >, progress_tx: &Sender, - item_id: &ItemId, + step_id: &StepId, ) { if let Some((progress_update, msg_update)) = DiscoverFor::progress_update( progress_complete_on_success, @@ -230,7 +230,7 @@ where ) { let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - item_id: item_id.clone(), + step_id: step_id.clone(), progress_update, msg_update, } @@ -241,16 +241,16 @@ where } #[derive(Debug)] -pub enum ItemDiscoverOutcome { +pub enum StepDiscoverOutcome { /// Discover succeeded. Success { - item_id: ItemId, + step_id: StepId, state_current: Option, state_goal: Option, }, /// Discover failed. Fail { - item_id: ItemId, + step_id: StepId, state_current: Option, state_goal: Option, error: AppErrorT, @@ -292,13 +292,13 @@ where } = cmd_view; let (outcomes_tx, outcomes_rx) = mpsc::channel::< - ItemDiscoverOutcome<::AppError>, + StepDiscoverOutcome<::AppError>, >(flow.graph().node_count()); let (stream_outcome, outcome_collate) = { let states_current_mut = StatesMut::::with_capacity(flow.graph().node_count()); - let item_states_discover_task = async move { + let step_states_discover_task = async move { let stream_outcome = flow .graph() .for_each_concurrent_with( @@ -306,8 +306,8 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state.reborrow()) .interrupted_next_item_include(false), - |item| { - Self::item_states_discover( + |step| { + Self::step_states_discover( #[cfg(feature = "output_progress")] progress_tx, #[cfg(feature = "output_progress")] @@ -315,7 +315,7 @@ where params_specs, resources, &outcomes_tx, - item, + step, ) }, ) @@ -328,12 +328,12 @@ where let outcome_collate_task = Self::outcome_collate_task(outcomes_rx, states_current_mut); - join!(item_states_discover_task, outcome_collate_task) + join!(step_states_discover_task, outcome_collate_task) }; outcome_collate.map(|(states_current, errors)| { let (stream_outcome, ()) = stream_outcome.replace(states_current); - CmdBlockOutcome::ItemWise { + CmdBlockOutcome::StepWise { stream_outcome, errors, } @@ -347,19 +347,19 @@ where { async fn outcome_collate_task( mut outcomes_rx: Receiver< - ItemDiscoverOutcome<::AppError>, + StepDiscoverOutcome<::AppError>, >, mut states_current_mut: StatesMut, ) -> Result< ( States, - IndexMap::AppError>, + IndexMap::AppError>, ), ::AppError, > { let mut errors = IndexMap::new(); - while let Some(item_outcome) = outcomes_rx.recv().await { - Self::outcome_collate(&mut states_current_mut, &mut errors, item_outcome)?; + while let Some(step_outcome) = outcomes_rx.recv().await { + Self::outcome_collate(&mut states_current_mut, &mut errors, step_outcome)?; } let states_current = States::::from(states_current_mut); @@ -369,29 +369,29 @@ where fn outcome_collate( states_current_mut: &mut StatesMut, - errors: &mut IndexMap::AppError>, - outcome_partial: ItemDiscoverOutcome<::AppError>, + errors: &mut IndexMap::AppError>, + outcome_partial: StepDiscoverOutcome<::AppError>, ) -> Result<(), ::AppError> { match outcome_partial { - ItemDiscoverOutcome::Success { - item_id, + StepDiscoverOutcome::Success { + step_id, state_current, state_goal: _, } => { if let Some(state_current) = state_current { - states_current_mut.insert_raw(item_id.clone(), state_current); + states_current_mut.insert_raw(step_id.clone(), state_current); } } - ItemDiscoverOutcome::Fail { - item_id, + StepDiscoverOutcome::Fail { + step_id, state_current, state_goal: _, error, } => { - errors.insert(item_id.clone(), error); + errors.insert(step_id.clone(), error); if let Some(state_current) = state_current { - states_current_mut.insert_raw(item_id.clone(), state_current); + states_current_mut.insert_raw(step_id.clone(), state_current); } } } @@ -435,13 +435,13 @@ where } = cmd_view; let (outcomes_tx, outcomes_rx) = mpsc::channel::< - ItemDiscoverOutcome<::AppError>, + StepDiscoverOutcome<::AppError>, >(flow.graph().node_count()); let (stream_outcome, outcome_collate) = { let states_goal_mut = StatesMut::::with_capacity(flow.graph().node_count()); - let item_states_discover_task = async move { + let step_states_discover_task = async move { let stream_outcome = flow .graph() .for_each_concurrent_with( @@ -449,8 +449,8 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state.reborrow()) .interrupted_next_item_include(false), - |item| { - Self::item_states_discover( + |step| { + Self::step_states_discover( #[cfg(feature = "output_progress")] progress_tx, #[cfg(feature = "output_progress")] @@ -458,7 +458,7 @@ where params_specs, resources, &outcomes_tx, - item, + step, ) }, ) @@ -471,12 +471,12 @@ where let outcome_collate_task = Self::outcome_collate_task(outcomes_rx, states_goal_mut); - join!(item_states_discover_task, outcome_collate_task) + join!(step_states_discover_task, outcome_collate_task) }; outcome_collate.map(|(states_goal, errors)| { let (stream_outcome, ()) = stream_outcome.replace(states_goal); - CmdBlockOutcome::ItemWise { + CmdBlockOutcome::StepWise { stream_outcome, errors, } @@ -490,19 +490,19 @@ where { async fn outcome_collate_task( mut outcomes_rx: Receiver< - ItemDiscoverOutcome<::AppError>, + StepDiscoverOutcome<::AppError>, >, mut states_goal_mut: StatesMut, ) -> Result< ( States, - IndexMap::AppError>, + IndexMap::AppError>, ), ::AppError, > { let mut errors = IndexMap::new(); - while let Some(item_outcome) = outcomes_rx.recv().await { - Self::outcome_collate(&mut states_goal_mut, &mut errors, item_outcome)?; + while let Some(step_outcome) = outcomes_rx.recv().await { + Self::outcome_collate(&mut states_goal_mut, &mut errors, step_outcome)?; } let states_goal = States::::from(states_goal_mut); @@ -512,29 +512,29 @@ where fn outcome_collate( states_goal_mut: &mut StatesMut, - errors: &mut IndexMap::AppError>, - outcome_partial: ItemDiscoverOutcome<::AppError>, + errors: &mut IndexMap::AppError>, + outcome_partial: StepDiscoverOutcome<::AppError>, ) -> Result<(), ::AppError> { match outcome_partial { - ItemDiscoverOutcome::Success { - item_id, + StepDiscoverOutcome::Success { + step_id, state_current: _, state_goal, } => { if let Some(state_goal) = state_goal { - states_goal_mut.insert_raw(item_id, state_goal); + states_goal_mut.insert_raw(step_id, state_goal); } } - ItemDiscoverOutcome::Fail { - item_id, + StepDiscoverOutcome::Fail { + step_id, state_current: _, state_goal, error, } => { - errors.insert(item_id.clone(), error); + errors.insert(step_id.clone(), error); if let Some(state_goal) = state_goal { - states_goal_mut.insert_raw(item_id, state_goal); + states_goal_mut.insert_raw(step_id, state_goal); } } } @@ -591,14 +591,14 @@ where } = cmd_view; let (outcomes_tx, outcomes_rx) = mpsc::channel::< - ItemDiscoverOutcome<::AppError>, + StepDiscoverOutcome<::AppError>, >(flow.graph().node_count()); let (stream_outcome, outcome_collate) = { let states_current_mut = StatesMut::::with_capacity(flow.graph().node_count()); let states_goal_mut = StatesMut::::with_capacity(flow.graph().node_count()); - let item_states_discover_task = async move { + let step_states_discover_task = async move { let stream_outcome = flow .graph() .for_each_concurrent_with( @@ -606,8 +606,8 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state.reborrow()) .interrupted_next_item_include(false), - |item| { - Self::item_states_discover( + |step| { + Self::step_states_discover( #[cfg(feature = "output_progress")] progress_tx, #[cfg(feature = "output_progress")] @@ -615,7 +615,7 @@ where params_specs, resources, &outcomes_tx, - item, + step, ) }, ) @@ -629,12 +629,12 @@ where let outcome_collate_task = Self::outcome_collate_task(outcomes_rx, states_current_mut, states_goal_mut); - join!(item_states_discover_task, outcome_collate_task) + join!(step_states_discover_task, outcome_collate_task) }; outcome_collate.map(|(states_current, states_goal, errors)| { let (stream_outcome, ()) = stream_outcome.replace((states_current, states_goal)); - CmdBlockOutcome::ItemWise { + CmdBlockOutcome::StepWise { stream_outcome, errors, } @@ -648,7 +648,7 @@ where { async fn outcome_collate_task( mut outcomes_rx: Receiver< - ItemDiscoverOutcome<::AppError>, + StepDiscoverOutcome<::AppError>, >, mut states_current_mut: StatesMut, mut states_goal_mut: StatesMut, @@ -656,17 +656,17 @@ where ( States, States, - IndexMap::AppError>, + IndexMap::AppError>, ), ::AppError, > { let mut errors = IndexMap::new(); - while let Some(item_outcome) = outcomes_rx.recv().await { + while let Some(step_outcome) = outcomes_rx.recv().await { Self::outcome_collate( &mut states_current_mut, &mut states_goal_mut, &mut errors, - item_outcome, + step_outcome, )?; } @@ -679,35 +679,35 @@ where fn outcome_collate( states_current_mut: &mut StatesMut, states_goal_mut: &mut StatesMut, - errors: &mut IndexMap::AppError>, - outcome_partial: ItemDiscoverOutcome<::AppError>, + errors: &mut IndexMap::AppError>, + outcome_partial: StepDiscoverOutcome<::AppError>, ) -> Result<(), ::AppError> { match outcome_partial { - ItemDiscoverOutcome::Success { - item_id, + StepDiscoverOutcome::Success { + step_id, state_current, state_goal, } => { if let Some(state_current) = state_current { - states_current_mut.insert_raw(item_id.clone(), state_current); + states_current_mut.insert_raw(step_id.clone(), state_current); } if let Some(state_goal) = state_goal { - states_goal_mut.insert_raw(item_id, state_goal); + states_goal_mut.insert_raw(step_id, state_goal); } } - ItemDiscoverOutcome::Fail { - item_id, + StepDiscoverOutcome::Fail { + step_id, state_current, state_goal, error, } => { - errors.insert(item_id.clone(), error); + errors.insert(step_id.clone(), error); if let Some(state_current) = state_current { - states_current_mut.insert_raw(item_id.clone(), state_current); + states_current_mut.insert_raw(step_id.clone(), state_current); } if let Some(state_goal) = state_goal { - states_goal_mut.insert_raw(item_id, state_goal); + states_goal_mut.insert_raw(step_id, state_goal); } } } @@ -720,7 +720,7 @@ where #[async_trait::async_trait(?Send)] pub trait Discover { async fn discover( - item: &ItemBoxed, + step: &StepBoxed, params_specs: &peace_params::ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, @@ -744,7 +744,7 @@ pub trait Discover { #[async_trait::async_trait(?Send)] impl Discover for DiscoverForCurrent { async fn discover( - item: &ItemBoxed, + step: &StepBoxed, params_specs: &peace_params::ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, @@ -755,7 +755,7 @@ impl Discover for DiscoverForCurrent { where AppErrorT: peace_value_traits::AppError + From, { - let states_current_result = item + let states_current_result = step .state_current_try_exec(params_specs, resources, fn_ctx) .await; @@ -792,7 +792,7 @@ impl Discover for DiscoverForCurrent { #[async_trait::async_trait(?Send)] impl Discover for DiscoverForGoal { async fn discover( - item: &ItemBoxed, + step: &StepBoxed, params_specs: &peace_params::ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, @@ -803,7 +803,7 @@ impl Discover for DiscoverForGoal { where AppErrorT: peace_value_traits::AppError + From, { - let states_goal_result = item + let states_goal_result = step .state_goal_try_exec(params_specs, resources, fn_ctx) .await; @@ -840,7 +840,7 @@ impl Discover for DiscoverForGoal { #[async_trait::async_trait(?Send)] impl Discover for DiscoverForCurrentAndGoal { async fn discover( - item: &ItemBoxed, + step: &StepBoxed, params_specs: &peace_params::ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, @@ -851,10 +851,10 @@ impl Discover for DiscoverForCurrentAndGoal { where AppErrorT: peace_value_traits::AppError + From, { - let states_current_result = item + let states_current_result = step .state_current_try_exec(params_specs, resources, fn_ctx) .await; - let states_goal_result = item + let states_goal_result = step .state_goal_try_exec(params_specs, resources, fn_ctx) .await; diff --git a/crate/rt/src/cmd_blocks/states_goal_read_cmd_block.rs b/crate/rt/src/cmd_blocks/states_goal_read_cmd_block.rs index 8086ca396..c2cb5dd60 100644 --- a/crate/rt/src/cmd_blocks/states_goal_read_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/states_goal_read_cmd_block.rs @@ -1,6 +1,6 @@ use std::{fmt::Debug, marker::PhantomData}; -use peace_cfg::{FlowId, ItemId}; +use peace_cfg::{FlowId, StepId}; use peace_cmd::{ctx::CmdCtxTypesConstrained, scopes::SingleProfileSingleFlowView}; use peace_cmd_model::CmdBlockOutcome; use peace_cmd_rt::{async_trait, CmdBlock}; @@ -41,7 +41,7 @@ where pub(crate) async fn deserialize_internal( resources: &mut Resources, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, ) -> Result::AppError> { let flow_id = resources.borrow::(); let flow_dir = resources.borrow::(); diff --git a/crate/rt/src/cmds/clean_cmd.rs b/crate/rt/src/cmds/clean_cmd.rs index 2cde8f007..22cd64d84 100644 --- a/crate/rt/src/cmds/clean_cmd.rs +++ b/crate/rt/src/cmds/clean_cmd.rs @@ -12,7 +12,7 @@ use peace_resources::{ states::{States, StatesCleaned, StatesCleanedDry, StatesPrevious}, Resources, }; -use peace_rt_model::{ItemGraph, Storage}; +use peace_rt_model::{StepGraph, Storage}; use crate::{ cmd_blocks::{ @@ -29,37 +29,37 @@ impl CleanCmd where CmdCtxTypesT: CmdCtxTypesConstrained, { - /// Conditionally runs [`Item::apply_exec_dry`] for each [`Item`]. + /// Conditionally runs [`Step::apply_exec_dry`] for each [`Step`]. /// - /// In practice this runs [`Item::apply_check`], and only runs + /// In practice this runs [`Step::apply_check`], and only runs /// [`apply_exec_dry`] if execution is required. /// /// # Design /// - /// The grouping of item functions run for a `Clean` execution to work + /// The grouping of step functions run for a `Clean` execution to work /// is as follows: /// - /// 1. Run [`StatesDiscoverCmd::current`] for all `Item`s in the *forward* + /// 1. Run [`StatesDiscoverCmd::current`] for all `Step`s in the *forward* /// direction. /// /// This populates `resources` with `Current`, needed for - /// `Item::try_state_current` during `ItemRt::clean_prepare`. + /// `Step::try_state_current` during `StepRt::clean_prepare`. /// - /// 2. In the *reverse* direction, for each `Item` run - /// `ItemRt::clean_prepare`, which runs: + /// 2. In the *reverse* direction, for each `Step` run + /// `StepRt::clean_prepare`, which runs: /// - /// 1. `Item::try_state_current`, which resolves parameters from the + /// 1. `Step::try_state_current`, which resolves parameters from the /// *current* state. - /// 2. `Item::state_goal` - /// 3. `Item::apply_check` + /// 2. `Step::state_goal` + /// 3. `Step::apply_check` /// - /// 3. For `Item`s that return `ApplyCheck::ExecRequired`, run - /// `Item::apply_exec_dry`. + /// 3. For `Step`s that return `ApplyCheck::ExecRequired`, run + /// `Step::apply_exec_dry`. /// - /// [`apply_exec_dry`]: peace_cfg::Item::apply_exec_dry - /// [`Item::apply_check`]: peace_cfg::Item::apply_check - /// [`Item::apply_exec_dry`]: peace_cfg::ItemRt::apply_exec_dry - /// [`Item`]: peace_cfg::Item + /// [`apply_exec_dry`]: peace_cfg::Step::apply_exec_dry + /// [`Step::apply_check`]: peace_cfg::Step::apply_check + /// [`Step::apply_exec_dry`]: peace_cfg::StepRt::apply_exec_dry + /// [`Step`]: peace_cfg::Step pub async fn exec_dry<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -72,7 +72,7 @@ where Self::exec_dry_with(cmd_ctx, ApplyStoredStateSync::Both).await } - /// Conditionally runs [`Item::apply_exec_dry`] for each [`Item`]. + /// Conditionally runs [`Step::apply_exec_dry`] for each [`Step`]. /// /// See [`Self::exec_dry`] for full documentation. /// @@ -106,37 +106,37 @@ where Ok(cmd_outcome) } - /// Conditionally runs [`Item::apply_exec`] for each [`Item`]. + /// Conditionally runs [`Step::apply_exec`] for each [`Step`]. /// - /// In practice this runs [`Item::apply_check`], and only runs + /// In practice this runs [`Step::apply_check`], and only runs /// [`apply_exec`] if execution is required. /// /// # Design /// - /// The grouping of item functions run for a `Clean` execution to work + /// The grouping of step functions run for a `Clean` execution to work /// is as follows: /// - /// 1. Run [`StatesDiscoverCmd::current`] for all `Item`s in the *forward* + /// 1. Run [`StatesDiscoverCmd::current`] for all `Step`s in the *forward* /// direction. /// /// This populates `resources` with `Current`, needed for - /// `Item::try_state_current` during `ItemRt::clean_prepare`. + /// `Step::try_state_current` during `StepRt::clean_prepare`. /// - /// 2. In the *reverse* direction, for each `Item` run - /// `ItemRt::clean_prepare`, which runs: + /// 2. In the *reverse* direction, for each `Step` run + /// `StepRt::clean_prepare`, which runs: /// - /// 1. `Item::try_state_current`, which resolves parameters from the + /// 1. `Step::try_state_current`, which resolves parameters from the /// *current* state. - /// 2. `Item::state_goal` - /// 3. `Item::apply_check` + /// 2. `Step::state_goal` + /// 3. `Step::apply_check` /// - /// 3. For `Item`s that return `ApplyCheck::ExecRequired`, run - /// `Item::apply_exec`. + /// 3. For `Step`s that return `ApplyCheck::ExecRequired`, run + /// `Step::apply_exec`. /// - /// [`apply_exec`]: peace_cfg::Item::apply_exec - /// [`Item::apply_check`]: peace_cfg::Item::apply_check - /// [`Item::apply_exec`]: peace_cfg::ItemRt::apply_exec - /// [`Item`]: peace_cfg::Item + /// [`apply_exec`]: peace_cfg::Step::apply_exec + /// [`Step::apply_check`]: peace_cfg::Step::apply_check + /// [`Step::apply_exec`]: peace_cfg::StepRt::apply_exec + /// [`Step`]: peace_cfg::Step pub async fn exec<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -149,7 +149,7 @@ where Self::exec_with(cmd_ctx, ApplyStoredStateSync::Both).await } - /// Conditionally runs [`Item::apply_exec`] for each [`Item`]. + /// Conditionally runs [`Step::apply_exec`] for each [`Step`]. /// /// See [`Self::exec`] for full documentation. /// @@ -170,7 +170,7 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (item_graph, resources) = (flow.graph(), resources); + let (step_graph, resources) = (flow.graph(), resources); // We shouldn't serialize current if we returned from an interruption / error // handler. @@ -180,7 +180,7 @@ where CleanExecChange::None => Ok(Default::default()), CleanExecChange::Some(states_previous_and_cleaned) => { let (states_previous, states_cleaned) = *states_previous_and_cleaned; - Self::serialize_current(item_graph, resources, &states_cleaned).await?; + Self::serialize_current(step_graph, resources, &states_cleaned).await?; resources.insert::(states_previous); @@ -193,14 +193,14 @@ where cmd_outcome.transpose() } - /// Conditionally runs [`ApplyFns`]`::`[`exec`] for each [`Item`]. + /// Conditionally runs [`ApplyFns`]`::`[`exec`] for each [`Step`]. /// /// Same as [`Self::exec`], but does not change the type state, and returns /// [`StatesCleaned`]. /// /// [`exec`]: peace_cfg::ApplyFns::exec - /// [`Item`]: peace_cfg::Item - /// [`ApplyFns`]: peace_cfg::Item::ApplyFns + /// [`Step`]: peace_cfg::Step + /// [`ApplyFns`]: peace_cfg::Step::ApplyFns async fn exec_internal<'ctx, 'ctx_ref, StatesTs>( cmd_ctx: &'ctx_ref mut CmdCtx>, apply_stored_state_sync: ApplyStoredStateSync, @@ -269,10 +269,10 @@ where // i.e. is it part of `ApplyFns::exec`'s contract to return the state. // // * It may be duplication of code. - // * `FileDownloadItem` needs to know the ETag from the last request, which: + // * `FileDownloadStep` needs to know the ETag from the last request, which: // - in `StatesCurrentFn` comes from `StatesCurrent` // - in `CleanCmd` comes from `Cleaned` - // * `ShCmdItem` doesn't return the state in the apply script, so in the item we + // * `ShCmdStep` doesn't return the state in the apply script, so in the step we // run the state current script after the apply exec script. Ok(cmd_outcome) @@ -280,7 +280,7 @@ where // TODO: This duplicates a bit of code with `StatesDiscoverCmd`, async fn serialize_current( - item_graph: &ItemGraph<::AppError>, + step_graph: &StepGraph<::AppError>, resources: &Resources, states_cleaned: &StatesCleaned, ) -> Result<(), ::AppError> { @@ -290,7 +290,7 @@ where let storage = resources.borrow::(); let states_current_file = StatesCurrentFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, item_graph, states_cleaned, &states_current_file) + StatesSerializer::serialize(&storage, step_graph, states_cleaned, &states_current_file) .await?; drop(flow_dir); diff --git a/crate/rt/src/cmds/diff_cmd.rs b/crate/rt/src/cmds/diff_cmd.rs index e1171864d..921d2ef43 100644 --- a/crate/rt/src/cmds/diff_cmd.rs +++ b/crate/rt/src/cmds/diff_cmd.rs @@ -1,7 +1,7 @@ use std::{fmt::Debug, marker::PhantomData}; use futures::{StreamExt, TryStreamExt}; -use peace_cfg::{ItemId, Profile}; +use peace_cfg::{StepId, Profile}; use peace_cmd::{ ctx::{CmdCtx, CmdCtxTypesConstrained}, scopes::{MultiProfileSingleFlow, MultiProfileSingleFlowView, SingleProfileSingleFlow}, @@ -55,7 +55,7 @@ where /// DiffCmd::diff(cmd_ctx, DiffStateSpec::CurrentStored, DiffStateSpec::GoalStored).await?; /// ``` /// - /// [`state_diff`]: peace_cfg::Item::state_diff + /// [`state_diff`]: peace_cfg::Step::state_diff /// [`StatesDiscoverCmd::current_and_goal`]: crate::cmds::StatesDiscoverCmd::current_and_goal pub async fn diff_stored( cmd_ctx: &mut CmdCtx>, @@ -74,7 +74,7 @@ where /// For `Current` and `Goal` states, though they are discovered during the /// `DiffCmd` execution, they are not serialized. /// - /// [`state_diff`]: peace_cfg::Item::state_diff + /// [`state_diff`]: peace_cfg::Step::state_diff /// [`StatesDiscoverCmd::current_and_goal`]: crate::cmds::StatesDiscoverCmd::current_and_goal pub async fn diff( cmd_ctx: &mut CmdCtx>, @@ -143,7 +143,7 @@ where /// Both profiles' current states must have been discovered prior to /// running this. See [`StatesDiscoverCmd::current`]. /// - /// [`state_diff`]: peace_cfg::Item::state_diff + /// [`state_diff`]: peace_cfg::Step::state_diff /// [`StatesDiscoverCmd::current`]: crate::cmds::StatesDiscoverCmd::current pub async fn diff_current_stored( cmd_ctx: &mut CmdCtx>, @@ -209,32 +209,32 @@ impl DiffCmd where CmdCtxTypesT: CmdCtxTypesConstrained, { - /// Returns the [`state_diff`]` for each [`Item`]. + /// Returns the [`state_diff`]` for each [`Step`]. /// /// This does not take in `CmdCtx` as it may be used by both /// `SingleProfileSingleFlow` and `MultiProfileSingleFlow` /// commands. /// - /// [`Item`]: peace_cfg::Item - /// [`state_diff`]: peace_cfg::Item::state_diff + /// [`Step`]: peace_cfg::Step + /// [`state_diff`]: peace_cfg::Step::state_diff pub async fn diff_any( flow: &Flow<::AppError>, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result::AppError> { let state_diffs = { let state_diffs_mut = flow .graph() .stream() .map(Result::<_, ::AppError>::Ok) - .try_filter_map(|item| async move { - let state_diff_opt = item + .try_filter_map(|step| async move { + let state_diff_opt = step .state_diff_exec(params_specs, resources, states_a, states_b) .await?; - Ok(state_diff_opt.map(|state_diff| (item.id().clone(), state_diff))) + Ok(state_diff_opt.map(|state_diff| (step.id().clone(), state_diff))) }) .try_collect::() .await?; diff --git a/crate/rt/src/cmds/ensure_cmd.rs b/crate/rt/src/cmds/ensure_cmd.rs index 213612f02..b18a58149 100644 --- a/crate/rt/src/cmds/ensure_cmd.rs +++ b/crate/rt/src/cmds/ensure_cmd.rs @@ -12,7 +12,7 @@ use peace_resources::{ states::{States, StatesEnsured, StatesEnsuredDry, StatesGoal, StatesPrevious}, Resources, }; -use peace_rt_model::{ItemGraph, Storage}; +use peace_rt_model::{StepGraph, Storage}; use crate::{ cmd_blocks::{ @@ -29,29 +29,29 @@ impl EnsureCmd where CmdCtxTypesT: CmdCtxTypesConstrained, { - /// Conditionally runs [`Item::apply_exec_dry`] for each [`Item`]. + /// Conditionally runs [`Step::apply_exec_dry`] for each [`Step`]. /// - /// In practice this runs [`Item::apply_check`], and only runs + /// In practice this runs [`Step::apply_check`], and only runs /// [`apply_exec_dry`] if execution is required. /// /// # Design /// - /// The grouping of item functions run for an `Ensure` execution to + /// The grouping of step functions run for an `Ensure` execution to /// work is as follows: /// - /// 1. For each `Item` run `ItemRt::ensure_prepare`, which runs: + /// 1. For each `Step` run `StepRt::ensure_prepare`, which runs: /// - /// 1. `Item::state_current` - /// 2. `Item::state_goal` - /// 3. `Item::apply_check` + /// 1. `Step::state_current` + /// 2. `Step::state_goal` + /// 3. `Step::apply_check` /// - /// 2. For `Item`s that return `ApplyCheck::ExecRequired`, run - /// `Item::apply_exec_dry`. + /// 2. For `Step`s that return `ApplyCheck::ExecRequired`, run + /// `Step::apply_exec_dry`. /// - /// [`apply_exec_dry`]: peace_cfg::Item::apply_exec_dry - /// [`Item::apply_check`]: peace_cfg::Item::apply_check - /// [`Item::apply_exec_dry`]: peace_cfg::ItemRt::apply_exec_dry - /// [`Item`]: peace_cfg::Item + /// [`apply_exec_dry`]: peace_cfg::Step::apply_exec_dry + /// [`Step::apply_check`]: peace_cfg::Step::apply_check + /// [`Step::apply_exec_dry`]: peace_cfg::StepRt::apply_exec_dry + /// [`Step`]: peace_cfg::Step pub async fn exec_dry<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -64,7 +64,7 @@ where Self::exec_dry_with(cmd_ctx, ApplyStoredStateSync::Both).await } - /// Conditionally runs [`Item::apply_exec_dry`] for each [`Item`]. + /// Conditionally runs [`Step::apply_exec_dry`] for each [`Step`]. /// /// See [`Self::exec_dry`] for full documentation. /// @@ -98,29 +98,29 @@ where Ok(cmd_outcome) } - /// Conditionally runs [`Item::apply_exec`] for each [`Item`]. + /// Conditionally runs [`Step::apply_exec`] for each [`Step`]. /// - /// In practice this runs [`Item::apply_check`], and only runs + /// In practice this runs [`Step::apply_check`], and only runs /// [`apply_exec`] if execution is required. /// /// # Design /// - /// The grouping of item functions run for an `Ensure` execution to + /// The grouping of step functions run for an `Ensure` execution to /// work is as follows: /// - /// 1. For each `Item` run `ItemRt::ensure_prepare`, which runs: + /// 1. For each `Step` run `StepRt::ensure_prepare`, which runs: /// - /// 1. `Item::state_current` - /// 2. `Item::state_goal` - /// 3. `Item::apply_check` + /// 1. `Step::state_current` + /// 2. `Step::state_goal` + /// 3. `Step::apply_check` /// - /// 2. For `Item`s that return `ApplyCheck::ExecRequired`, run - /// `Item::apply_exec`. + /// 2. For `Step`s that return `ApplyCheck::ExecRequired`, run + /// `Step::apply_exec`. /// - /// [`apply_exec`]: peace_cfg::Item::apply_exec - /// [`Item::apply_check`]: peace_cfg::Item::apply_check - /// [`Item::apply_exec`]: peace_cfg::ItemRt::apply_exec - /// [`Item`]: peace_cfg::Item + /// [`apply_exec`]: peace_cfg::Step::apply_exec + /// [`Step::apply_check`]: peace_cfg::Step::apply_check + /// [`Step::apply_exec`]: peace_cfg::StepRt::apply_exec + /// [`Step`]: peace_cfg::Step pub async fn exec<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -133,7 +133,7 @@ where Self::exec_with(cmd_ctx, ApplyStoredStateSync::Both).await } - /// Conditionally runs [`Item::apply_exec`] for each [`Item`]. + /// Conditionally runs [`Step::apply_exec`] for each [`Step`]. /// /// See [`Self::exec`] for full documentation. /// @@ -154,7 +154,7 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (item_graph, resources) = (flow.graph(), resources); + let (step_graph, resources) = (flow.graph(), resources); // We shouldn't serialize current or goal if we returned from an interruption / // error handler. @@ -164,8 +164,8 @@ where EnsureExecChange::None => Ok(Default::default()), EnsureExecChange::Some(stateses_boxed) => { let (states_previous, states_applied, states_goal) = *stateses_boxed; - Self::serialize_current(item_graph, resources, &states_applied).await?; - Self::serialize_goal(item_graph, resources, &states_goal).await?; + Self::serialize_current(step_graph, resources, &states_applied).await?; + Self::serialize_goal(step_graph, resources, &states_goal).await?; resources.insert::(states_previous); @@ -178,14 +178,14 @@ where cmd_outcome.transpose() } - /// Conditionally runs [`ApplyFns`]`::`[`exec`] for each [`Item`]. + /// Conditionally runs [`ApplyFns`]`::`[`exec`] for each [`Step`]. /// /// Same as [`Self::exec`], but does not change the type state, and returns /// [`StatesEnsured`]. /// /// [`exec`]: peace_cfg::ApplyFns::exec - /// [`Item`]: peace_cfg::Item - /// [`ApplyFns`]: peace_cfg::Item::ApplyFns + /// [`Step`]: peace_cfg::Step + /// [`ApplyFns`]: peace_cfg::Step::ApplyFns async fn exec_internal<'ctx, StatesTs>( cmd_ctx: &mut CmdCtx>, apply_stored_state_sync: ApplyStoredStateSync, @@ -281,10 +281,10 @@ where // i.e. is it part of `ApplyFns::exec`'s contract to return the state. // // * It may be duplication of code. - // * `FileDownloadItem` needs to know the ETag from the last request, which: + // * `FileDownloadStep` needs to know the ETag from the last request, which: // - in `StatesCurrentFn` comes from `StatesCurrent` // - in `EnsureCmd` comes from `Ensured` - // * `ShCmdItem` doesn't return the state in the apply script, so in the item we + // * `ShCmdStep` doesn't return the state in the apply script, so in the step we // run the state current script after the apply exec script. Ok(ensure_exec_change) @@ -292,7 +292,7 @@ where // TODO: This duplicates a bit of code with `StatesDiscoverCmd`, async fn serialize_current( - item_graph: &ItemGraph<::AppError>, + step_graph: &StepGraph<::AppError>, resources: &Resources, states_applied: &StatesEnsured, ) -> Result<(), ::AppError> { @@ -302,7 +302,7 @@ where let storage = resources.borrow::(); let states_current_file = StatesCurrentFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, item_graph, states_applied, &states_current_file) + StatesSerializer::serialize(&storage, step_graph, states_applied, &states_current_file) .await?; drop(flow_dir); @@ -312,7 +312,7 @@ where } async fn serialize_goal( - item_graph: &ItemGraph<::AppError>, + step_graph: &StepGraph<::AppError>, resources: &Resources, states_goal: &StatesGoal, ) -> Result<(), ::AppError> { @@ -322,7 +322,7 @@ where let storage = resources.borrow::(); let states_goal_file = StatesGoalFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, item_graph, states_goal, &states_goal_file).await?; + StatesSerializer::serialize(&storage, step_graph, states_goal, &states_goal_file).await?; drop(flow_dir); drop(storage); diff --git a/crate/rt/src/cmds/states_discover_cmd.rs b/crate/rt/src/cmds/states_discover_cmd.rs index a437d9f6f..f6eb4929f 100644 --- a/crate/rt/src/cmds/states_discover_cmd.rs +++ b/crate/rt/src/cmds/states_discover_cmd.rs @@ -12,7 +12,7 @@ use peace_resources::{ states::{StatesCurrent, StatesGoal}, Resources, }; -use peace_rt_model::{ItemGraph, Storage}; +use peace_rt_model::{StepGraph, Storage}; use crate::cmd_blocks::StatesDiscoverCmdBlock; @@ -28,14 +28,14 @@ impl StatesDiscoverCmd where CmdCtxTypesT: CmdCtxTypesConstrained, { - /// Runs [`try_state_current`] for each [`Item`]. + /// Runs [`try_state_current`] for each [`Step`]. /// /// At the end of this function, [`Resources`] will be populated with /// [`StatesCurrent`], and will be serialized to /// `$flow_dir/states_current.yaml`. /// /// If any `state_current` function needs to read the `State` from a - /// previous `Item`, it may automatically be referenced using [`Current`] + /// previous `Step`, it may automatically be referenced using [`Current`] /// where `T` us the predecessor's state. Peace will have automatically /// inserted it into `Resources`, and the successor should references it /// in their [`Data`]. @@ -44,8 +44,8 @@ where /// /// [`Current`]: https://docs.rs/peace_data/latest/peace_data/marker/struct.Current.html /// [`Data`]: peace_cfg::TryFnSpec::Data - /// [`Item`]: peace_cfg::Item - /// [`try_state_current`]: peace_cfg::Item::try_state_current + /// [`Step`]: peace_cfg::Step + /// [`try_state_current`]: peace_cfg::Step::try_state_current pub async fn current<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -58,7 +58,7 @@ where Self::current_with(cmd_ctx, true).await } - /// Runs [`try_state_current`] for each [`Item`]. + /// Runs [`try_state_current`] for each [`Step`]. /// /// See [`Self::current`] for full documentation. /// @@ -71,7 +71,7 @@ where /// * `serialize_to_storage`: Whether to write states to storage after /// discovery. /// - /// [`try_state_current`]: peace_cfg::Item::try_state_current + /// [`try_state_current`]: peace_cfg::Step::try_state_current pub async fn current_with<'ctx>( cmd_ctx: &mut CmdCtx>, serialize_to_storage: bool, @@ -98,24 +98,24 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (item_graph, resources) = (flow.graph(), resources); + let (step_graph, resources) = (flow.graph(), resources); if serialize_to_storage { - Self::serialize_current(item_graph, resources, states_current).await?; + Self::serialize_current(step_graph, resources, states_current).await?; } } Ok(cmd_outcome) } - /// Runs [`try_state_goal`] for each [`Item`]. + /// Runs [`try_state_goal`] for each [`Step`]. /// /// At the end of this function, [`Resources`] will be populated with /// [`StatesGoal`], and will be serialized to /// `$flow_dir/states_goal.yaml`. /// /// If any `state_goal` function needs to read the `State` from a - /// previous `Item`, it may automatically be referenced using [`Goal`] + /// previous `Step`, it may automatically be referenced using [`Goal`] /// where `T` us the predecessor's state. Peace will have automatically /// inserted it into `Resources`, and the successor should references it /// in their [`Data`]. @@ -124,8 +124,8 @@ where /// /// [`Data`]: peace_cfg::TryFnSpec::Data /// [`Goal`]: https://docs.rs/peace_data/latest/peace_data/marker/struct.Goal.html - /// [`Item`]: peace_cfg::Item - /// [`try_state_goal`]: peace_cfg::Item::try_state_goal + /// [`Step`]: peace_cfg::Step + /// [`try_state_goal`]: peace_cfg::Step::try_state_goal pub async fn goal<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -138,7 +138,7 @@ where Self::goal_with(cmd_ctx, true).await } - /// Runs [`try_state_goal`] for each [`Item`]. + /// Runs [`try_state_goal`] for each [`Step`]. /// /// See [`Self::goal`] for full documentation. /// @@ -151,7 +151,7 @@ where /// * `serialize_to_storage`: Whether to write states to storage after /// discovery. /// - /// [`try_state_goal`]: peace_cfg::Item::try_state_goal + /// [`try_state_goal`]: peace_cfg::Step::try_state_goal pub async fn goal_with<'ctx>( cmd_ctx: &mut CmdCtx>, serialize_to_storage: bool, @@ -178,10 +178,10 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (item_graph, resources) = (flow.graph(), resources); + let (step_graph, resources) = (flow.graph(), resources); if serialize_to_storage { - Self::serialize_goal(item_graph, resources, states_goal).await?; + Self::serialize_goal(step_graph, resources, states_goal).await?; } } @@ -189,7 +189,7 @@ where } /// Runs [`try_state_current`] and [`try_state_goal`]` for each - /// [`Item`]. + /// [`Step`]. /// /// At the end of this function, [`Resources`] will be populated with /// [`StatesCurrent`] and [`StatesGoal`], and states will be serialized @@ -197,12 +197,12 @@ where /// `$flow_dir/states_goal.yaml`. /// /// If any `state_current` function needs to read the `State` from a - /// previous `Item`, the predecessor should insert a copy / clone of + /// previous `Step`, the predecessor should insert a copy / clone of /// their state into `Resources`, and the successor should references it /// in their [`Data`]. /// /// If any `state_goal` function needs to read the `State` from a - /// previous `Item`, it may automatically be referenced using + /// previous `Step`, it may automatically be referenced using /// [`Goal`] where `T` us the predecessor's state. Peace will have /// automatically inserted it into `Resources`, and the successor should /// references it in their [`Data`]. @@ -212,9 +212,9 @@ where /// [`Current`]: https://docs.rs/peace_data/latest/peace_data/marker/struct.Current.html /// [`Data`]: peace_cfg::TryFnSpec::Data /// [`Goal`]: https://docs.rs/peace_data/latest/peace_data/marker/struct.Goal.html - /// [`Item`]: peace_cfg::Item - /// [`try_state_current`]: peace_cfg::Item::try_state_current - /// [`try_state_goal`]: peace_cfg::Item::try_state_goal + /// [`Step`]: peace_cfg::Step + /// [`try_state_current`]: peace_cfg::Step::try_state_current + /// [`try_state_goal`]: peace_cfg::Step::try_state_goal pub async fn current_and_goal<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -228,7 +228,7 @@ where } /// Runs [`try_state_current`] and [`try_state_goal`]` for each - /// [`Item`]. + /// [`Step`]. /// /// See [`Self::goal`] for full documentation. /// @@ -241,8 +241,8 @@ where /// * `serialize_to_storage`: Whether to write states to storage after /// discovery. /// - /// [`try_state_current`]: peace_cfg::Item::try_state_current - /// [`try_state_goal`]: peace_cfg::Item::try_state_goal + /// [`try_state_current`]: peace_cfg::Step::try_state_current + /// [`try_state_goal`]: peace_cfg::Step::try_state_goal pub async fn current_and_goal_with<'ctx>( cmd_ctx: &mut CmdCtx>, serialize_to_storage: bool, @@ -282,11 +282,11 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (item_graph, resources) = (flow.graph(), resources); + let (step_graph, resources) = (flow.graph(), resources); if serialize_to_storage { - Self::serialize_current(item_graph, resources, states_current).await?; - Self::serialize_goal(item_graph, resources, states_goal).await?; + Self::serialize_current(step_graph, resources, states_current).await?; + Self::serialize_goal(step_graph, resources, states_goal).await?; } } @@ -295,7 +295,7 @@ where // TODO: This duplicates a bit of code with `EnsureCmd` and `CleanCmd`. async fn serialize_current( - item_graph: &ItemGraph<::AppError>, + step_graph: &StepGraph<::AppError>, resources: &mut Resources, states_current: &StatesCurrent, ) -> Result<(), ::AppError> { @@ -305,7 +305,7 @@ where let storage = resources.borrow::(); let states_current_file = StatesCurrentFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, item_graph, states_current, &states_current_file) + StatesSerializer::serialize(&storage, step_graph, states_current, &states_current_file) .await?; drop(flow_dir); @@ -317,7 +317,7 @@ where } async fn serialize_goal( - item_graph: &ItemGraph<::AppError>, + step_graph: &StepGraph<::AppError>, resources: &mut Resources, states_goal: &StatesGoal, ) -> Result<(), ::AppError> { @@ -327,7 +327,7 @@ where let storage = resources.borrow::(); let states_goal_file = StatesGoalFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, item_graph, states_goal, &states_goal_file).await?; + StatesSerializer::serialize(&storage, step_graph, states_goal, &states_goal_file).await?; drop(flow_dir); drop(storage); diff --git a/crate/rt/src/lib.rs b/crate/rt/src/lib.rs index d1b068d7a..8a43b816c 100644 --- a/crate/rt/src/lib.rs +++ b/crate/rt/src/lib.rs @@ -1,6 +1,6 @@ //! Runtime logic for the peace automation library. -/// Maximum number of items to execute simultaneously. +/// Maximum number of steps to execute simultaneously. /// /// 64 is arbitrarily chosen, as there is not enough data to inform us what a /// suitable number is. diff --git a/crate/rt_model/src/flow.rs b/crate/rt_model/src/flow.rs index 993112a7e..93141d09d 100644 --- a/crate/rt_model/src/flow.rs +++ b/crate/rt_model/src/flow.rs @@ -1,23 +1,23 @@ use peace_cfg::FlowId; use peace_data::fn_graph::GraphInfo; -use peace_flow_model::{FlowSpecInfo, ItemSpecInfo}; +use peace_flow_model::{FlowSpecInfo, StepSpecInfo}; -use crate::ItemGraph; +use crate::StepGraph; -/// A flow to manage items. +/// A flow to manage steps. /// /// A Flow ID is strictly associated with a [`StepGraph`], as the graph -/// contains the definitions to read and write the items' [`State`]s. +/// contains the definitions to read and write the steps' [`State`]s. /// -/// [`State`]: peace_cfg::Item::State +/// [`State`]: peace_cfg::Step::State #[derive(Debug)] pub struct Flow { /// ID of this flow. flow_id: FlowId, - /// Graph of [`Item`]s in this flow. + /// Graph of [`Step`]s in this flow. /// - /// [`Item`]: peace_cfg::Item - graph: ItemGraph, + /// [`Step`]: peace_cfg::Step + graph: StepGraph, } impl PartialEq for Flow @@ -42,7 +42,7 @@ impl Eq for Flow where E: 'static {} impl Flow { /// Returns a new `Flow`. - pub fn new(flow_id: FlowId, graph: ItemGraph) -> Self { + pub fn new(flow_id: FlowId, graph: StepGraph) -> Self { Self { flow_id, graph } } @@ -51,13 +51,13 @@ impl Flow { &self.flow_id } - /// Returns the item graph. - pub fn graph(&self) -> &ItemGraph { + /// Returns the step graph. + pub fn graph(&self) -> &StepGraph { &self.graph } - /// Returns a mutable reference to the item graph. - pub fn graph_mut(&self) -> &ItemGraph { + /// Returns a mutable reference to the step graph. + pub fn graph_mut(&self) -> &StepGraph { &self.graph } @@ -67,9 +67,9 @@ impl Flow { E: 'static, { let flow_id = self.flow_id.clone(); - let graph_info = GraphInfo::from_graph(&self.graph, |item_boxed| { - let item_id = item_boxed.id().clone(); - ItemSpecInfo { item_id } + let graph_info = GraphInfo::from_graph(&self.graph, |step_boxed| { + let step_id = step_boxed.id().clone(); + StepSpecInfo { step_id } }); FlowSpecInfo::new(flow_id, graph_info) diff --git a/crate/rt_model/src/lib.rs b/crate/rt_model/src/lib.rs index e01f71382..ebc79f4cb 100644 --- a/crate/rt_model/src/lib.rs +++ b/crate/rt_model/src/lib.rs @@ -14,9 +14,9 @@ pub use peace_rt_model_native::*; pub use peace_rt_model_web::*; pub use crate::{ - flow::Flow, in_memory_text_output::InMemoryTextOutput, item_boxed::ItemBoxed, - item_graph::ItemGraph, item_graph_builder::ItemGraphBuilder, item_rt::ItemRt, - item_wrapper::ItemWrapper, params_specs_serializer::ParamsSpecsSerializer, + flow::Flow, in_memory_text_output::InMemoryTextOutput, step_boxed::StepBoxed, + step_graph::StepGraph, step_graph_builder::StepGraphBuilder, step_rt::StepRt, + step_wrapper::StepWrapper, params_specs_serializer::ParamsSpecsSerializer, params_specs_type_reg::ParamsSpecsTypeReg, states_serializer::StatesSerializer, states_type_reg::StatesTypeReg, }; @@ -25,11 +25,11 @@ pub mod outcomes; mod flow; mod in_memory_text_output; -mod item_boxed; -mod item_graph; -mod item_graph_builder; -mod item_rt; -mod item_wrapper; +mod step_boxed; +mod step_graph; +mod step_graph_builder; +mod step_rt; +mod step_wrapper; mod params_specs_serializer; mod params_specs_type_reg; mod states_serializer; diff --git a/crate/rt_model/src/outcomes.rs b/crate/rt_model/src/outcomes.rs index 63d424cfb..8b8a00540 100644 --- a/crate/rt_model/src/outcomes.rs +++ b/crate/rt_model/src/outcomes.rs @@ -4,17 +4,17 @@ //! outcomes to be redisplayed without re-executing commands. pub use self::{ - item_apply::ItemApply, item_apply_boxed::ItemApplyBoxed, item_apply_partial::ItemApplyPartial, - item_apply_partial_boxed::ItemApplyPartialBoxed, item_apply_partial_rt::ItemApplyPartialRt, - item_apply_rt::ItemApplyRt, + step_apply::StepApply, step_apply_boxed::StepApplyBoxed, step_apply_partial::StepApplyPartial, + step_apply_partial_boxed::StepApplyPartialBoxed, step_apply_partial_rt::StepApplyPartialRt, + step_apply_rt::StepApplyRt, }; -mod item_apply; -mod item_apply_boxed; -mod item_apply_partial; -mod item_apply_partial_boxed; -mod item_apply_partial_rt; -mod item_apply_rt; +mod step_apply; +mod step_apply_boxed; +mod step_apply_partial; +mod step_apply_partial_boxed; +mod step_apply_partial_rt; +mod step_apply_rt; macro_rules! box_data_type_newtype { ($ty_name:ident, $trait_path:path) => { diff --git a/crate/rt_model/src/outcomes/step_apply.rs b/crate/rt_model/src/outcomes/step_apply.rs index e2c7d9d67..c6326b8ab 100644 --- a/crate/rt_model/src/outcomes/step_apply.rs +++ b/crate/rt_model/src/outcomes/step_apply.rs @@ -4,14 +4,14 @@ use peace_cfg::ApplyCheck; use peace_resources::type_reg::untagged::{BoxDtDisplay, DataType}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use crate::outcomes::{ItemApplyPartial, ItemApplyRt}; +use crate::outcomes::{StepApplyPartial, StepApplyRt}; /// Information about a step during an `ApplyCmd` execution. /// -/// This is similar to [`ItemApplyPartial`], with most fields being +/// This is similar to [`StepApplyPartial`], with most fields being /// non-optional, and the added `state_applied` field. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct ItemApply { +pub struct StepApply { /// Current state stored on disk before the execution. pub state_current_stored: Option, /// Current state discovered during the execution. @@ -20,21 +20,21 @@ pub struct ItemApply { pub state_target: State, /// Diff between current and goal states. pub state_diff: StateDiff, - /// Whether item execution was required. + /// Whether step execution was required. pub apply_check: ApplyCheck, /// The state that was applyd, `None` if execution was not required. pub state_applied: Option, } -impl TryFrom<(ItemApplyPartial, Option)> - for ItemApply +impl TryFrom<(StepApplyPartial, Option)> + for StepApply { - type Error = (ItemApplyPartial, Option); + type Error = (StepApplyPartial, Option); fn try_from( - (partial, state_applied): (ItemApplyPartial, Option), + (partial, state_applied): (StepApplyPartial, Option), ) -> Result { - let ItemApplyPartial { + let StepApplyPartial { state_current_stored, state_current, state_target, @@ -61,7 +61,7 @@ impl TryFrom<(ItemApplyPartial, Option TryFrom<(ItemApplyPartial, Option ItemApplyRt for ItemApply +impl StepApplyRt for StepApply where State: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static, StateDiff: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static, diff --git a/crate/rt_model/src/outcomes/step_apply_boxed.rs b/crate/rt_model/src/outcomes/step_apply_boxed.rs index bad5ca247..56e6b95a8 100644 --- a/crate/rt_model/src/outcomes/step_apply_boxed.rs +++ b/crate/rt_model/src/outcomes/step_apply_boxed.rs @@ -1,18 +1,18 @@ -use crate::outcomes::{ItemApply, ItemApplyRt}; +use crate::outcomes::{StepApply, StepApplyRt}; -/// A boxed `ItemApply`. +/// A boxed `StepApply`. #[derive(Clone, serde::Serialize)] -pub struct ItemApplyBoxed(pub(crate) Box); +pub struct StepApplyBoxed(pub(crate) Box); -impl From> for ItemApplyBoxed +impl From> for StepApplyBoxed where - ItemApply: ItemApplyRt, + StepApply: StepApplyRt, { /// Returns a `StepApplyBoxed` which erases a `StepApply`'s type /// parameters. - fn from(item_apply: ItemApply) -> Self { - Self(Box::new(item_apply)) + fn from(step_apply: StepApply) -> Self { + Self(Box::new(step_apply)) } } -crate::outcomes::box_data_type_newtype!(ItemApplyBoxed, ItemApplyRt); +crate::outcomes::box_data_type_newtype!(StepApplyBoxed, StepApplyRt); diff --git a/crate/rt_model/src/outcomes/step_apply_partial.rs b/crate/rt_model/src/outcomes/step_apply_partial.rs index a16bbb6e1..ec56c7d5a 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial.rs @@ -4,20 +4,20 @@ use peace_cfg::ApplyCheck; use peace_resources::type_reg::untagged::{BoxDtDisplay, DataType}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use crate::outcomes::ItemApplyPartialRt; +use crate::outcomes::StepApplyPartialRt; /// Information about a step during an `ApplyCmd` execution. /// /// # Design Note /// -/// 1. `ApplyCmd` calls the following function for each item. +/// 1. `ApplyCmd` calls the following function for each step. /// -/// - [`Item::state_current`] -/// - [`Item::state_goal`] or [`Item::state_clean`] -/// - [`Item::state_diff`] +/// - [`Step::state_current`] +/// - [`Step::state_goal`] or [`Step::state_clean`] +/// - [`Step::state_diff`] /// - [`ApplyFns::check`] /// - [`ApplyFns::exec`] -/// - [`Item::state_current`] +/// - [`Step::state_current`] /// /// 2. Each function call *may* fail. /// 3. If we have an enum representing the state after each function call, we @@ -26,13 +26,13 @@ use crate::outcomes::ItemApplyPartialRt; /// It is not likely to be error prone or too unergonomic to store each field as /// optional. /// -/// [`Item::state_current`]: peace_cfg::Item::state_current -/// [`Item::state_goal`]: peace_cfg::Item::state_goal -/// [`Item::state_diff`]: peace_cfg::Item::state_diff -/// [`ApplyFns::check`]: peace_cfg::Item::ApplyFns -/// [`ApplyFns::exec`]: peace_cfg::Item::ApplyFns +/// [`Step::state_current`]: peace_cfg::Step::state_current +/// [`Step::state_goal`]: peace_cfg::Step::state_goal +/// [`Step::state_diff`]: peace_cfg::Step::state_diff +/// [`ApplyFns::check`]: peace_cfg::Step::ApplyFns +/// [`ApplyFns::exec`]: peace_cfg::Step::ApplyFns #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct ItemApplyPartial { +pub struct StepApplyPartial { /// Current state stored on disk before the execution. pub state_current_stored: Option, /// Current state discovered during the execution. @@ -41,18 +41,18 @@ pub struct ItemApplyPartial { pub state_target: Option, /// Diff between current and goal states. pub state_diff: Option, - /// Whether item execution is required. + /// Whether step execution is required. pub apply_check: Option, } -impl ItemApplyPartial { - /// Returns a new `ItemApplyPartial` with all fields set to `None`. +impl StepApplyPartial { + /// Returns a new `StepApplyPartial` with all fields set to `None`. pub fn new() -> Self { Self::default() } } -impl Default for ItemApplyPartial { +impl Default for StepApplyPartial { fn default() -> Self { Self { state_current_stored: None, @@ -64,7 +64,7 @@ impl Default for ItemApplyPartial { } } -impl ItemApplyPartialRt for ItemApplyPartial +impl StepApplyPartialRt for StepApplyPartial where State: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static, StateDiff: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static, diff --git a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs index 72e17a971..0d578aca3 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs @@ -1,18 +1,18 @@ -use crate::outcomes::{ItemApplyPartial, ItemApplyPartialRt}; +use crate::outcomes::{StepApplyPartial, StepApplyPartialRt}; -/// A boxed `ItemApplyPartial`. +/// A boxed `StepApplyPartial`. #[derive(Clone, serde::Serialize)] -pub struct ItemApplyPartialBoxed(pub(crate) Box); +pub struct StepApplyPartialBoxed(pub(crate) Box); -impl From> for ItemApplyPartialBoxed +impl From> for StepApplyPartialBoxed where - ItemApplyPartial: ItemApplyPartialRt, + StepApplyPartial: StepApplyPartialRt, { /// Returns a `StepApplyPartialBoxed` which erases an - /// `ItemApplyPartial`'s type parameters. - fn from(item_apply: ItemApplyPartial) -> Self { - Self(Box::new(item_apply)) + /// `StepApplyPartial`'s type parameters. + fn from(step_apply: StepApplyPartial) -> Self { + Self(Box::new(step_apply)) } } -crate::outcomes::box_data_type_newtype!(ItemApplyPartialBoxed, ItemApplyPartialRt); +crate::outcomes::box_data_type_newtype!(StepApplyPartialBoxed, StepApplyPartialRt); diff --git a/crate/rt_model/src/outcomes/step_apply_partial_rt.rs b/crate/rt_model/src/outcomes/step_apply_partial_rt.rs index 8567d7645..796a59b82 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial_rt.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial_rt.rs @@ -1,8 +1,8 @@ use peace_cfg::ApplyCheck; use peace_resources::type_reg::untagged::{BoxDtDisplay, DataType}; -/// Trait to allow inspecting a type-erased `ItemApplyPartial`. -pub trait ItemApplyPartialRt: DataType { +/// Trait to allow inspecting a type-erased `StepApplyPartial`. +pub trait StepApplyPartialRt: DataType { /// Returns `state_current_stored` as type-erased data. fn state_current_stored(&self) -> Option; @@ -25,9 +25,9 @@ pub trait ItemApplyPartialRt: DataType { fn as_data_type_mut(&mut self) -> &mut dyn DataType; } -dyn_clone::clone_trait_object!(ItemApplyPartialRt); +dyn_clone::clone_trait_object!(StepApplyPartialRt); -impl ItemApplyPartialRt for Box { +impl StepApplyPartialRt for Box { fn state_current_stored(&self) -> Option { self.as_ref().state_current_stored() } @@ -57,7 +57,7 @@ impl ItemApplyPartialRt for Box { } } -impl<'a> serde::Serialize for dyn ItemApplyPartialRt + 'a { +impl<'a> serde::Serialize for dyn StepApplyPartialRt + 'a { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crate/rt_model/src/outcomes/step_apply_rt.rs b/crate/rt_model/src/outcomes/step_apply_rt.rs index ec479b165..c4137bf6d 100644 --- a/crate/rt_model/src/outcomes/step_apply_rt.rs +++ b/crate/rt_model/src/outcomes/step_apply_rt.rs @@ -1,8 +1,8 @@ use peace_cfg::ApplyCheck; use peace_resources::type_reg::untagged::{BoxDtDisplay, DataType}; -/// Trait to allow inspecting a type-erased `ItemApply`. -pub trait ItemApplyRt: DataType { +/// Trait to allow inspecting a type-erased `StepApply`. +pub trait StepApplyRt: DataType { /// Returns `state_current_stored` as type-erased data. fn state_current_stored(&self) -> Option; @@ -28,9 +28,9 @@ pub trait ItemApplyRt: DataType { fn as_data_type_mut(&mut self) -> &mut dyn DataType; } -dyn_clone::clone_trait_object!(ItemApplyRt); +dyn_clone::clone_trait_object!(StepApplyRt); -impl ItemApplyRt for Box { +impl StepApplyRt for Box { fn state_current_stored(&self) -> Option { self.as_ref().state_current_stored() } @@ -64,7 +64,7 @@ impl ItemApplyRt for Box { } } -impl<'a> serde::Serialize for dyn ItemApplyRt + 'a { +impl<'a> serde::Serialize for dyn StepApplyRt + 'a { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crate/rt_model/src/params_specs_serializer.rs b/crate/rt_model/src/params_specs_serializer.rs index ce1c4ef2f..1a076269f 100644 --- a/crate/rt_model/src/params_specs_serializer.rs +++ b/crate/rt_model/src/params_specs_serializer.rs @@ -13,7 +13,7 @@ impl ParamsSpecsSerializer where E: std::error::Error + From + Send, { - /// Serializes the [`ParamsSpecs`] of all [`Item`]s to disk. + /// Serializes the [`ParamsSpecs`] of all [`Step`]s to disk. /// /// # Parameters: /// @@ -21,7 +21,7 @@ where /// * `params_specs`: `ParamsSpecs` to serialize. /// * `params_specs_file`: Path to save the serialized params_specs to. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step pub async fn serialize( storage: &Storage, params_specs: &ParamsSpecs, @@ -40,7 +40,7 @@ where Ok(()) } - /// Returns the [`ParamsSpecs`] of all [`Item`]s if it exists on disk. + /// Returns the [`ParamsSpecs`] of all [`Step`]s if it exists on disk. /// /// # Parameters: /// @@ -49,7 +49,7 @@ where /// each params spec. /// * `params_specs_file`: `ParamsSpecsFile` to deserialize. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step pub async fn deserialize_opt( profile: &Profile, flow_id: &FlowId, @@ -69,7 +69,7 @@ where .await } - /// Returns the [`ParamsSpecs`] of all [`Item`]s if it exists on disk. + /// Returns the [`ParamsSpecs`] of all [`Step`]s if it exists on disk. /// /// # Parameters: /// @@ -78,7 +78,7 @@ where /// each params spec. /// * `params_specs_file`: `ParamsSpecsFile` to deserialize. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step #[cfg(not(target_arch = "wasm32"))] async fn deserialize_internal( thread_name: String, @@ -138,7 +138,7 @@ where Ok(params_specs_opt) } - /// Returns the [`ParamsSpecs`] of all [`Item`]s if it exists on disk. + /// Returns the [`ParamsSpecs`] of all [`Step`]s if it exists on disk. /// /// # Parameters: /// @@ -147,7 +147,7 @@ where /// each params spec. /// * `params_specs_file`: `ParamsSpecsFile` to deserialize. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step #[cfg(target_arch = "wasm32")] async fn deserialize_internal( profile: &Profile, diff --git a/crate/rt_model/src/params_specs_type_reg.rs b/crate/rt_model/src/params_specs_type_reg.rs index 612e10fa3..b1702ee09 100644 --- a/crate/rt_model/src/params_specs_type_reg.rs +++ b/crate/rt_model/src/params_specs_type_reg.rs @@ -1,10 +1,10 @@ use std::ops::{Deref, DerefMut}; -use peace_cfg::ItemId; +use peace_cfg::StepId; use peace_params::AnySpecRtBoxed; use peace_resources::type_reg::untagged::TypeReg; -/// Type registry for each item's [`Params`]'s Spec. +/// Type registry for each step's [`Params`]'s Spec. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// @@ -13,10 +13,10 @@ use peace_resources::type_reg::untagged::TypeReg; /// /// [`AnySpecRtBoxed`]: peace_params::AnySpecRtBoxed /// [`BoxDtDisplay`]: peace_resources::type_reg::untagged::BoxDtDisplay -/// [`Params`]: peace_cfg::Item::Params +/// [`Params`]: peace_cfg::Step::Params /// [`StatesTypeReg`]: crate::StatesTypeReg #[derive(Debug, Default)] -pub struct ParamsSpecsTypeReg(TypeReg); +pub struct ParamsSpecsTypeReg(TypeReg); impl ParamsSpecsTypeReg { /// Returns a new `ParamsSpecsTypeReg`. @@ -26,7 +26,7 @@ impl ParamsSpecsTypeReg { } impl Deref for ParamsSpecsTypeReg { - type Target = TypeReg; + type Target = TypeReg; fn deref(&self) -> &Self::Target { &self.0 diff --git a/crate/rt_model/src/states_serializer.rs b/crate/rt_model/src/states_serializer.rs index 5ccc44f2f..e33b1086c 100644 --- a/crate/rt_model/src/states_serializer.rs +++ b/crate/rt_model/src/states_serializer.rs @@ -1,6 +1,6 @@ use std::{marker::PhantomData, path::Path}; -use peace_cfg::{FlowId, ItemId}; +use peace_cfg::{FlowId, StepId}; use peace_resources::{ paths::{StatesCurrentFile, StatesGoalFile}, states::{ @@ -10,7 +10,7 @@ use peace_resources::{ type_reg::untagged::{BoxDtDisplay, TypeMapOpt, TypeReg}, }; -use crate::{Error, ItemGraph, Storage}; +use crate::{Error, StepGraph, Storage}; /// Reads and writes [`StatesCurrentStored`] and [`StatesGoalStored`] to and /// from storage. @@ -20,7 +20,7 @@ impl StatesSerializer where E: std::error::Error + From + Send + 'static, { - /// Returns the [`StatesCurrentStored`] of all [`Item`]s if it exists on + /// Returns the [`StatesCurrentStored`] of all [`Step`]s if it exists on /// disk. /// /// # Parameters: @@ -29,17 +29,17 @@ where /// * `states`: States to serialize. /// * `states_file_path`: Path to save the serialized states to. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step pub async fn serialize( storage: &Storage, - item_graph: &ItemGraph, + step_graph: &StepGraph, states: &States, states_file_path: &Path, ) -> Result<(), E> where TS: Send + Sync, { - let states_serde = item_graph.states_serde::(states); + let states_serde = step_graph.states_serde::(states); storage .serialized_write( #[cfg(not(target_arch = "wasm32"))] @@ -53,21 +53,21 @@ where Ok(()) } - /// Returns the [`StatesCurrentStored`] of all [`Item`]s if it exists on + /// Returns the [`StatesCurrentStored`] of all [`Step`]s if it exists on /// disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// item state. + /// step state. /// * `states_current_file`: `StatesCurrentFile` to deserialize. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step pub async fn deserialize_stored( flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_current_file: &StatesCurrentFile, ) -> Result { let states = Self::deserialize_internal::( @@ -83,20 +83,20 @@ where states.ok_or_else(|| E::from(Error::StatesCurrentDiscoverRequired)) } - /// Returns the [`StatesGoalStored`] of all [`Item`]s if it exists on disk. + /// Returns the [`StatesGoalStored`] of all [`Step`]s if it exists on disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// item state. + /// step state. /// * `states_goal_file`: `StatesGoalFile` to deserialize. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step pub async fn deserialize_goal( flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_goal_file: &StatesGoalFile, ) -> Result { let states = Self::deserialize_internal::( @@ -112,21 +112,21 @@ where states.ok_or_else(|| E::from(Error::StatesGoalDiscoverRequired)) } - /// Returns the [`StatesCurrentStored`] of all [`Item`]s if it exists on + /// Returns the [`StatesCurrentStored`] of all [`Step`]s if it exists on /// disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// item state. + /// step state. /// * `states_current_file`: `StatesCurrentFile` to deserialize. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step pub async fn deserialize_stored_opt( flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_current_file: &StatesCurrentFile, ) -> Result, E> { Self::deserialize_internal( @@ -140,13 +140,13 @@ where .await } - /// Returns the [`States`] of all [`Item`]s if it exists on disk. + /// Returns the [`States`] of all [`Step`]s if it exists on disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// item state. + /// step state. /// * `states_current_file`: `StatesCurrentFile` to deserialize. /// /// # Type Parameters @@ -154,7 +154,7 @@ where /// * `TS`: The states type state to use, such as [`ts::Current`] or /// [`ts::CurrentStored`]. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step /// [`ts::Current`]: peace_resources::states::ts::Current /// [`ts::CurrentStored`]: peace_resources::states::ts::CurrentStored #[cfg(not(target_arch = "wasm32"))] @@ -162,7 +162,7 @@ where thread_name: String, flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_file_path: &Path, ) -> Result>, E> where @@ -208,13 +208,13 @@ where Ok(states_opt) } - /// Returns the [`States`] of all [`Item`]s if it exists on disk. + /// Returns the [`States`] of all [`Step`]s if it exists on disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// item state. + /// step state. /// * `states_current_file`: `StatesCurrentFile` to deserialize. /// /// # Type Parameters @@ -222,14 +222,14 @@ where /// * `TS`: The states type state to use, such as [`ts::Current`] or /// [`ts::CurrentStored`]. /// - /// [`Item`]: peace_cfg::Item + /// [`Step`]: peace_cfg::Step /// [`ts::Current`]: peace_resources::states::ts::Current /// [`ts::CurrentStored`]: peace_resources::states::ts::CurrentStored #[cfg(target_arch = "wasm32")] async fn deserialize_internal( flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_file_path: &Path, ) -> Result>, E> where diff --git a/crate/rt_model/src/states_type_reg.rs b/crate/rt_model/src/states_type_reg.rs index aeda73d79..72f4fba11 100644 --- a/crate/rt_model/src/states_type_reg.rs +++ b/crate/rt_model/src/states_type_reg.rs @@ -1,23 +1,23 @@ use std::ops::{Deref, DerefMut}; -use peace_cfg::ItemId; +use peace_cfg::StepId; use peace_resources::type_reg::untagged::{BoxDtDisplay, TypeReg}; -/// Type registry for each item's `State`. +/// Type registry for each step's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and [`StatesGoalFile`]. /// -/// Note: [`ItemParamsTypeReg`] uses [`BoxDt`], whereas this uses +/// Note: [`StepParamsTypeReg`] uses [`BoxDt`], whereas this uses /// [`BoxDtDisplay`]. /// /// [`BoxDt`]: peace_resources::type_reg::untagged::BoxDt /// [`BoxDtDisplay`]: peace_resources::type_reg::untagged::BoxDtDisplay -/// [`ItemParamsTypeReg`]: crate::ItemParamsTypeReg -/// [`Params`]: peace_cfg::Item::Params +/// [`StepParamsTypeReg`]: crate::StepParamsTypeReg +/// [`Params`]: peace_cfg::Step::Params /// [`StatesGoalFile`]: peace_resources::paths::StatesGoalFile /// [`StatesCurrentFile`]: peace_resources::paths::StatesCurrentFile #[derive(Debug, Default)] -pub struct StatesTypeReg(TypeReg); +pub struct StatesTypeReg(TypeReg); impl StatesTypeReg { /// Returns new `StatesTypeReg`. @@ -27,7 +27,7 @@ impl StatesTypeReg { } impl Deref for StatesTypeReg { - type Target = TypeReg; + type Target = TypeReg; fn deref(&self) -> &Self::Target { &self.0 diff --git a/crate/rt_model/src/step_boxed.rs b/crate/rt_model/src/step_boxed.rs index 5c652512f..0351e5833 100644 --- a/crate/rt_model/src/step_boxed.rs +++ b/crate/rt_model/src/step_boxed.rs @@ -1,59 +1,59 @@ -//! Contains type-erased `Item` types and traits. +//! Contains type-erased `Step` types and traits. //! //! Types and traits in this module don't reference any associated types from -//! the `Item`, allowing them to be passed around as common types at compile +//! the `Step`, allowing them to be passed around as common types at compile //! time. //! //! For the logic that is aware of the type parameters, see the -//! [`item_wrapper`] module and [`ItemWrapper`] type. +//! [`step_wrapper`] module and [`StepWrapper`] type. //! -//! [`item_wrapper`]: crate::item_wrapper -//! [`ItemWrapper`]: crate::ItemWrapper +//! [`step_wrapper`]: crate::step_wrapper +//! [`StepWrapper`]: crate::StepWrapper use std::{ fmt::Debug, ops::{Deref, DerefMut}, }; -use peace_cfg::Item; +use peace_cfg::Step; use peace_data::fn_graph::{DataAccessDyn, TypeIds}; use peace_params::Params; -use crate::{ItemRt, ItemWrapper}; +use crate::{StepRt, StepWrapper}; -/// Holds a type-erased `ItemWrapper` in a `Box`. +/// Holds a type-erased `StepWrapper` in a `Box`. /// /// # Type Parameters /// /// * `E`: Application specific error type. /// /// Notably, `E` here should be the application's error type, which is not -/// necessarily the item's error type (unless you have only one item +/// necessarily the step's error type (unless you have only one step /// spec in the application). #[derive(Debug)] -pub struct ItemBoxed(Box>); +pub struct StepBoxed(Box>); -impl Clone for ItemBoxed { +impl Clone for StepBoxed { fn clone(&self) -> Self { Self(dyn_clone::clone_box(self.0.as_ref())) } } -impl Deref for ItemBoxed { - type Target = dyn ItemRt; +impl Deref for StepBoxed { + type Target = dyn StepRt; fn deref(&self) -> &Self::Target { &*self.0 } } -impl DerefMut for ItemBoxed { +impl DerefMut for StepBoxed { fn deref_mut(&mut self) -> &mut Self::Target { &mut *self.0 } } -impl PartialEq for ItemBoxed +impl PartialEq for StepBoxed where E: 'static, { @@ -62,29 +62,29 @@ where } } -impl Eq for ItemBoxed where E: 'static {} +impl Eq for StepBoxed where E: 'static {} -impl From for ItemBoxed +impl From for StepBoxed where - I: Clone + Debug + Item + Send + Sync + 'static, - ::Error: Send + Sync, + I: Clone + Debug + Step + Send + Sync + 'static, + ::Error: Send + Sync, E: Debug + Send + Sync + std::error::Error - + From<::Error> + + From<::Error> + From + 'static, - for<'params> ::Params<'params>: - TryFrom<<::Params<'params> as Params>::Partial>, + for<'params> ::Params<'params>: + TryFrom<<::Params<'params> as Params>::Partial>, for<'params> as Params>::Partial: From>, { - fn from(item: I) -> Self { - Self(Box::new(ItemWrapper::from(item))) + fn from(step: I) -> Self { + Self(Box::new(StepWrapper::from(step))) } } -impl DataAccessDyn for ItemBoxed { +impl DataAccessDyn for StepBoxed { fn borrows(&self) -> TypeIds { DataAccessDyn::borrows(self.0.as_ref()) } diff --git a/crate/rt_model/src/step_graph.rs b/crate/rt_model/src/step_graph.rs index 3af8c64de..ebefeaa67 100644 --- a/crate/rt_model/src/step_graph.rs +++ b/crate/rt_model/src/step_graph.rs @@ -6,23 +6,23 @@ use std::{ use peace_data::fn_graph::FnGraph; use peace_resources::states::{States, StatesSerde}; -use crate::ItemBoxed; +use crate::StepBoxed; -/// Graph of all [`Item`]s, `FnGraph>` newtype. +/// Graph of all [`Step`]s, `FnGraph>` newtype. /// -/// [`Item`]: peace_cfg::Item +/// [`Step`]: peace_cfg::Step #[derive(Debug)] -pub struct ItemGraph(FnGraph>); +pub struct StepGraph(FnGraph>); // Manual implementation because derive requires `E` to be `Clone`, // which causes `graph.clone()` to call `FnGraph::clone`. -impl Clone for ItemGraph { +impl Clone for StepGraph { fn clone(&self) -> Self { Self(self.0.clone()) } } -impl PartialEq for ItemGraph +impl PartialEq for StepGraph where E: 'static, { @@ -31,56 +31,56 @@ where } } -impl Eq for ItemGraph where E: 'static {} +impl Eq for StepGraph where E: 'static {} -impl ItemGraph { +impl StepGraph { /// Returns the inner [`FnGraph`]. - pub fn into_inner(self) -> FnGraph> { + pub fn into_inner(self) -> FnGraph> { self.0 } /// Returns a user-friendly serializable states map. /// - /// This will contain an entry for all items, in order of flow item + /// This will contain an entry for all steps, in order of flow step /// insertion, whether or not a state exists in the provided `states` map. pub fn states_serde(&self, states: &States) -> StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, E: 'static, { - StatesSerde::from_iter(self.0.iter_insertion().map(|item| { - let item_id = item.id(); - (item_id.clone(), states.get_raw(item_id).cloned()) + StatesSerde::from_iter(self.0.iter_insertion().map(|step| { + let step_id = step.id(); + (step_id.clone(), states.get_raw(step_id).cloned()) })) } } -impl Deref for ItemGraph { - type Target = FnGraph>; +impl Deref for StepGraph { + type Target = FnGraph>; fn deref(&self) -> &Self::Target { &self.0 } } -impl DerefMut for ItemGraph { +impl DerefMut for StepGraph { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl From>> for ItemGraph { - fn from(graph: FnGraph>) -> Self { +impl From>> for StepGraph { + fn from(graph: FnGraph>) -> Self { Self(graph) } } -impl<'graph, ValueT, E> From<&'graph ItemGraph> for StatesSerde +impl<'graph, ValueT, E> From<&'graph StepGraph> for StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, E: 'static, { - fn from(graph: &'graph ItemGraph) -> Self { - StatesSerde::from_iter(graph.iter_insertion().map(|item| (item.id().clone(), None))) + fn from(graph: &'graph StepGraph) -> Self { + StatesSerde::from_iter(graph.iter_insertion().map(|step| (step.id().clone(), None))) } } diff --git a/crate/rt_model/src/step_graph_builder.rs b/crate/rt_model/src/step_graph_builder.rs index 74ef36487..f4ff8125b 100644 --- a/crate/rt_model/src/step_graph_builder.rs +++ b/crate/rt_model/src/step_graph_builder.rs @@ -2,52 +2,52 @@ use std::ops::{Deref, DerefMut}; use peace_data::fn_graph::FnGraphBuilder; -use crate::{ItemBoxed, ItemGraph}; +use crate::{StepBoxed, StepGraph}; -/// Builder for a [`StepGraph`], `FnGraphBuilder>` +/// Builder for a [`StepGraph`], `FnGraphBuilder>` /// newtype. #[derive(Debug)] -pub struct ItemGraphBuilder(FnGraphBuilder>); +pub struct StepGraphBuilder(FnGraphBuilder>); -impl ItemGraphBuilder { - /// Returns a new `ItemGraphBuilder`. +impl StepGraphBuilder { + /// Returns a new `StepGraphBuilder`. pub fn new() -> Self { Self::default() } /// Returns the inner [`FnGraphBuilder`]. - pub fn into_inner(self) -> FnGraphBuilder> { + pub fn into_inner(self) -> FnGraphBuilder> { self.0 } - /// Builds and returns the [`ItemGraph`]. - pub fn build(self) -> ItemGraph { - ItemGraph::from(self.0.build()) + /// Builds and returns the [`StepGraph`]. + pub fn build(self) -> StepGraph { + StepGraph::from(self.0.build()) } } -impl Default for ItemGraphBuilder { +impl Default for StepGraphBuilder { fn default() -> Self { Self(FnGraphBuilder::default()) } } -impl Deref for ItemGraphBuilder { - type Target = FnGraphBuilder>; +impl Deref for StepGraphBuilder { + type Target = FnGraphBuilder>; fn deref(&self) -> &Self::Target { &self.0 } } -impl DerefMut for ItemGraphBuilder { +impl DerefMut for StepGraphBuilder { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl From>> for ItemGraphBuilder { - fn from(graph: FnGraphBuilder>) -> Self { +impl From>> for StepGraphBuilder { + fn from(graph: FnGraphBuilder>) -> Self { Self(graph) } } diff --git a/crate/rt_model/src/step_rt.rs b/crate/rt_model/src/step_rt.rs index 54c11b809..c8a39d0a9 100644 --- a/crate/rt_model/src/step_rt.rs +++ b/crate/rt_model/src/step_rt.rs @@ -1,7 +1,7 @@ use std::{any::Any, fmt::Debug}; use dyn_clone::DynClone; -use peace_cfg::{async_trait, FnCtx, ItemId}; +use peace_cfg::{async_trait, FnCtx, StepId}; use peace_data::fn_graph::{DataAccess, DataAccessDyn}; use peace_params::ParamsSpecs; use peace_resources::{ @@ -12,29 +12,29 @@ use peace_resources::{ }; use crate::{ - outcomes::{ItemApplyBoxed, ItemApplyPartialBoxed}, + outcomes::{StepApplyBoxed, StepApplyPartialBoxed}, ParamsSpecsTypeReg, StatesTypeReg, }; -/// Internal trait that erases the types from [`Item`] +/// Internal trait that erases the types from [`Step`] /// -/// This exists so that different implementations of [`Item`] can be held +/// This exists so that different implementations of [`Step`] can be held /// under the same boxed trait. /// -/// [`Item`]: peace_cfg::Item +/// [`Step`]: peace_cfg::Step #[async_trait(?Send)] -pub trait ItemRt: +pub trait StepRt: Any + Debug + DataAccess + DataAccessDyn + DynClone + Send + Sync + 'static { - /// Returns the ID of this item. + /// Returns the ID of this step. /// - /// See [`Item::id`]; + /// See [`Step::id`]; /// - /// [`Item::id`]: peace_cfg::Item::id - fn id(&self) -> &ItemId; + /// [`Step::id`]: peace_cfg::Step::id + fn id(&self) -> &StepId; - /// Returns whether this item is equal to the other. - fn eq(&self, other: &dyn ItemRt) -> bool; + /// Returns whether this step is equal to the other. + fn eq(&self, other: &dyn StepRt) -> bool; /// Returns `&self` as `&dyn Any`. /// @@ -42,7 +42,7 @@ pub trait ItemRt: /// requirement. fn as_any(&self) -> &dyn Any; - /// Initializes data for the item's functions. + /// Initializes data for the step's functions. async fn setup(&self, resources: &mut Resources) -> Result<(), E> where E: Debug + std::error::Error; @@ -50,7 +50,7 @@ pub trait ItemRt: /// Registers params and state types with the type registries for /// deserializing from disk. /// - /// This is necessary to deserialize `ItemParamsFile`, + /// This is necessary to deserialize `StepParamsFile`, /// `ParamsSpecsFile`, `StatesCurrentFile`, and `StatesGoalFile`. fn params_and_state_register( &self, @@ -61,14 +61,14 @@ pub trait ItemRt: /// Returns if the given two states equal. /// /// This returns an error if the boxed states could not be downcasted to - /// this item's state, which indicates one of the following: + /// this step's state, which indicates one of the following: /// - /// * Peace contains a bug, and passed an incorrect box to this item. - /// * Item IDs were swapped, such that `ItemA`'s state is passed to `ItemB`. + /// * Peace contains a bug, and passed an incorrect box to this step. + /// * Step IDs were swapped, such that `StepA`'s state is passed to `StepB`. /// - /// This needs some rework on how item IDs are implemented -- as in, - /// whether we should use a string newtype for `ItemId`s, or redesign - /// how `Item`s or related types are keyed. + /// This needs some rework on how step IDs are implemented -- as in, + /// whether we should use a string newtype for `StepId`s, or redesign + /// how `Step`s or related types are keyed. /// /// Note: it is impossible to call this method if a `Step`'s state type has /// changed -- it would have failed on deserialization. @@ -76,9 +76,9 @@ pub trait ItemRt: where E: Debug + std::error::Error; - /// Runs [`Item::state_clean`]. + /// Runs [`Step::state_clean`]. /// - /// [`Item::state_clean`]: peace_cfg::Item::state_clean + /// [`Step::state_clean`]: peace_cfg::Step::state_clean async fn state_clean( &self, params_specs: &ParamsSpecs, @@ -87,9 +87,9 @@ pub trait ItemRt: where E: Debug + std::error::Error; - /// Runs [`Item::state_current`]`::`[`try_exec`]. + /// Runs [`Step::state_current`]`::`[`try_exec`]. /// - /// [`Item::state_current`]: peace_cfg::Item::state_current + /// [`Step::state_current`]: peace_cfg::Step::state_current /// [`try_exec`]: peace_cfg::TryFnSpec::try_exec async fn state_current_try_exec( &self, @@ -100,9 +100,9 @@ pub trait ItemRt: where E: Debug + std::error::Error; - /// Runs [`Item::state_current`]`::`[`exec`]. + /// Runs [`Step::state_current`]`::`[`exec`]. /// - /// [`Item::state_current`]: peace_cfg::Item::state_current + /// [`Step::state_current`]: peace_cfg::Step::state_current /// [`exec`]: peace_cfg::TryFnSpec::exec async fn state_current_exec( &self, @@ -113,9 +113,9 @@ pub trait ItemRt: where E: Debug + std::error::Error; - /// Runs [`Item::state_goal`]`::`[`try_exec`]. + /// Runs [`Step::state_goal`]`::`[`try_exec`]. /// - /// [`Item::state_goal`]: peace_cfg::Item::state_goal + /// [`Step::state_goal`]: peace_cfg::Step::state_goal /// [`try_exec`]: peace_cfg::TryFnSpec::try_exec async fn state_goal_try_exec( &self, @@ -126,9 +126,9 @@ pub trait ItemRt: where E: Debug + std::error::Error; - /// Runs [`Item::state_goal`]`::`[`exec`]. + /// Runs [`Step::state_goal`]`::`[`exec`]. /// - /// [`Item::state_goal`]: peace_cfg::Item::state_goal + /// [`Step::state_goal`]: peace_cfg::Step::state_goal /// [`exec`]: peace_cfg::TryFnSpec::exec async fn state_goal_exec( &self, @@ -156,8 +156,8 @@ pub trait ItemRt: &self, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result, E> where E: Debug + std::error::Error; @@ -166,21 +166,21 @@ pub trait ItemRt: /// /// This runs the following functions in order: /// - /// * [`Item::state_current`] - /// * [`Item::state_goal`] - /// * [`Item::state_diff`] + /// * [`Step::state_current`] + /// * [`Step::state_goal`] + /// * [`Step::state_diff`] /// * [`ApplyFns::check`] /// - /// [`Item::state_current`]: peace_cfg::Item::state_current - /// [`Item::state_goal`]: peace_cfg::Item::state_goal - /// [`Item::state_diff`]: peace_cfg::Item::state_diff - /// [`ApplyFns::check`]: peace_cfg::Item::ApplyFns + /// [`Step::state_current`]: peace_cfg::Step::state_current + /// [`Step::state_goal`]: peace_cfg::Step::state_goal + /// [`Step::state_diff`]: peace_cfg::Step::state_diff + /// [`ApplyFns::check`]: peace_cfg::Step::ApplyFns async fn ensure_prepare( &self, params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - ) -> Result + ) -> Result where E: Debug + std::error::Error; @@ -188,25 +188,25 @@ pub trait ItemRt: /// /// This runs the following functions in order: /// - /// * [`Item::state_current`] - /// * [`Item::state_clean`] - /// * [`Item::state_diff`] + /// * [`Step::state_current`] + /// * [`Step::state_clean`] + /// * [`Step::state_diff`] /// * [`ApplyFns::check`] /// - /// [`Item::state_current`]: peace_cfg::Item::state_current - /// [`Item::state_clean`]: peace_cfg::Item::state_clean - /// [`Item::state_diff`]: peace_cfg::Item::state_diff - /// [`ApplyFns::check`]: peace_cfg::Item::ApplyFns + /// [`Step::state_current`]: peace_cfg::Step::state_current + /// [`Step::state_clean`]: peace_cfg::Step::state_clean + /// [`Step::state_diff`]: peace_cfg::Step::state_diff + /// [`ApplyFns::check`]: peace_cfg::Step::ApplyFns async fn clean_prepare( &self, states_current: &StatesCurrent, params_specs: &ParamsSpecs, resources: &Resources, - ) -> Result + ) -> Result where E: Debug + std::error::Error; - /// Dry applies the item from its current state to its goal state. + /// Dry applies the step from its current state to its goal state. /// /// This runs the following function in order, passing in the information /// collected from [`ensure_prepare`] or [`clean_prepare`]: @@ -216,20 +216,20 @@ pub trait ItemRt: /// # Parameters /// /// * `resources`: The resources in the current execution. - /// * `item_apply`: The information collected in `self.ensure_prepare`. + /// * `step_apply`: The information collected in `self.ensure_prepare`. /// - /// [`ApplyFns::exec_dry`]: peace_cfg::Item::ApplyFns + /// [`ApplyFns::exec_dry`]: peace_cfg::Step::ApplyFns async fn apply_exec_dry( &self, params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - item_apply: &mut ItemApplyBoxed, + step_apply: &mut StepApplyBoxed, ) -> Result<(), E> where E: Debug + std::error::Error; - /// Applies the item from its current state to its goal state. + /// Applies the step from its current state to its goal state. /// /// This runs the following function in order, passing in the information /// collected from [`ensure_prepare`] or [`clean_prepare`]: @@ -239,15 +239,15 @@ pub trait ItemRt: /// # Parameters /// /// * `resources`: The resources in the current execution. - /// * `item_apply`: The information collected in `self.ensure_prepare`. + /// * `step_apply`: The information collected in `self.ensure_prepare`. /// - /// [`ApplyFns::exec`]: peace_cfg::Item::ApplyFns + /// [`ApplyFns::exec`]: peace_cfg::Step::ApplyFns async fn apply_exec( &self, params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - item_apply: &mut ItemApplyBoxed, + step_apply: &mut StepApplyBoxed, ) -> Result<(), E> where E: Debug + std::error::Error; diff --git a/crate/rt_model/src/step_wrapper.rs b/crate/rt_model/src/step_wrapper.rs index 5d617277d..9174a4aeb 100644 --- a/crate/rt_model/src/step_wrapper.rs +++ b/crate/rt_model/src/step_wrapper.rs @@ -5,7 +5,7 @@ use std::{ ops::{Deref, DerefMut}, }; -use peace_cfg::{async_trait, ApplyCheck, FnCtx, Item, ItemId}; +use peace_cfg::{async_trait, ApplyCheck, FnCtx, Step, StepId}; use peace_data::{ fn_graph::{DataAccess, DataAccessDyn, TypeIds}, marker::{ApplyDry, Clean, Current, Goal}, @@ -21,24 +21,24 @@ use peace_resources::{ use type_reg::untagged::BoxDataTypeDowncast; use crate::{ - outcomes::{ItemApply, ItemApplyBoxed, ItemApplyPartial, ItemApplyPartialBoxed}, - ItemRt, ParamsSpecsTypeReg, StateDowncastError, StatesTypeReg, + outcomes::{StepApply, StepApplyBoxed, StepApplyPartial, StepApplyPartialBoxed}, + StepRt, ParamsSpecsTypeReg, StateDowncastError, StatesTypeReg, }; -/// Wraps a type implementing [`Item`]. +/// Wraps a type implementing [`Step`]. /// /// # Type Parameters /// -/// * `I`: Item type to wrap. +/// * `I`: Step type to wrap. /// * `E`: Application specific error type. /// /// Notably, `E` here should be the application's error type, which is not -/// necessarily the item's error type (unless you have only one item +/// necessarily the step's error type (unless you have only one step /// spec in the application). #[allow(clippy::type_complexity)] -pub struct ItemWrapper(I, PhantomData); +pub struct StepWrapper(I, PhantomData); -impl Clone for ItemWrapper +impl Clone for StepWrapper where I: Clone, { @@ -47,26 +47,26 @@ where } } -impl PartialEq for ItemWrapper { +impl PartialEq for StepWrapper { fn eq(&self, _other: &Self) -> bool { true } } -impl Eq for ItemWrapper {} +impl Eq for StepWrapper {} -impl ItemWrapper +impl StepWrapper where - I: Debug + Item + Send + Sync, + I: Debug + Step + Send + Sync, E: Debug + Send + Sync + std::error::Error - + From<::Error> + + From<::Error> + From + 'static, - for<'params> ::Params<'params>: - TryFrom<<::Params<'params> as Params>::Partial>, + for<'params> ::Params<'params>: + TryFrom<<::Params<'params> as Params>::Partial>, for<'params> as Params>::Partial: From>, { async fn state_clean( @@ -76,15 +76,15 @@ where ) -> Result { let state_clean = { let params_partial = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Clean, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -107,15 +107,15 @@ where ) -> Result, E> { let state_current = { let params_partial = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Current, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -140,15 +140,15 @@ where ) -> Result { let state_current = { let params = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Current, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -170,15 +170,15 @@ where fn_ctx: FnCtx<'_>, ) -> Result, E> { let params_partial = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Goal, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -194,12 +194,12 @@ where Ok(state_goal) } - /// Returns the goal state for this item. + /// Returns the goal state for this step. /// /// `value_resolution_ctx` is passed in because: /// /// * When discovering the goal state for a flow, without altering any - /// items, the goal state of a successor is dependent on the goal state of + /// steps, the goal state of a successor is dependent on the goal state of /// a predecessor. /// * When discovering the goal state of a successor, after a predecessor /// has had state applied, the predecessor's goal state does not @@ -217,15 +217,15 @@ where fn_ctx: FnCtx<'_>, ) -> Result { let params = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( value_resolution_mode, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -243,12 +243,12 @@ where &self, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result, E> { - let item_id = ::id(self); - let state_base = states_a.get::(item_id); - let state_goal = states_b.get::(item_id); + let step_id = ::id(self); + let state_base = states_a.get::(step_id); + let state_goal = states_b.get::(step_id); if let Some((state_base, state_goal)) = state_base.zip(state_goal) { let state_diff: I::StateDiff = self @@ -277,29 +277,29 @@ where ) -> Result { let state_diff: I::StateDiff = { let params_partial = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; // Running `diff` for a single profile will be between the current and goal // states, and parameters are not really intended to be used for diffing. // - // However for `ShCmdItem`, the shell script for diffing's path is in + // However for `ShCmdStep`, the shell script for diffing's path is in // params, which *likely* would be provided as direct `Value`s instead of // mapped from predecessors' state(s). Iff the values are mapped from a // predecessor's state, then we would want it to be the goal state, as that // is closest to the correct value -- `ValueResolutionMode::ApplyDry` is used in - // `Item::apply_dry`, and `ValueResolutionMode::Apply` is used in - // `Item::apply`. + // `Step::apply_dry`, and `ValueResolutionMode::Apply` is used in + // `Step::apply`. // // Running `diff` for multiple profiles will likely be between two profiles' // current states. let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Goal, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -325,11 +325,11 @@ where value_resolution_mode: ValueResolutionMode, ) -> Result { let params_partial = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; // Normally an `apply_check` only compares the states / state diff. @@ -341,7 +341,7 @@ where // state will be fed into successors' goal state. let mut value_resolution_ctx = ValueResolutionCtx::new( value_resolution_mode, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -354,7 +354,7 @@ where .await .map_err(Into::::into) } else { - // > If we cannot resolve parameters, then this item, and its predecessor are + // > If we cannot resolve parameters, then this step, and its predecessor are // > cleaned up. // // The above is not necessarily true -- the user may have provided an incorrect @@ -373,15 +373,15 @@ where state_diff: &I::StateDiff, ) -> Result { let params = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::ApplyDry, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -409,15 +409,15 @@ where state_diff: &I::StateDiff, ) -> Result { let params = { - let item_id = self.id(); + let step_id = self.id(); let params_spec = params_specs - .get::>, _>(item_id) + .get::>, _>(step_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - item_id: item_id.clone(), + step_id: step_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Current, - item_id.clone(), + step_id.clone(), tynm::type_name::>(), ); params_spec @@ -435,7 +435,7 @@ where } } -impl Debug for ItemWrapper +impl Debug for StepWrapper where I: Debug, { @@ -444,7 +444,7 @@ where } } -impl Deref for ItemWrapper { +impl Deref for StepWrapper { type Target = I; fn deref(&self) -> &Self::Target { @@ -452,26 +452,26 @@ impl Deref for ItemWrapper { } } -impl DerefMut for ItemWrapper { +impl DerefMut for StepWrapper { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl From for ItemWrapper +impl From for StepWrapper where - I: Debug + Item + Send + Sync, - E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, + I: Debug + Step + Send + Sync, + E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, { - fn from(item: I) -> Self { - Self(item, PhantomData) + fn from(step: I) -> Self { + Self(step, PhantomData) } } -impl DataAccess for ItemWrapper +impl DataAccess for StepWrapper where - I: Debug + Item + Send + Sync, - E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, + I: Debug + Step + Send + Sync, + E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, { fn borrows() -> TypeIds { let mut type_ids = as DataAccess>::borrows(); @@ -485,10 +485,10 @@ where } } -impl DataAccessDyn for ItemWrapper +impl DataAccessDyn for StepWrapper where - I: Debug + Item + Send + Sync, - E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, + I: Debug + Step + Send + Sync, + E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, { fn borrows(&self) -> TypeIds { let mut type_ids = as DataAccess>::borrows(); @@ -503,29 +503,29 @@ where } #[async_trait(?Send)] -impl ItemRt for ItemWrapper +impl StepRt for StepWrapper where - I: Clone + Debug + Item + Send + Sync + 'static, + I: Clone + Debug + Step + Send + Sync + 'static, E: Debug + Send + Sync + std::error::Error - + From<::Error> + + From<::Error> + From + 'static, - for<'params> ::Params<'params>: - TryFrom<<::Params<'params> as Params>::Partial>, + for<'params> ::Params<'params>: + TryFrom<<::Params<'params> as Params>::Partial>, for<'params> as Params>::Partial: From>, { - fn id(&self) -> &ItemId { - ::id(self) + fn id(&self) -> &StepId { + ::id(self) } - fn eq(&self, other: &dyn ItemRt) -> bool { + fn eq(&self, other: &dyn StepRt) -> bool { if self.id() == other.id() { let other = other.as_any(); - if let Some(item_wrapper) = other.downcast_ref::() { - self == item_wrapper + if let Some(step_wrapper) = other.downcast_ref::() { + self == step_wrapper } else { false } @@ -550,7 +550,7 @@ where resources.insert(ApplyDry::(None)); // Run user defined setup. - ::setup(self, resources) + ::setup(self, resources) .await .map_err(Into::::into) } @@ -645,7 +645,7 @@ where fn_ctx: FnCtx<'_>, ) -> Result { self.state_goal_exec( - // Use the would-be state of predecessor to discover goal state of this item. + // Use the would-be state of predecessor to discover goal state of this step. // // TODO: this means we may need to overlay the goal state with the predecessor's // current state. @@ -666,8 +666,8 @@ where &self, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result, E> { self.state_diff_exec(params_specs, resources, states_a, states_b) .await @@ -680,15 +680,15 @@ where params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - ) -> Result { - let mut item_apply_partial = ItemApplyPartial::::new(); + ) -> Result { + let mut step_apply_partial = StepApplyPartial::::new(); match self .state_current_exec(params_specs, resources, fn_ctx) .await { - Ok(state_current) => item_apply_partial.state_current = Some(state_current), - Err(error) => return Err((error, item_apply_partial.into())), + Ok(state_current) => step_apply_partial.state_current = Some(state_current), + Err(error) => return Err((error, step_apply_partial.into())), } #[cfg(feature = "output_progress")] fn_ctx.progress_sender().reset_to_pending(); @@ -702,8 +702,8 @@ where ) .await { - Ok(state_goal) => item_apply_partial.state_target = Some(state_goal), - Err(error) => return Err((error, item_apply_partial.into())), + Ok(state_goal) => step_apply_partial.state_target = Some(state_goal), + Err(error) => return Err((error, step_apply_partial.into())), } #[cfg(feature = "output_progress")] fn_ctx.progress_sender().reset_to_pending(); @@ -711,25 +711,25 @@ where .state_diff_exec_with( params_specs, resources, - item_apply_partial + step_apply_partial .state_current .as_ref() .expect("unreachable: This is set just above."), - item_apply_partial + step_apply_partial .state_target .as_ref() .expect("unreachable: This is set just above."), ) .await { - Ok(state_diff) => item_apply_partial.state_diff = Some(state_diff), - Err(error) => return Err((error, item_apply_partial.into())), + Ok(state_diff) => step_apply_partial.state_diff = Some(state_diff), + Err(error) => return Err((error, step_apply_partial.into())), } let (Some(state_current), Some(state_goal), Some(state_diff)) = ( - item_apply_partial.state_current.as_ref(), - item_apply_partial.state_target.as_ref(), - item_apply_partial.state_diff.as_ref(), + step_apply_partial.state_current.as_ref(), + step_apply_partial.state_target.as_ref(), + step_apply_partial.state_diff.as_ref(), ) else { unreachable!("These are set just above."); }; @@ -747,7 +747,7 @@ where .await; let state_applied = match apply_check { Ok(apply_check) => { - item_apply_partial.apply_check = Some(apply_check); + step_apply_partial.apply_check = Some(apply_check); // TODO: write test for this case match apply_check { @@ -755,13 +755,13 @@ where ApplyCheck::ExecRequired => None, #[cfg(feature = "output_progress")] ApplyCheck::ExecRequired { .. } => None, - ApplyCheck::ExecNotRequired => item_apply_partial.state_current.clone(), + ApplyCheck::ExecNotRequired => step_apply_partial.state_current.clone(), } } - Err(error) => return Err((error, item_apply_partial.into())), + Err(error) => return Err((error, step_apply_partial.into())), }; - Ok(ItemApply::try_from((item_apply_partial, state_applied)) + Ok(StepApply::try_from((step_apply_partial, state_applied)) .expect("unreachable: All the fields are set above.") .into()) } @@ -771,27 +771,27 @@ where params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - item_apply_boxed: &mut ItemApplyBoxed, + step_apply_boxed: &mut StepApplyBoxed, ) -> Result<(), E> { - let Some(item_apply) = item_apply_boxed + let Some(step_apply) = step_apply_boxed .as_data_type_mut() - .downcast_mut::>() + .downcast_mut::>() else { panic!( - "Failed to downcast `ItemApplyBoxed` to `{concrete_type}`.\n\ + "Failed to downcast `StepApplyBoxed` to `{concrete_type}`.\n\ This is a bug in the Peace framework.", - concrete_type = std::any::type_name::>() + concrete_type = std::any::type_name::>() ) }; - let ItemApply { + let StepApply { state_current_stored: _, state_current, state_target, state_diff, apply_check, state_applied, - } = item_apply; + } = step_apply; match apply_check { #[cfg(not(feature = "output_progress"))] @@ -835,50 +835,50 @@ where states_current: &StatesCurrent, params_specs: &ParamsSpecs, resources: &Resources, - ) -> Result { - let mut item_apply_partial = ItemApplyPartial::::new(); + ) -> Result { + let mut step_apply_partial = StepApplyPartial::::new(); if let Some(state_current) = states_current.get::(self.id()) { - item_apply_partial.state_current = Some(state_current.clone()); + step_apply_partial.state_current = Some(state_current.clone()); } else { - // Hack: Setting ItemApplyPartial state_current to state_clean is a hack, - // which allows successor items to read the state of a predecessor, when + // Hack: Setting StepApplyPartial state_current to state_clean is a hack, + // which allows successor steps to read the state of a predecessor, when // none can be discovered. // // This may not necessarily be a hack. match self.state_clean(params_specs, resources).await { - Ok(state_clean) => item_apply_partial.state_current = Some(state_clean), - Err(error) => return Err((error, item_apply_partial.into())), + Ok(state_clean) => step_apply_partial.state_current = Some(state_clean), + Err(error) => return Err((error, step_apply_partial.into())), } } match self.state_clean(params_specs, resources).await { - Ok(state_clean) => item_apply_partial.state_target = Some(state_clean), - Err(error) => return Err((error, item_apply_partial.into())), + Ok(state_clean) => step_apply_partial.state_target = Some(state_clean), + Err(error) => return Err((error, step_apply_partial.into())), } match self .state_diff_exec_with( params_specs, resources, - item_apply_partial + step_apply_partial .state_current .as_ref() .expect("unreachable: This is confirmed just above."), - item_apply_partial + step_apply_partial .state_target .as_ref() .expect("unreachable: This is set just above."), ) .await { - Ok(state_diff) => item_apply_partial.state_diff = Some(state_diff), - Err(error) => return Err((error, item_apply_partial.into())), + Ok(state_diff) => step_apply_partial.state_diff = Some(state_diff), + Err(error) => return Err((error, step_apply_partial.into())), } let (Some(state_current), Some(state_clean), Some(state_diff)) = ( - item_apply_partial.state_current.as_ref(), - item_apply_partial.state_target.as_ref(), - item_apply_partial.state_diff.as_ref(), + step_apply_partial.state_current.as_ref(), + step_apply_partial.state_target.as_ref(), + step_apply_partial.state_diff.as_ref(), ) else { unreachable!("These are set just above."); }; @@ -897,7 +897,7 @@ where let state_applied = match apply_check { Ok(apply_check) => { - item_apply_partial.apply_check = Some(apply_check); + step_apply_partial.apply_check = Some(apply_check); // TODO: write test for this case match apply_check { @@ -905,13 +905,13 @@ where ApplyCheck::ExecRequired => None, #[cfg(feature = "output_progress")] ApplyCheck::ExecRequired { .. } => None, - ApplyCheck::ExecNotRequired => item_apply_partial.state_current.clone(), + ApplyCheck::ExecNotRequired => step_apply_partial.state_current.clone(), } } - Err(error) => return Err((error, item_apply_partial.into())), + Err(error) => return Err((error, step_apply_partial.into())), }; - Ok(ItemApply::try_from((item_apply_partial, state_applied)) + Ok(StepApply::try_from((step_apply_partial, state_applied)) .expect("unreachable: All the fields are set above.") .into()) } @@ -921,27 +921,27 @@ where params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - item_apply_boxed: &mut ItemApplyBoxed, + step_apply_boxed: &mut StepApplyBoxed, ) -> Result<(), E> { - let Some(item_apply) = item_apply_boxed + let Some(step_apply) = step_apply_boxed .as_data_type_mut() - .downcast_mut::>() + .downcast_mut::>() else { panic!( - "Failed to downcast `ItemApplyBoxed` to `{concrete_type}`.\n\ + "Failed to downcast `StepApplyBoxed` to `{concrete_type}`.\n\ This is a bug in the Peace framework.", - concrete_type = std::any::type_name::>() + concrete_type = std::any::type_name::>() ) }; - let ItemApply { + let StepApply { state_current_stored: _, state_current, state_target, state_diff, apply_check, state_applied, - } = item_apply; + } = step_apply; match apply_check { #[cfg(not(feature = "output_progress"))] diff --git a/crate/rt_model_core/src/cmd_progress_tracker.rs b/crate/rt_model_core/src/cmd_progress_tracker.rs index 09f78e6f6..b416ce3cd 100644 --- a/crate/rt_model_core/src/cmd_progress_tracker.rs +++ b/crate/rt_model_core/src/cmd_progress_tracker.rs @@ -1,8 +1,8 @@ use indexmap::IndexMap; use indicatif::MultiProgress; -use peace_core::{progress::ProgressTracker, ItemId}; +use peace_core::{progress::ProgressTracker, StepId}; -/// Tracks command execution progress for all items. +/// Tracks command execution progress for all steps. /// /// The Peace framework initializes the `multi_progress` and `progress_trackers` /// and manages updating the `ProgressBar` values. @@ -17,15 +17,15 @@ use peace_core::{progress::ProgressTracker, ItemId}; pub struct CmdProgressTracker { /// `MultiProgress` that tracks the remaining progress bars. pub multi_progress: MultiProgress, - /// Tracks progress for each item. - pub progress_trackers: IndexMap, + /// Tracks progress for each step. + pub progress_trackers: IndexMap, } impl CmdProgressTracker { /// Returns a new `CmdProgressTracker`. pub fn new( multi_progress: MultiProgress, - progress_trackers: IndexMap, + progress_trackers: IndexMap, ) -> Self { Self { multi_progress, @@ -44,14 +44,14 @@ impl CmdProgressTracker { &mut self.multi_progress } - /// Returns the `ProgressTracker`s for each item. - pub fn progress_trackers(&self) -> &IndexMap { + /// Returns the `ProgressTracker`s for each step. + pub fn progress_trackers(&self) -> &IndexMap { &self.progress_trackers } - /// Returns a mutable reference to the `ProgressTracker`s for each item + /// Returns a mutable reference to the `ProgressTracker`s for each step /// spec. - pub fn progress_trackers_mut(&mut self) -> &mut IndexMap { + pub fn progress_trackers_mut(&mut self) -> &mut IndexMap { &mut self.progress_trackers } } diff --git a/crate/rt_model_core/src/error.rs b/crate/rt_model_core/src/error.rs index e78c7c974..34a2ade44 100644 --- a/crate/rt_model_core/src/error.rs +++ b/crate/rt_model_core/src/error.rs @@ -1,7 +1,7 @@ use std::path::PathBuf; use peace_cmd_model::CmdExecutionError; -use peace_core::{FlowId, ItemId, Profile}; +use peace_core::{FlowId, StepId, Profile}; use peace_params::{ParamsResolveError, ParamsSpecs}; use peace_resources::paths::ParamsSpecsFile; @@ -82,10 +82,10 @@ pub enum Error { ParamsResolveError, ), - /// A `Params::Spec` was not present for a given item ID. + /// A `Params::Spec` was not present for a given step ID. /// /// If this happens, this is a bug in the Peace framework. - #[error("A `Params::Spec` was not present for item: {item_id}")] + #[error("A `Params::Spec` was not present for step: {step_id}")] #[cfg_attr( feature = "error_reporting", diagnostic( @@ -101,17 +101,17 @@ pub enum Error { ) )] ParamsSpecNotFound { - /// Item ID for which the params spec was not found. - item_id: ItemId, + /// Step ID for which the params spec was not found. + step_id: StepId, }, - /// Item params specs do not match with the items in the flow. + /// Step params specs do not match with the steps in the flow. /// /// # Symptoms /// - /// * Provided params specs for a step ID has no corresponding item ID in + /// * Provided params specs for a step ID has no corresponding step ID in /// the flow. - /// * Stored params specs for a step ID has no corresponding item ID in the + /// * Stored params specs for a step ID has no corresponding step ID in the /// flow. /// * ID of a step in the flow does not have a corresponding provided /// params spec. @@ -122,28 +122,28 @@ pub enum Error { /// /// These can happen when: /// - /// * An item is added. + /// * An step is added. /// /// - No corresponding provided params spec. /// - No corresponding stored params spec. /// - /// * An item ID is renamed. + /// * An step ID is renamed. /// /// - Provided params spec ID mismatch. /// - Stored params spec ID mismatch. /// - No corresponding provided params spec. /// - /// * An item is removed. + /// * An step is removed. /// /// - Provided params spec ID mismatch. /// - Stored params spec ID mismatch. - #[error("Item params specs do not match with the items in the flow.")] + #[error("Step params specs do not match with the steps in the flow.")] #[cfg_attr( feature = "error_reporting", diagnostic( code(peace_rt_model::params_specs_mismatch), help("{}", params_specs_mismatch_display( - item_ids_with_no_params_specs, + step_ids_with_no_params_specs, params_specs_provided_mismatches, params_specs_stored_mismatches.as_ref(), params_specs_not_usable, @@ -151,16 +151,16 @@ pub enum Error { ) )] ParamsSpecsMismatch { - /// Item IDs for which there are no provided or stored params spec. - item_ids_with_no_params_specs: Vec, - /// Provided params specs with no matching item ID in the flow. + /// Step IDs for which there are no provided or stored params spec. + step_ids_with_no_params_specs: Vec, + /// Provided params specs with no matching step ID in the flow. params_specs_provided_mismatches: ParamsSpecs, - /// Stored params specs with no matching item ID in the flow. + /// Stored params specs with no matching step ID in the flow. params_specs_stored_mismatches: Option, - /// Item IDs which had a mapping function previously provided in + /// Step IDs which had a mapping function previously provided in /// its params spec, but on a subsequent invocation nothing was /// provided. - params_specs_not_usable: Vec, + params_specs_not_usable: Vec, }, /// In a `MultiProfileSingleFlow` diff, neither profile had `Params::Specs` @@ -171,8 +171,8 @@ pub enum Error { diagnostic( code(peace_rt_model::params_specs_not_defined_for_diff), help( - "Make sure at least one of the flows has `.with_items_params(..)`\n\ - defined for every item in the flow." + "Make sure at least one of the flows has `.with_steps_params(..)`\n\ + defined for every step in the flow." ) ) )] @@ -213,10 +213,10 @@ pub enum Error { diagnostic( code(peace_rt_model::states_deserialize), help( - "Make sure that all commands using the `{flow_id}` flow, also use the same item graph.\n\ - This is because all Items are used to deserialize state.\n\ + "Make sure that all commands using the `{flow_id}` flow, also use the same step graph.\n\ + This is because all Steps are used to deserialize state.\n\ \n\ - If the item graph is different, it may make sense to use a different flow ID." + If the step graph is different, it may make sense to use a different flow ID." ) ) )] @@ -258,10 +258,10 @@ pub enum Error { diagnostic( code(peace_rt_model::params_specs_deserialize), help( - "Make sure that all commands using the `{flow_id}` flow, also use the same item graph.\n\ - This is because all Items are used to deserialize state.\n\ + "Make sure that all commands using the `{flow_id}` flow, also use the same step graph.\n\ + This is because all Steps are used to deserialize state.\n\ \n\ - If the item graph is different, it may make sense to use a different flow ID." + If the step graph is different, it may make sense to use a different flow ID." ) ) )] @@ -491,13 +491,13 @@ pub enum Error { )] FlowParamsDeserialize(#[source] serde_yaml::Error), - /// Item does not exist in storage. - #[error("Item does not exist in storage: `{}`.", path.display())] + /// Step does not exist in storage. + #[error("Step does not exist in storage: `{}`.", path.display())] #[cfg_attr( feature = "error_reporting", - diagnostic(code(peace_rt_model::item_not_exists)) + diagnostic(code(peace_rt_model::step_not_exists)) )] - ItemNotExists { + StepNotExists { /// Path to the file. path: PathBuf, }, @@ -534,21 +534,21 @@ pub enum Error { #[cfg(feature = "error_reporting")] fn params_specs_mismatch_display( - item_ids_with_no_params: &[ItemId], + step_ids_with_no_params: &[StepId], params_specs_provided_mismatches: &ParamsSpecs, params_specs_stored_mismatches: Option<&ParamsSpecs>, - params_specs_not_usable: &[ItemId], + params_specs_not_usable: &[StepId], ) -> String { - let mut items = Vec::::new(); + let mut steps = Vec::::new(); - if !item_ids_with_no_params.is_empty() { - items.push(format!( - "The following items do not have parameters provided:\n\ + if !step_ids_with_no_params.is_empty() { + steps.push(format!( + "The following steps do not have parameters provided:\n\ \n\ {}\n", - item_ids_with_no_params + step_ids_with_no_params .iter() - .map(|item_id| format!("* {item_id}")) + .map(|step_id| format!("* {step_id}")) .collect::>() .join("\n") )); @@ -557,11 +557,11 @@ fn params_specs_mismatch_display( if !params_specs_provided_mismatches.is_empty() { let params_specs_provided_mismatches_list = params_specs_provided_mismatches .keys() - .map(|item_id| format!("* {item_id}")) + .map(|step_id| format!("* {step_id}")) .collect::>() .join("\n"); - items.push(format!( - "The following provided params specs do not correspond to any items in the flow:\n\ + steps.push(format!( + "The following provided params specs do not correspond to any steps in the flow:\n\ \n\ {params_specs_provided_mismatches_list}\n", )) @@ -571,11 +571,11 @@ fn params_specs_mismatch_display( if !params_specs_stored_mismatches.is_empty() { let params_specs_stored_mismatches_list = params_specs_stored_mismatches .keys() - .map(|item_id| format!("* {item_id}")) + .map(|step_id| format!("* {step_id}")) .collect::>() .join("\n"); - items.push(format!( - "The following stored params specs do not correspond to any items in the flow:\n\ + steps.push(format!( + "The following stored params specs do not correspond to any steps in the flow:\n\ \n\ {params_specs_stored_mismatches_list}\n", )); @@ -583,8 +583,8 @@ fn params_specs_mismatch_display( } if !params_specs_not_usable.is_empty() { - items.push(format!( - "The following items either have not had a params spec provided previously,\n\ + steps.push(format!( + "The following steps either have not had a params spec provided previously,\n\ or had contained a mapping function, which cannot be loaded from disk.\n\ \n\ So the params spec needs to be provided to the command context for:\n\ @@ -592,11 +592,11 @@ fn params_specs_mismatch_display( {}\n", params_specs_not_usable .iter() - .map(|item_id| format!("* {item_id}")) + .map(|step_id| format!("* {step_id}")) .collect::>() .join("\n") )); } - items.join("\n") + steps.join("\n") } diff --git a/crate/rt_model_core/src/error/apply_cmd_error.rs b/crate/rt_model_core/src/error/apply_cmd_error.rs index a041451ef..62489bcb4 100644 --- a/crate/rt_model_core/src/error/apply_cmd_error.rs +++ b/crate/rt_model_core/src/error/apply_cmd_error.rs @@ -1,15 +1,15 @@ use std::{fmt, fmt::Write}; -use crate::{ItemsStateStoredStale, StateStoredAndDiscovered}; +use crate::{StepsStateStoredStale, StateStoredAndDiscovered}; -/// Error applying changes to items. +/// Error applying changes to steps. #[cfg_attr(feature = "error_reporting", derive(miette::Diagnostic))] #[derive(Debug, thiserror::Error)] pub enum ApplyCmdError { /// Stored current states were not up to date with actual current states. #[error( "Stored current states were not up to date with actual current states.\n\n{stale_states}", - stale_states = stale_states_fmt(items_state_stored_stale)?, + stale_states = stale_states_fmt(steps_state_stored_stale)?, )] #[cfg_attr( feature = "error_reporting", @@ -24,15 +24,15 @@ pub enum ApplyCmdError { ) )] StatesCurrentOutOfSync { - /// Items whose stored current state is out of sync with the discovered + /// Steps whose stored current state is out of sync with the discovered /// state. - items_state_stored_stale: ItemsStateStoredStale, + steps_state_stored_stale: StepsStateStoredStale, }, /// Stored goal states were not up to date with actual goal states. #[error( "Stored goal states were not up to date with actual goal states.\n\n{stale_states}", - stale_states = stale_states_fmt(items_state_stored_stale)?, + stale_states = stale_states_fmt(steps_state_stored_stale)?, )] #[cfg_attr( feature = "error_reporting", @@ -47,20 +47,20 @@ pub enum ApplyCmdError { ) )] StatesGoalOutOfSync { - /// Items whose stored goal state is out of sync with the discovered + /// Steps whose stored goal state is out of sync with the discovered /// state. - items_state_stored_stale: ItemsStateStoredStale, + steps_state_stored_stale: StepsStateStoredStale, }, } fn stale_states_fmt( - items_state_stored_stale: &ItemsStateStoredStale, + steps_state_stored_stale: &StepsStateStoredStale, ) -> Result { - let mut buffer = String::with_capacity(items_state_stored_stale.len() * 256); - items_state_stored_stale + let mut buffer = String::with_capacity(steps_state_stored_stale.len() * 256); + steps_state_stored_stale .iter() - .try_for_each(|(item_id, state_stored_and_discovered)| { - writeln!(&mut buffer, "* {item_id}:\n")?; + .try_for_each(|(step_id, state_stored_and_discovered)| { + writeln!(&mut buffer, "* {step_id}:\n")?; match state_stored_and_discovered { StateStoredAndDiscovered::OnlyStoredExists { state_stored } => { diff --git a/crate/rt_model_core/src/error/state_downcast_error.rs b/crate/rt_model_core/src/error/state_downcast_error.rs index fa859e7ab..6b9ad2be4 100644 --- a/crate/rt_model_core/src/error/state_downcast_error.rs +++ b/crate/rt_model_core/src/error/state_downcast_error.rs @@ -4,9 +4,9 @@ use type_reg::untagged::{BoxDtDisplay, DataType}; #[cfg_attr(feature = "error_reporting", derive(miette::Diagnostic))] #[derive(Debug, thiserror::Error)] pub enum StateDowncastError { - /// Both item states could not be downcasted. + /// Both step states could not be downcasted. #[error( - "Item states could not be downcasted to `{ty_name}`.\n\ + "Step states could not be downcasted to `{ty_name}`.\n\ Boxed type are:\n\ \n\ * `{boxed_ty_a:?}`.\n\ @@ -23,14 +23,14 @@ pub enum StateDowncastError { help( "\ This error happens when the boxed states could not be downcasted to - this item's state, which indicates one of the following:\n\ + this step's state, which indicates one of the following:\n\ \n\ - * Peace contains a bug, and passed an incorrect box to this item.\n\ - * Item IDs were swapped, such that `ItemA`'s state is passed to `ItemB`.\n\ + * Peace contains a bug, and passed an incorrect box to this step.\n\ + * Step IDs were swapped, such that `StepA`'s state is passed to `StepB`.\n\ \n\ - This needs some rework on how item IDs are implemented -- as in, - whether we should use a string newtype for `ItemId`s, or redesign - how `Item`s or related types are keyed.\n\ + This needs some rework on how step IDs are implemented -- as in, + whether we should use a string newtype for `StepId`s, or redesign + how `Step`s or related types are keyed.\n\ " ), ) @@ -43,9 +43,9 @@ pub enum StateDowncastError { /// Second state parameter. state_b: BoxDtDisplay, }, - /// First item state could not be downcasted. + /// First step state could not be downcasted. #[error( - "First item state could not be downcasted to `{ty_name}`.\n\ + "First step state could not be downcasted to `{ty_name}`.\n\ Boxed type is `{boxed_ty:?}`.", ty_name = ty_name, boxed_ty = state_a.type_name(), @@ -57,14 +57,14 @@ pub enum StateDowncastError { help( "\ This error happens when the boxed states could not be downcasted to - this item's state, which indicates one of the following:\n\ + this step's state, which indicates one of the following:\n\ \n\ - * Peace contains a bug, and passed an incorrect box to this item.\n\ - * Item IDs were swapped, such that `ItemA`'s state is passed to `ItemB`.\n\ + * Peace contains a bug, and passed an incorrect box to this step.\n\ + * Step IDs were swapped, such that `StepA`'s state is passed to `StepB`.\n\ \n\ - This needs some rework on how item IDs are implemented -- as in, - whether we should use a string newtype for `ItemId`s, or redesign - how `Item`s or related types are keyed.\n\ + This needs some rework on how step IDs are implemented -- as in, + whether we should use a string newtype for `StepId`s, or redesign + how `Step`s or related types are keyed.\n\ " ), ) @@ -75,9 +75,9 @@ pub enum StateDowncastError { /// First state parameter. state_a: BoxDtDisplay, }, - /// Second item state could not be downcasted. + /// Second step state could not be downcasted. #[error( - "Second item state could not be downcasted to `{ty_name}`.\n\ + "Second step state could not be downcasted to `{ty_name}`.\n\ Boxed type is `{boxed_ty:?}`.", ty_name = ty_name, boxed_ty = state_b.type_name(), @@ -89,14 +89,14 @@ pub enum StateDowncastError { help( "\ This error happens when the boxed states could not be downcasted to - this item's state, which indicates one of the following:\n\ + this step's state, which indicates one of the following:\n\ \n\ - * Peace contains a bug, and passed an incorrect box to this item.\n\ - * Item IDs were swapped, such that `ItemA`'s state is passed to `ItemB`.\n\ + * Peace contains a bug, and passed an incorrect box to this step.\n\ + * Step IDs were swapped, such that `StepA`'s state is passed to `StepB`.\n\ \n\ - This needs some rework on how item IDs are implemented -- as in, - whether we should use a string newtype for `ItemId`s, or redesign - how `Item`s or related types are keyed.\n\ + This needs some rework on how step IDs are implemented -- as in, + whether we should use a string newtype for `StepId`s, or redesign + how `Step`s or related types are keyed.\n\ " ), ) From f422024969fcba475f058038c6dfef9daca022b6 Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Sun, 2 Jun 2024 13:49:30 +1200 Subject: [PATCH 5/9] Revert "Add first half of renaming `item` to `step`." This reverts commit ff414592d5e98386553fc36868de877b16844eae. --- Cargo.toml | 16 +- README.md | 12 +- crate/cfg/src/accessors/stored.rs | 12 +- crate/cfg/src/fn_ctx.rs | 14 +- crate/cfg/src/lib.rs | 4 +- crate/cfg/src/state.rs | 12 +- crate/cfg/src/state/external.rs | 2 +- crate/cfg/src/state/external_opt.rs | 2 +- crate/cfg/src/step.rs | 128 ++++---- crate/cli/src/output/cli_md_presenter.rs | 2 +- crate/cli/src/output/cli_output.rs | 50 ++-- crate/cli/src/output/cli_output_builder.rs | 2 +- crate/cmd/src/ctx/cmd_ctx_builder.rs | 94 +++--- crate/cmd/src/scopes/multi_profile_no_flow.rs | 4 +- .../src/scopes/multi_profile_single_flow.rs | 26 +- .../cmd/src/scopes/single_profile_no_flow.rs | 4 +- .../src/scopes/single_profile_single_flow.rs | 26 +- crate/cmd_model/src/cmd_block_outcome.rs | 26 +- crate/cmd_model/src/cmd_outcome.rs | 88 +++--- crate/cmd_model/src/lib.rs | 4 +- crate/cmd_model/src/step_stream_outcome.rs | 78 ++--- .../src/stream_outcome_and_errors.rs | 6 +- .../cmd_model/src/value_and_stream_outcome.rs | 2 +- crate/cmd_rt/src/cmd_block.rs | 22 +- crate/cmd_rt/src/cmd_block/cmd_block_error.rs | 14 +- .../cmd_rt/src/cmd_block/cmd_block_wrapper.rs | 12 +- crate/cmd_rt/src/cmd_execution.rs | 14 +- .../cmd_execution/cmd_execution_builder.rs | 4 +- crate/cmd_rt/src/lib.rs | 4 +- crate/cmd_rt/src/progress.rs | 30 +- .../cmd_rt/src/step_stream_outcome_mapper.rs | 24 +- crate/code_gen/src/cmd/impl_build.rs | 68 ++--- crate/code_gen/src/cmd/impl_common_fns.rs | 10 +- crate/code_gen/src/cmd/scope.rs | 4 +- crate/code_gen/src/cmd/struct_definition.rs | 4 +- crate/core/src/apply_check.rs | 6 +- crate/core/src/lib.rs | 10 +- .../core/src/progress/cmd_progress_update.rs | 6 +- crate/core/src/progress/progress_complete.rs | 2 +- crate/core/src/progress/progress_delta.rs | 2 +- crate/core/src/progress/progress_sender.rs | 18 +- crate/core/src/progress/progress_status.rs | 14 +- crate/core/src/progress/progress_tracker.rs | 2 +- .../src/progress/progress_update_and_id.rs | 8 +- crate/core/src/step_id.rs | 18 +- crate/data/src/accessors.rs | 2 +- crate/data/src/accessors/r_maybe.rs | 4 +- crate/data/src/accessors/w_maybe.rs | 4 +- crate/data/src/data.rs | 18 +- crate/data/src/marker.rs | 6 +- crate/data/src/marker/apply_dry.rs | 2 +- crate/data/src/marker/clean.rs | 2 +- crate/data/src/marker/current.rs | 2 +- crate/data/src/marker/goal.rs | 2 +- crate/data_derive/src/lib.rs | 6 +- crate/flow_model/src/flow_info.rs | 8 +- crate/flow_model/src/flow_spec_info.rs | 90 +++--- crate/flow_model/src/lib.rs | 8 +- crate/flow_model/src/step_info.rs | 18 +- crate/flow_model/src/step_spec_info.rs | 18 +- crate/fmt/src/lib.rs | 4 +- crate/fmt/src/presentable.rs | 6 +- crate/fmt/src/presenter.rs | 8 +- crate/params/src/any_spec_rt.rs | 4 +- crate/params/src/field_wise_spec_rt.rs | 6 +- crate/params/src/lib.rs | 16 +- crate/params/src/mapping_fn_impl.rs | 8 +- crate/params/src/params_spec.rs | 4 +- crate/params/src/params_spec_fieldless.rs | 4 +- crate/params/src/params_specs.rs | 22 +- crate/params/src/value_resolution_ctx.rs | 16 +- crate/params/src/value_spec.rs | 4 +- crate/params/src/value_spec_rt.rs | 2 +- .../src/impl_field_wise_builder.rs | 2 +- .../impl_from_params_for_params_partial.rs | 2 +- ...impl_try_from_params_partial_for_params.rs | 2 +- crate/params_derive/src/lib.rs | 10 +- crate/params_derive/src/util.rs | 4 +- .../resources/src/internal/state_diffs_mut.rs | 22 +- crate/resources/src/internal/states_mut.rs | 26 +- crate/resources/src/lib.rs | 4 +- crate/resources/src/paths.rs | 2 +- .../resources/src/paths/params_specs_file.rs | 2 +- .../src/paths/states_current_file.rs | 2 +- crate/resources/src/paths/states_goal_file.rs | 2 +- crate/resources/src/resources.rs | 4 +- crate/resources/src/resources/ts.rs | 2 +- crate/resources/src/states.rs | 84 +++--- crate/resources/src/states/state_diffs.rs | 18 +- crate/resources/src/states/states_clean.rs | 4 +- crate/resources/src/states/states_cleaned.rs | 2 +- .../src/states/states_cleaned_dry.rs | 2 +- crate/resources/src/states/states_current.rs | 6 +- .../src/states/states_current_stored.rs | 6 +- crate/resources/src/states/states_ensured.rs | 2 +- .../src/states/states_ensured_dry.rs | 2 +- crate/resources/src/states/states_goal.rs | 8 +- .../src/states/states_goal_stored.rs | 4 +- crate/resources/src/states/states_previous.rs | 2 +- crate/resources/src/states/states_serde.rs | 36 +-- crate/resources/src/states/ts.rs | 20 +- crate/resources/src/step_rt_id.rs | 18 +- crate/rt/src/cmd_blocks.rs | 4 +- .../rt/src/cmd_blocks/apply_exec_cmd_block.rs | 186 ++++++------ .../apply_state_sync_check_cmd_block.rs | 98 +++--- crate/rt/src/cmd_blocks/diff_cmd_block.rs | 20 +- .../states_clean_insertion_cmd_block.rs | 16 +- .../states_current_read_cmd_block.rs | 4 +- .../cmd_blocks/states_discover_cmd_block.rs | 188 ++++++------ .../cmd_blocks/states_goal_read_cmd_block.rs | 4 +- crate/rt/src/cmds/clean_cmd.rs | 88 +++--- crate/rt/src/cmds/diff_cmd.rs | 24 +- crate/rt/src/cmds/ensure_cmd.rs | 82 ++--- crate/rt/src/cmds/states_discover_cmd.rs | 66 ++-- crate/rt/src/lib.rs | 2 +- crate/rt_model/src/flow.rs | 32 +- crate/rt_model/src/lib.rs | 16 +- crate/rt_model/src/outcomes.rs | 18 +- crate/rt_model/src/outcomes/step_apply.rs | 22 +- .../rt_model/src/outcomes/step_apply_boxed.rs | 16 +- .../src/outcomes/step_apply_partial.rs | 34 +-- .../src/outcomes/step_apply_partial_boxed.rs | 18 +- .../src/outcomes/step_apply_partial_rt.rs | 10 +- crate/rt_model/src/outcomes/step_apply_rt.rs | 10 +- crate/rt_model/src/params_specs_serializer.rs | 16 +- crate/rt_model/src/params_specs_type_reg.rs | 10 +- crate/rt_model/src/states_serializer.rs | 52 ++-- crate/rt_model/src/states_type_reg.rs | 14 +- crate/rt_model/src/step_boxed.rs | 50 ++-- crate/rt_model/src/step_graph.rs | 42 +-- crate/rt_model/src/step_graph_builder.rs | 30 +- crate/rt_model/src/step_rt.rs | 112 +++---- crate/rt_model/src/step_wrapper.rs | 282 +++++++++--------- .../rt_model_core/src/cmd_progress_tracker.rs | 18 +- crate/rt_model_core/src/error.rs | 98 +++--- .../src/error/apply_cmd_error.rs | 26 +- .../src/error/state_downcast_error.rs | 48 +-- 137 files changed, 1630 insertions(+), 1630 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f50243e53..cfbde3e77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,7 +83,7 @@ ssr = [ [workspace] members = [ "crate/*", - "steps", + "items", "workspace_tests", "examples/*", ] @@ -132,15 +132,15 @@ peace_webi_components = { path = "crate/webi_components", version = "0.0.13" } peace_webi_model = { path = "crate/webi_model", version = "0.0.13" } peace_webi_output = { path = "crate/webi_output", version = "0.0.13" } -# Step crates -peace_steps = { path = "steps", version = "0.0.13" } +# Item crates +peace_items = { path = "items", version = "0.0.13" } -peace_step_blank = { path = "steps/blank", version = "0.0.13" } -peace_step_file_download = { path = "steps/file_download", version = "0.0.13" } -peace_step_sh_cmd = { path = "steps/sh_cmd", version = "0.0.13" } -peace_step_tar_x = { path = "steps/tar_x", version = "0.0.13" } +peace_item_blank = { path = "items/blank", version = "0.0.13" } +peace_item_file_download = { path = "items/file_download", version = "0.0.13" } +peace_item_sh_cmd = { path = "items/sh_cmd", version = "0.0.13" } +peace_item_tar_x = { path = "items/tar_x", version = "0.0.13" } -# Dependencies used by framework and step crates. +# Dependencies used by framework and item crates. # # This does not include examples' dependencies, because we want it to be easy for # developers to see the dependencies to create an automation tool. diff --git a/README.md b/README.md index 5a2e5c831..6cfdbec60 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ See: | 🟣 | Works, "fun idea" | * 🟢 **Idempotent:** Multiple invocations result in the goal outcome. -* 🟢 **Clean:** Every step defines how to create a resource and how to clean it up. +* 🟢 **Clean:** Every item creation is paired with how it is cleaned up. * 🟢 **Understandable:** Progress is shown at an understandable level of detail. * 🔵 **Understandable:** Error reporting is compatible with [`miette`]. * 🟡 **Interruptible:** Execution can be interrupted. @@ -40,7 +40,7 @@ See: * 🟢 **Diffable:** States and diffs are serialized as YAML. * 🟢 **Efficient:** Tasks are concurrently executed via [`fn_graph`]. * 🟢 **Namespaced:** Profile directories isolate environments from each other. -* 🟢 **Type Safe:** Steps and parameters are defined in code, not configuration. +* 🟢 **Type Safe:** Items and parameters are defined in code, not configuration. [`fn_graph`]: https://github.com/azriel91/fn_graph [`miette`]: https://github.com/zkat/miette @@ -48,17 +48,17 @@ See: ### Roadmap -* 🟢 Define steps to manage with automation. -* 🟢 Define dependencies between steps. +* 🟢 Define items to manage with automation. +* 🟢 Define dependencies between items. * 🟢 Define "apply" logic. * 🟢 Define "clean up" logic. * 🟢 Discover current and goal states. * 🟢 Define diff calculation between states. * 🟢 Store and recall parameters across commands. * 🟢 Diff states between multiple profiles. -* 🟢 Type-safe referential parameters -- specify usage of values generated during automation as parameters to subsequent steps. +* 🟢 Type-safe referential parameters -- specify usage of values generated during automation as parameters to subsequent items. * 🟡 Feature-gated incremental functionality. -* 🟡 Off-the-shelf support for common steps. +* 🟡 Off-the-shelf support for common items. * 🟡 Dry run. * 🟣 WASM support. * âš« Cancel-safe interruption via [`tokio-graceful-shutdown`]. diff --git a/crate/cfg/src/accessors/stored.rs b/crate/cfg/src/accessors/stored.rs index 236e868b8..bd06692b0 100644 --- a/crate/cfg/src/accessors/stored.rs +++ b/crate/cfg/src/accessors/stored.rs @@ -4,7 +4,7 @@ use std::{ marker::PhantomData, }; -use peace_core::StepId; +use peace_core::ItemId; use peace_data::{ fn_graph::{ resman::{BorrowFail, Ref}, @@ -18,8 +18,8 @@ use serde::Serialize; /// The previously stored `T` state, if any. #[derive(Debug)] pub struct Stored<'borrow, T> { - /// ID of the step the state should be retrieved for. - step_id: &'borrow StepId, + /// ID of the item the state should be retrieved for. + item_id: &'borrow ItemId, /// The borrowed `StatesCurrentStored`. states_current_stored: Option>, /// Marker. @@ -33,7 +33,7 @@ where pub fn get(&'borrow self) -> Option<&'borrow T> { self.states_current_stored .as_ref() - .and_then(|states_current_stored| states_current_stored.get(self.step_id)) + .and_then(|states_current_stored| states_current_stored.get(self.item_id)) } } @@ -41,7 +41,7 @@ impl<'borrow, T> Data<'borrow> for Stored<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { + fn borrow(item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { let states_current_stored = resources .try_borrow::() .map_err(|borrow_fail| match borrow_fail { @@ -53,7 +53,7 @@ where .ok(); Self { - step_id, + item_id, states_current_stored, marker: PhantomData, } diff --git a/crate/cfg/src/fn_ctx.rs b/crate/cfg/src/fn_ctx.rs index f5b8f320d..bfc1f958a 100644 --- a/crate/cfg/src/fn_ctx.rs +++ b/crate/cfg/src/fn_ctx.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use peace_core::StepId; +use peace_core::ItemId; #[cfg(feature = "output_progress")] use peace_core::progress::ProgressSender; @@ -8,9 +8,9 @@ use peace_core::progress::ProgressSender; /// References to pass information between the Peace framework and a step. #[derive(Clone, Copy, Debug)] pub struct FnCtx<'exec> { - /// ID of the step this belongs to. - pub step_id: &'exec StepId, - /// For steps to submit progress updates. + /// ID of the item this belongs to. + pub item_id: &'exec ItemId, + /// For items to submit progress updates. #[cfg(feature = "output_progress")] pub progress_sender: ProgressSender<'exec>, /// Marker. @@ -20,18 +20,18 @@ pub struct FnCtx<'exec> { impl<'exec> FnCtx<'exec> { /// Returns a new `OpCtx`. pub fn new( - step_id: &'exec StepId, + item_id: &'exec ItemId, #[cfg(feature = "output_progress")] progress_sender: ProgressSender<'exec>, ) -> Self { Self { - step_id, + item_id, #[cfg(feature = "output_progress")] progress_sender, marker: PhantomData, } } - /// Returns the `ProgressTracker` for steps to send progress to. + /// Returns the `ProgressTracker` for items to send progress to. #[cfg(feature = "output_progress")] pub fn progress_sender(&self) -> &ProgressSender<'exec> { &self.progress_sender diff --git a/crate/cfg/src/lib.rs b/crate/cfg/src/lib.rs index 8152cf029..2a0e79555 100644 --- a/crate/cfg/src/lib.rs +++ b/crate/cfg/src/lib.rs @@ -10,10 +10,10 @@ pub use peace_core::progress; pub use peace_core::*; -pub use crate::{fn_ctx::FnCtx, step::Step, state::State}; +pub use crate::{fn_ctx::FnCtx, item::Item, state::State}; pub mod accessors; pub mod state; mod fn_ctx; -mod step; +mod item; diff --git a/crate/cfg/src/state.rs b/crate/cfg/src/state.rs index 3f3e4a202..c45975847 100644 --- a/crate/cfg/src/state.rs +++ b/crate/cfg/src/state.rs @@ -12,9 +12,9 @@ use std::{any::TypeId, fmt}; use serde::{Deserialize, Serialize}; -/// Logical and physical states of a resource managed by a step. +/// Logical and physical states of a managed item. /// -/// This type can be used when the resource has both logical and physical +/// This type can be used when the managed item has both logical and physical /// states. Otherwise, a type that represents the fully logical / fully physical /// state is sufficient. /// @@ -64,9 +64,9 @@ use serde::{Deserialize, Serialize}; /// /// ### Fully Logical /// -/// If a resource's state can be fully described before the resource exists, and -/// can be made to happen without interacting with an external service, then the -/// state is fully logical. +/// If a step's state can be fully described before the item exists, and can be +/// made to happen without interacting with an external service, then the state +/// is fully logical. /// /// For example, copying a file from one directory to another. The state of the /// file in the source directory and destination directories are fully @@ -76,7 +76,7 @@ use serde::{Deserialize, Serialize}; /// /// ### Logical and Physical /// -/// If a step's goal state can be described before the resource exists, but +/// If a step's goal state can be described before the item exists, but /// interacts with an external service which produces additional information to /// bring that goal state into existence, then the state has both logical and /// physical parts. diff --git a/crate/cfg/src/state/external.rs b/crate/cfg/src/state/external.rs index a36af7353..deba3e6ef 100644 --- a/crate/cfg/src/state/external.rs +++ b/crate/cfg/src/state/external.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; /// value is a bug and must be surfaced as an issue to the user. /// /// The following type aliases are available to semantically name the type in -/// step implementations: +/// item implementations: /// /// * [`Generated`] /// * [`Fetched`] diff --git a/crate/cfg/src/state/external_opt.rs b/crate/cfg/src/state/external_opt.rs index 0d0a05b21..398badc1d 100644 --- a/crate/cfg/src/state/external_opt.rs +++ b/crate/cfg/src/state/external_opt.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; /// the external source has been queried, but it did not return a value. /// /// The following type aliases are available to semantically name the type in -/// step implementations: +/// item implementations: /// /// * [`GeneratedOpt`] /// * [`FetchedOpt`] diff --git a/crate/cfg/src/step.rs b/crate/cfg/src/step.rs index 9ed10f917..d4d6f03ef 100644 --- a/crate/cfg/src/step.rs +++ b/crate/cfg/src/step.rs @@ -2,7 +2,7 @@ use std::fmt::{Debug, Display}; use async_trait::async_trait; use dyn_clone::DynClone; -use peace_core::{ApplyCheck, StepId}; +use peace_core::{ApplyCheck, ItemId}; use peace_data::Data; use peace_params::{Params, ParamsSpec}; use peace_resources::{resources::ts::Empty, Resources}; @@ -12,7 +12,7 @@ use crate::FnCtx; /// Defines all of the data and logic to manage a step. /// -/// The step may be simple or complex, ranging from: +/// The item may be simple or complex, ranging from: /// /// * File download. /// * Application installation. @@ -55,17 +55,17 @@ use crate::FnCtx; /// /// [`Data`]: crate::CleanOpSpec::Data #[async_trait(?Send)] -pub trait Step: DynClone { +pub trait Item: DynClone { /// Consumer provided error type. type Error: std::error::Error + Send + Sync; - /// Summary of the managed resource's state. + /// Summary of the managed item's state. /// /// **For an extensive explanation of state, and how to define it, please /// see the [state concept] as well as the [`State`] type.** /// - /// This type is used to represent the current state of the step (if it - /// exists), the goal state of the step (what is intended to exist), and + /// This type is used to represent the current state of the item (if it + /// exists), the goal state of the item (what is intended to exist), and /// is used in the *diff* calculation -- what is the difference between the /// current and goal states. /// @@ -102,18 +102,18 @@ pub trait Step: DynClone { /// [`State`]: Self::State type StateDiff: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static; - /// Parameters to use this step. + /// Parameters to use this item. /// - /// Step consumers must provide for this step to work. + /// Item consumers must provide for this item to work. /// /// # Examples /// - /// * For a file download step: + /// * For a file download item: /// /// - URL of the file. /// - Credentials. /// - /// * For a server launch step: + /// * For a server launch item: /// /// - Image ID. /// - Server size. @@ -131,10 +131,10 @@ pub trait Step: DynClone { + Sync + 'static; - /// Data that the step accesses at runtime. + /// Data that the item accesses at runtime. /// /// These may be objects instantiated in `setup` for use during execution, - /// or information calculated from previous steps. + /// or information calculated from previous items. type Data<'exec>: Data<'exec>; /// Returns the ID of this full spec. @@ -142,16 +142,16 @@ pub trait Step: DynClone { /// # Implementors /// /// The ID should be a unique value that does not change over the lifetime - /// of the managed resource. + /// of the managed item. /// - /// [`StepId`]s must begin with a letter or underscore, and contain only - /// letters, numbers, and underscores. The [`step_id!`] macro provides + /// [`ItemId`]s must begin with a letter or underscore, and contain only + /// letters, numbers, and underscores. The [`item_id!`] macro provides /// a compile time check to ensure that these conditions are upheld. /// /// ```rust - /// # use peace_cfg::{step_id, StepId}; - /// const fn id() -> StepId { - /// step_id!("my_step") + /// # use peace_cfg::{item_id, ItemId}; + /// const fn id() -> ItemId { + /// item_id!("my_item") /// } /// # fn main() { let _id = id(); } /// ``` @@ -161,24 +161,24 @@ pub trait Step: DynClone { /// This is an instance method as logic for a `Step` may be used for /// multiple tasks. For example, a `Step` implemented to download a /// file may be instantiated with different files to download, and each - /// instance of the `Step` should have its own ID. + /// instance of the `Item` should have its own ID. /// - /// [`step_id!`]: peace_static_check_macros::step_id - fn id(&self) -> &StepId; + /// [`item_id!`]: peace_static_check_macros::item_id + fn id(&self) -> &ItemId; /// Inserts an instance of each data type in [`Resources`]. /// /// # Implementors /// /// [`Resources`] is the map of any type, and an instance of each data type - /// must be inserted into the map so that [`Step`] functions can borrow the + /// must be inserted into the map so that item functions can borrow the /// instance of that type. /// /// [`check`]: crate::ApplyFns::check /// [`apply`]: crate::ApplyFns::apply async fn setup(&self, resources: &mut Resources) -> Result<(), Self::Error>; - /// Returns the current state of the managed resource, if possible. + /// Returns the current state of the managed item, if possible. /// /// This should return `Ok(None)` if the state is not able to be queried, /// such as when failing to connect to a remote host, instead of returning @@ -189,7 +189,7 @@ pub trait Step: DynClone { data: Self::Data<'_>, ) -> Result, Self::Error>; - /// Returns the current state of the managed resource. + /// Returns the current state of the managed item. /// /// This is *expected* to successfully discover the current state, so errors /// will be presented to the user. @@ -199,7 +199,7 @@ pub trait Step: DynClone { data: Self::Data<'_>, ) -> Result; - /// Returns the goal state of the managed resource, if possible. + /// Returns the goal state of the managed item, if possible. /// /// This should return `Ok(None)` if the state is not able to be queried, /// such as when failing to read a potentially non-existent file to @@ -210,17 +210,17 @@ pub trait Step: DynClone { data: Self::Data<'_>, ) -> Result, Self::Error>; - /// Returns the goal state of the managed resource. + /// Returns the goal state of the managed item. /// /// This is *expected* to successfully discover the goal state, so errors /// will be presented to the user. /// /// # Examples /// - /// * For a file download step, the goal state could be the destination path + /// * For a file download item, the goal state could be the destination path /// and a content hash. /// - /// * For a web application service step, the goal state could be the web + /// * For a web application service item, the goal state could be the web /// service is running on the latest version. async fn state_goal( fn_ctx: FnCtx<'_>, @@ -241,10 +241,10 @@ pub trait Step: DynClone { /// /// # Examples /// - /// * For a file download step, the difference could be the content hash + /// * For a file download item, the difference could be the content hash /// changes from `abcd` to `efgh`. /// - /// * For a web application service step, the goal state could be the + /// * For a web application service item, the goal state could be the /// application version changing from 1 to 2. async fn state_diff( params_partial: & as Params>::Partial, @@ -257,10 +257,10 @@ pub trait Step: DynClone { /// /// # Implementors /// - /// This should return essentially the `None` / "work has not been done" - /// variant of the step state. The diff between this and the current - /// state will be shown to the user when they want to see what would be - /// cleaned up by the clean command. + /// This should return essentially the `None` concept of the item + /// state. The diff between this and the current state will be shown to the + /// user when they want to see what would be cleaned up by the clean + /// command. async fn state_clean( params_partial: & as Params>::Partial, data: Self::Data<'_>, @@ -273,10 +273,10 @@ pub trait Step: DynClone { /// /// # Examples /// - /// * For a file download step, if the destination file differs from the + /// * For a file download item, if the destination file differs from the /// file on the server, then the file needs to be downloaded. /// - /// * For a web application service step, if the web service is running, but + /// * For a web application service item, if the web service is running, but /// reports a previous version, then the service may need to be restarted. /// /// # Implementors @@ -286,20 +286,20 @@ pub trait Step: DynClone { /// # Parameters /// /// * `fn_ctx`: Context to send progress updates. - /// * `params`: Parameters to the step. + /// * `params`: Parameters to the item. /// * `data`: Runtime data that the function reads from or writes to. - /// * `state_current`: Current [`State`] of the managed resource, returned - /// from [`state_current`]. - /// * `state_target`: Target [`State`] of the managed resource, either + /// * `state_current`: Current [`State`] of the managed item, returned from + /// [`state_current`]. + /// * `state_target`: Target [`State`] of the managed item, either /// [`state_clean`] or [`state_goal`]. - /// * `state_diff`: Goal [`State`] of the managed resource, returned from + /// * `state_diff`: Goal [`State`] of the managed item, returned from /// [`state_diff`]. /// - /// [`state_clean`]: crate::Step::state_clean - /// [`state_current`]: crate::Step::state_current - /// [`state_goal`]: crate::Step::state_goal + /// [`state_clean`]: crate::Item::state_clean + /// [`state_current`]: crate::Item::state_current + /// [`state_goal`]: crate::Item::state_goal /// [`State`]: Self::State - /// [`state_diff`]: crate::Step::state_diff + /// [`state_diff`]: crate::Item::state_diff async fn apply_check( params: &Self::Params<'_>, data: Self::Data<'_>, @@ -319,7 +319,7 @@ pub trait Step: DynClone { /// /// * Where there would be IDs received from an external system, a /// placeholder ID should still be inserted into the runtime data. This - /// should allow subsequent `Step`s that rely on this one to use those + /// should allow subsequent `Item`s that rely on this one to use those /// placeholders in their logic. /// /// # Implementors @@ -329,22 +329,22 @@ pub trait Step: DynClone { /// # Parameters /// /// * `fn_ctx`: Context to send progress updates. - /// * `params`: Parameters to the step. + /// * `params`: Parameters to the item. /// * `data`: Runtime data that the function reads from or writes to. - /// * `state_current`: Current [`State`] of the managed resource, returned - /// from [`state_current`]. - /// * `state_target`: Target [`State`] of the managed resource, either + /// * `state_current`: Current [`State`] of the managed item, returned from + /// [`state_current`]. + /// * `state_target`: Target [`State`] of the managed item, either /// [`state_clean`] or [`state_goal`]. - /// * `state_diff`: Goal [`State`] of the managed resource, returned from + /// * `state_diff`: Goal [`State`] of the managed item, returned from /// [`state_diff`]. /// /// [`check`]: Self::check /// [`ExecRequired`]: crate::ApplyCheck::ExecRequired - /// [`state_clean`]: crate::Step::state_clean - /// [`state_current`]: crate::Step::state_current - /// [`state_goal`]: crate::Step::state_goal + /// [`state_clean`]: crate::Item::state_clean + /// [`state_current`]: crate::Item::state_current + /// [`state_goal`]: crate::Item::state_goal /// [`State`]: Self::State - /// [`state_diff`]: crate::Step::state_diff + /// [`state_diff`]: crate::Item::state_diff async fn apply_dry( fn_ctx: FnCtx<'_>, params: &Self::Params<'_>, @@ -361,22 +361,22 @@ pub trait Step: DynClone { /// # Parameters /// /// * `fn_ctx`: Context to send progress updates. - /// * `params`: Parameters to the step. + /// * `params`: Parameters to the item. /// * `data`: Runtime data that the function reads from or writes to. - /// * `state_current`: Current [`State`] of the managed resource, returned - /// from [`state_current`]. - /// * `state_target`: Target [`State`] of the managed resource, either + /// * `state_current`: Current [`State`] of the managed item, returned from + /// [`state_current`]. + /// * `state_target`: Target [`State`] of the managed item, either /// [`state_clean`] or [`state_goal`]. - /// * `state_diff`: Goal [`State`] of the managed resource, returned from + /// * `state_diff`: Goal [`State`] of the managed item, returned from /// [`state_diff`]. /// /// [`check`]: Self::check /// [`ExecRequired`]: crate::ApplyCheck::ExecRequired - /// [`state_clean`]: crate::Step::state_clean - /// [`state_current`]: crate::Step::state_current - /// [`state_goal`]: crate::Step::state_goal + /// [`state_clean`]: crate::Item::state_clean + /// [`state_current`]: crate::Item::state_current + /// [`state_goal`]: crate::Item::state_goal /// [`State`]: Self::State - /// [`state_diff`]: crate::Step::state_diff + /// [`state_diff`]: crate::Item::state_diff async fn apply( fn_ctx: FnCtx<'_>, params: &Self::Params<'_>, diff --git a/crate/cli/src/output/cli_md_presenter.rs b/crate/cli/src/output/cli_md_presenter.rs index aed5815c6..5bc10ba78 100644 --- a/crate/cli/src/output/cli_md_presenter.rs +++ b/crate/cli/src/output/cli_md_presenter.rs @@ -122,7 +122,7 @@ where let mut cli_output_in_memory = CliOutput::new_with_writer(&mut buffer); let mut width_buffer_presenter = CliMdPresenter::new(&mut cli_output_in_memory); - // Render the first presentable of all steps, so we can determine the maximum + // Render the first presentable of all items, so we can determine the maximum // width. let (entries, max_width, _width_buffer_presenter, _f) = stream::iter(iterator.map(Result::<_, std::io::Error>::Ok)) diff --git a/crate/cli/src/output/cli_output.rs b/crate/cli/src/output/cli_output.rs index 07672e141..c56d7f1ed 100644 --- a/crate/cli/src/output/cli_output.rs +++ b/crate/cli/src/output/cli_output.rs @@ -74,9 +74,9 @@ pub struct CliOutput { /// This is detected on instantiation. #[cfg(feature = "output_progress")] pub(crate) progress_format: CliProgressFormat, - /// Width of the step ID column for progress bars + /// Width of the item ID column for progress bars #[cfg(feature = "output_progress")] - pub(crate) pb_step_id_width: Option, + pub(crate) pb_item_id_width: Option, /// The TTY guard that restores the terminal mode when `CliOutput` is /// dropped. /// @@ -103,7 +103,7 @@ where debug_struct .field("progress_target", &self.progress_target) .field("progress_format", &self.progress_format) - .field("pb_step_id_width", &self.pb_step_id_width); + .field("pb_item_id_width", &self.pb_item_id_width); } debug_struct.field( @@ -198,10 +198,10 @@ where self.progress_format } - /// Returns the number of characters used for the progress bar step ID. + /// Returns the number of characters used for the progress bar item ID. #[cfg(feature = "output_progress")] - pub fn pb_step_id_width(&self) -> Option { - self.pb_step_id_width + pub fn pb_item_id_width(&self) -> Option { + self.pb_item_id_width } async fn output_presentable(&mut self, presentable: P) -> Result<(), E> @@ -349,7 +349,7 @@ where // 17: blue dark (running background) // 208: yellow-orange (stalled) // 220: yellow (interrupted) - // 75: indigo pale (user pending, step id) + // 75: indigo pale (user pending, item id) // 35: green pale (success) // 22: green dark (success background) // 160: red slightly dim (fail) @@ -434,7 +434,7 @@ where } } }; - let prefix_width = self.pb_step_id_width.unwrap_or(20); + let prefix_width = self.pb_item_id_width.unwrap_or(20); let prefix = format!("{{prefix:{prefix_width}}}"); let (progress_is_complete, completion_is_successful) = @@ -475,7 +475,7 @@ where // let mut format_str = format!("{icon} {progress_status:20} {prefix} {bar_or_spinner}"); // ``` - // `prefix` is the step ID. + // `prefix` is the item ID. let mut format_str = format!("{icon} {prefix} {bar_or_spinner}"); if let Some(units) = units { format_str.push_str(units); @@ -525,8 +525,8 @@ where .multi_progress() .set_draw_target(progress_draw_target); - // TODO: test with multiple step IDs of varying length - self.pb_step_id_width = { + // TODO: test with multiple item IDs of varying length + self.pb_item_id_width = { if cmd_progress_tracker.progress_trackers().is_empty() { Some(0) } else { @@ -542,21 +542,21 @@ where }) .unwrap_or(0) }; - let step_id_width = cmd_progress_tracker.progress_trackers().iter().fold( + let item_id_width = cmd_progress_tracker.progress_trackers().iter().fold( 0, - |pb_step_id_width, (step_id, _progress_tracker)| { - std::cmp::max(step_id.len(), pb_step_id_width) + |pb_item_id_width, (item_id, _progress_tracker)| { + std::cmp::max(item_id.len(), pb_item_id_width) }, ); - Some(list_digit_width + step_id_width) + Some(list_digit_width + item_id_width) } }; cmd_progress_tracker .progress_trackers() .iter() .enumerate() - .for_each(|(index, (step_id, progress_tracker))| { + .for_each(|(index, (item_id, progress_tracker))| { let progress_bar = progress_tracker.progress_bar(); // Hack: colourization done in `progress_begin` to get @@ -569,14 +569,14 @@ where .color256(15) .apply_to(format!("{index}.")); // blue - let step_id_colorized = console::Style::new() + let item_id_colorized = console::Style::new() .color256(75) - .apply_to(format!("{step_id}")); + .apply_to(format!("{item_id}")); progress_bar - .set_prefix(format!("{index_colorized} {step_id_colorized}")); + .set_prefix(format!("{index_colorized} {item_id_colorized}")); } CliColorize::Uncolored => { - progress_bar.set_prefix(format!("{index}. {step_id}")); + progress_bar.set_prefix(format!("{index}. {item_id}")); } } @@ -596,9 +596,9 @@ where panic!("`ProgressStyle` template was invalid. Template: `\"\"`. Error: {error}") }); cmd_progress_tracker.progress_trackers().iter().for_each( - |(step_id, progress_tracker)| { + |(item_id, progress_tracker)| { let progress_bar = progress_tracker.progress_bar(); - progress_bar.set_prefix(format!("{step_id}")); + progress_bar.set_prefix(format!("{item_id}")); progress_bar.set_style(progress_style.clone()); }, ); @@ -674,7 +674,7 @@ where // progress information. // // We probably need to send more information in the `ProgressUpdate`, i.e. which - // step it came from. + // item it came from. OutputFormat::Text | OutputFormat::Yaml => { let _progress_display_unused = serde_yaml::to_string(progress_update_and_id).map(|t_serialized| { @@ -698,12 +698,12 @@ where async fn progress_end(&mut self, cmd_progress_tracker: &CmdProgressTracker) { match self.progress_format { CliProgressFormat::ProgressBar => { - self.pb_step_id_width = None; + self.pb_item_id_width = None; // Hack: This should be done with a timer in `ApplyCmd`. // This uses threads, which is not WASM compatible. cmd_progress_tracker.progress_trackers().iter().for_each( - |(_step_id, progress_tracker)| { + |(_item_id, progress_tracker)| { let progress_bar = progress_tracker.progress_bar(); progress_bar.disable_steady_tick(); progress_bar.tick(); diff --git a/crate/cli/src/output/cli_output_builder.rs b/crate/cli/src/output/cli_output_builder.rs index a3aefbd93..e753817fc 100644 --- a/crate/cli/src/output/cli_output_builder.rs +++ b/crate/cli/src/output/cli_output_builder.rs @@ -289,7 +289,7 @@ where #[cfg(feature = "output_progress")] progress_format, #[cfg(feature = "output_progress")] - pb_step_id_width: None, + pb_item_id_width: None, #[cfg(unix)] stdin_tty_with_guard, } diff --git a/crate/cmd/src/ctx/cmd_ctx_builder.rs b/crate/cmd/src/ctx/cmd_ctx_builder.rs index a7feef96a..84169949d 100644 --- a/crate/cmd/src/ctx/cmd_ctx_builder.rs +++ b/crate/cmd/src/ctx/cmd_ctx_builder.rs @@ -5,7 +5,7 @@ use std::{fmt::Debug, hash::Hash}; use futures::stream::{StreamExt, TryStreamExt}; use interruptible::Interruptibility; use own::{OwnedOrMutRef, OwnedOrRef}; -use peace_cfg::StepId; +use peace_cfg::ItemId; use peace_params::ParamsSpecs; use peace_resources::{ internal::{FlowParamsFile, ProfileParamsFile, WorkspaceParamsFile}, @@ -16,7 +16,7 @@ use peace_resources::{ use peace_rt_model::{ fn_graph::resman::Resource, params::{FlowParams, ProfileParams, WorkspaceParams}, - Flow, StepGraph, ParamsSpecsSerializer, ParamsSpecsTypeReg, StatesTypeReg, Storage, Workspace, + Flow, ItemGraph, ParamsSpecsSerializer, ParamsSpecsTypeReg, StatesTypeReg, Storage, Workspace, WorkspaceInitializer, }; use serde::{de::DeserializeOwned, Serialize}; @@ -140,7 +140,7 @@ where Ok(()) } -/// Serializes step params to storage. +/// Serializes item params to storage. async fn params_specs_serialize( params_specs: &ParamsSpecs, storage: &Storage, @@ -248,23 +248,23 @@ pub(crate) async fn profiles_from_peace_app_dir( Ok(profiles) } -/// Registers each step's `Params` and `State` for stateful +/// Registers each item's `Params` and `State` for stateful /// deserialization. -fn params_and_states_type_reg(step_graph: &StepGraph) -> (ParamsSpecsTypeReg, StatesTypeReg) +fn params_and_states_type_reg(item_graph: &ItemGraph) -> (ParamsSpecsTypeReg, StatesTypeReg) where E: 'static, { - step_graph.iter().fold( + item_graph.iter().fold( (ParamsSpecsTypeReg::new(), StatesTypeReg::new()), - |(mut params_specs_type_reg, mut states_type_reg), step| { - step.params_and_state_register(&mut params_specs_type_reg, &mut states_type_reg); + |(mut params_specs_type_reg, mut states_type_reg), item| { + item.params_and_state_register(&mut params_specs_type_reg, &mut states_type_reg); (params_specs_type_reg, states_type_reg) }, ) } -/// Merges provided step parameters with previously stored step +/// Merges provided item parameters with previously stored item /// parameters. /// /// If a step's parameters are not provided, and nothing was previously @@ -281,86 +281,86 @@ where // precedence. // // We construct a new TypeMap because we want to make sure params specs are - // serialized in order of the steps in the graph. - let step_graph = flow.graph(); - let mut params_specs = ParamsSpecs::with_capacity(step_graph.node_count()); + // serialized in order of the items in the graph. + let item_graph = flow.graph(); + let mut params_specs = ParamsSpecs::with_capacity(item_graph.node_count()); // Collected erroneous data -- parameters may have been valid in the past, but: // - // * step IDs may have changed. - // * steps may have been removed, but params specs remain. - // * steps may have been added, but params specs forgotten to be added. - let mut step_ids_with_no_params_specs = Vec::::new(); + // * item IDs may have changed. + // * items may have been removed, but params specs remain. + // * items may have been added, but params specs forgotten to be added. + let mut item_ids_with_no_params_specs = Vec::::new(); let mut params_specs_stored_mismatches = None; - let mut params_specs_not_usable = Vec::::new(); + let mut params_specs_not_usable = Vec::::new(); if let Some(mut params_specs_stored) = params_specs_stored { - step_graph.iter_insertion().for_each(|step_rt| { - let step_id = step_rt.id(); + item_graph.iter_insertion().for_each(|item_rt| { + let item_id = item_rt.id(); // Removing the entry from stored params specs is deliberate, so filtering for - // stored params specs that no longer have a corresponding step are + // stored params specs that no longer have a corresponding item are // detected. - let params_spec_provided = params_specs_provided.shift_remove_entry(step_id); - let params_spec_stored = params_specs_stored.shift_remove_entry(step_id); + let params_spec_provided = params_specs_provided.shift_remove_entry(item_id); + let params_spec_stored = params_specs_stored.shift_remove_entry(item_id); // Deep merge params specs. let params_spec_to_use = match (params_spec_provided, params_spec_stored) { (None, None) => None, (None, Some(params_spec_stored)) => Some(params_spec_stored), - // Newly added step, or potentially renamed. + // Newly added item, or potentially renamed. (Some(params_spec_provided), None) => Some(params_spec_provided), ( - Some((step_id, mut params_spec_provided)), - Some((_step_id, params_spec_stored)), + Some((item_id, mut params_spec_provided)), + Some((_item_id, params_spec_stored)), ) => { params_spec_provided.merge(&*params_spec_stored); - Some((step_id, params_spec_provided)) + Some((item_id, params_spec_provided)) } }; - if let Some((step_id, params_spec_boxed)) = params_spec_to_use { + if let Some((item_id, params_spec_boxed)) = params_spec_to_use { // `*Spec::MappingFn`s will be present in `params_spec_stored`, but will not // be valid mapping functions as they cannot be serialized / deserialized. // // Also, field wise `ParamsSpec`s may contain `ValueSpec::Stored` for fields // which never had specifications, which are also unusable. if params_spec_boxed.is_usable() { - params_specs.insert_raw(step_id, params_spec_boxed); + params_specs.insert_raw(item_id, params_spec_boxed); } else { - params_specs_not_usable.push(step_id); + params_specs_not_usable.push(item_id); } } else { - // Collect steps that do not have parameters. - step_ids_with_no_params_specs.push(step_id.clone()); + // Collect items that do not have parameters. + item_ids_with_no_params_specs.push(item_id.clone()); } }); - // Stored parameters whose IDs do not correspond to any step IDs in the + // Stored parameters whose IDs do not correspond to any item IDs in the // graph. May be empty. params_specs_stored_mismatches = Some(params_specs_stored); } else { - step_graph.iter_insertion().for_each(|step_rt| { - let step_id = step_rt.id(); + item_graph.iter_insertion().for_each(|item_rt| { + let item_id = item_rt.id(); - if let Some((step_id, params_spec_boxed)) = - params_specs_provided.shift_remove_entry(step_id) + if let Some((item_id, params_spec_boxed)) = + params_specs_provided.shift_remove_entry(item_id) { - params_specs.insert_raw(step_id, params_spec_boxed); + params_specs.insert_raw(item_id, params_spec_boxed); } else { - // Collect steps that do not have parameters. - step_ids_with_no_params_specs.push(step_id.clone()); + // Collect items that do not have parameters. + item_ids_with_no_params_specs.push(item_id.clone()); } }); } - // Provided parameters whose IDs do not correspond to any step IDs in the + // Provided parameters whose IDs do not correspond to any item IDs in the // graph. let params_specs_provided_mismatches = params_specs_provided; - let params_no_issues = step_ids_with_no_params_specs.is_empty() + let params_no_issues = item_ids_with_no_params_specs.is_empty() && params_specs_provided_mismatches.is_empty() && params_specs_stored_mismatches .as_ref() @@ -372,7 +372,7 @@ where Ok(params_specs) } else { Err(peace_rt_model::Error::ParamsSpecsMismatch { - step_ids_with_no_params_specs, + item_ids_with_no_params_specs, params_specs_provided_mismatches, params_specs_stored_mismatches, params_specs_not_usable, @@ -380,18 +380,18 @@ where } } -async fn step_graph_setup( - step_graph: &StepGraph, +async fn item_graph_setup( + item_graph: &ItemGraph, resources: Resources, ) -> Result, E> where E: std::error::Error + 'static, { - let resources = step_graph + let resources = item_graph .stream() .map(Ok::<_, E>) - .try_fold(resources, |mut resources, step| async move { - step.setup(&mut resources).await?; + .try_fold(resources, |mut resources, item| async move { + item.setup(&mut resources).await?; Ok(resources) }) .await?; diff --git a/crate/cmd/src/scopes/multi_profile_no_flow.rs b/crate/cmd/src/scopes/multi_profile_no_flow.rs index caa538e2f..64a4e035c 100644 --- a/crate/cmd/src/scopes/multi_profile_no_flow.rs +++ b/crate/cmd/src/scopes/multi_profile_no_flow.rs @@ -15,7 +15,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::ctx::CmdCtxTypes; -/// A command that works with multiple profiles, not scoped to a flow. +/// A command that works with multiple profiles, without any items. /// /// ```bash /// path/to/repo/.peace/envman @@ -94,7 +94,7 @@ where >, } -/// A command that works with multiple profiles, not scoped to a flow. +/// A command that works with multiple profiles, without any items. /// /// ```bash /// path/to/repo/.peace/envman diff --git a/crate/cmd/src/scopes/multi_profile_single_flow.rs b/crate/cmd/src/scopes/multi_profile_single_flow.rs index 023dc733a..cba3d7416 100644 --- a/crate/cmd/src/scopes/multi_profile_single_flow.rs +++ b/crate/cmd/src/scopes/multi_profile_single_flow.rs @@ -126,16 +126,16 @@ where >, /// Stored current states for each profile for the selected flow. profile_to_states_current_stored: BTreeMap>, - /// Type registry for each step's [`Params`]`::Spec`. + /// Type registry for each item's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Step::Params + /// [`Params`]: peace_cfg::Item::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile params_specs_type_reg: ParamsSpecsTypeReg, - /// Step params specs for each profile for the selected flow. + /// Item params specs for each profile for the selected flow. profile_to_params_specs: BTreeMap>, - /// Type registry for each step's `State`. + /// Type registry for each item's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. @@ -202,16 +202,16 @@ where >, /// Stored current states for each profile for the selected flow. pub profile_to_states_current_stored: &'view BTreeMap>, - /// Type registry for each step's [`Params`]`::Spec`. + /// Type registry for each item's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Step::Params + /// [`Params`]: peace_cfg::Item::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile pub params_specs_type_reg: &'view ParamsSpecsTypeReg, - /// Step params specs for each profile for the selected flow. + /// Item params specs for each profile for the selected flow. pub profile_to_params_specs: &'view BTreeMap>, - /// Type registry for each step's `State`. + /// Type registry for each item's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. @@ -403,7 +403,7 @@ where /// and [`FlowParams`] deserialization. /// /// [`FlowParams`]: peace_rt_model::params::FlowParams - /// [`StepParams`]: peace_rt_model::StepParams + /// [`ItemParams`]: peace_rt_model::ItemParams /// [`ProfileParams`]: peace_rt_model::params::ProfileParams /// [`WorkspaceParams`]: peace_rt_model::params::WorkspaceParams pub fn params_type_regs(&self) -> &ParamsTypeRegs { @@ -418,23 +418,23 @@ where &self.profile_to_states_current_stored } - /// Returns the type registry for each step's [`Params`]`::Spec`. + /// Returns the type registry for each item's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Step::Params + /// [`Params`]: peace_cfg::Item::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile pub fn params_specs_type_reg(&self) -> &ParamsSpecsTypeReg { &self.params_specs_type_reg } - /// Returns the step params specs for each profile for the selected + /// Returns the item params specs for each profile for the selected /// flow. pub fn profile_to_params_specs(&self) -> &BTreeMap> { &self.profile_to_params_specs } - /// Returns the type registry for each step's `State`. + /// Returns the type registry for each item's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. diff --git a/crate/cmd/src/scopes/single_profile_no_flow.rs b/crate/cmd/src/scopes/single_profile_no_flow.rs index 30eec15f5..7ad07a042 100644 --- a/crate/cmd/src/scopes/single_profile_no_flow.rs +++ b/crate/cmd/src/scopes/single_profile_no_flow.rs @@ -15,7 +15,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::ctx::CmdCtxTypes; -/// A command that works with a single profile, not scoped to a flow. +/// A command that works with a single profile, without any items. /// /// ```bash /// path/to/repo/.peace/envman @@ -84,7 +84,7 @@ where >, } -/// A command that works with a single profile, not scoped to a flow. +/// A command that works with a single profile, without any items. /// /// ```bash /// path/to/repo/.peace/envman diff --git a/crate/cmd/src/scopes/single_profile_single_flow.rs b/crate/cmd/src/scopes/single_profile_single_flow.rs index 9edc07cd6..c33a6a0c0 100644 --- a/crate/cmd/src/scopes/single_profile_single_flow.rs +++ b/crate/cmd/src/scopes/single_profile_single_flow.rs @@ -101,16 +101,16 @@ where /// Flow params for the selected flow. flow_params: FlowParams<<::FlowParamsKMaybe as KeyMaybe>::Key>, - /// Type registry for each step's [`Params`]`::Spec`. + /// Type registry for each item's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Step::Params + /// [`Params`]: peace_cfg::Item::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile params_specs_type_reg: ParamsSpecsTypeReg, - /// Step params specs for the selected flow. + /// Item params specs for the selected flow. params_specs: ParamsSpecs, - /// Type registry for each step's `State`. + /// Type registry for each item's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. @@ -194,16 +194,16 @@ where pub flow_params: &'view FlowParams< <::FlowParamsKMaybe as KeyMaybe>::Key, >, - /// Type registry for each step's [`Params`]`::Spec`. + /// Type registry for each item's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Step::Params + /// [`Params`]: peace_cfg::Item::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile pub params_specs_type_reg: &'view ParamsSpecsTypeReg, - /// Step params specs for the selected flow. + /// Item params specs for the selected flow. pub params_specs: &'view ParamsSpecs, - /// Type registry for each step's `State`. + /// Type registry for each item's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. @@ -473,29 +473,29 @@ where /// and [`FlowParams`] deserialization. /// /// [`FlowParams`]: peace_rt_model::params::FlowParams - /// [`StepParams`]: peace_rt_model::StepParams + /// [`ItemParams`]: peace_rt_model::ItemParams /// [`ProfileParams`]: peace_rt_model::params::ProfileParams /// [`WorkspaceParams`]: peace_rt_model::params::WorkspaceParams pub fn params_type_regs(&self) -> &ParamsTypeRegs { &self.params_type_regs } - /// Returns the type registry for each step's [`Params`]`::Spec`. + /// Returns the type registry for each item's [`Params`]`::Spec`. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// - /// [`Params`]: peace_cfg::Step::Params + /// [`Params`]: peace_cfg::Item::Params /// [`ParamsSpecsFile`]: peace_resources::paths::ParamsSpecsFile pub fn params_specs_type_reg(&self) -> &ParamsSpecsTypeReg { &self.params_specs_type_reg } - /// Returns the step params specs for the selected flow. + /// Returns the item params specs for the selected flow. pub fn params_specs(&self) -> &ParamsSpecs { &self.params_specs } - /// Returns the type registry for each step's `State`. + /// Returns the type registry for each item's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and /// [`StatesGoalFile`]. diff --git a/crate/cmd_model/src/cmd_block_outcome.rs b/crate/cmd_model/src/cmd_block_outcome.rs index 6cc7ddcf6..5092d7095 100644 --- a/crate/cmd_model/src/cmd_block_outcome.rs +++ b/crate/cmd_model/src/cmd_block_outcome.rs @@ -1,6 +1,6 @@ use fn_graph::StreamOutcome; use indexmap::IndexMap; -use peace_cfg::StepId; +use peace_cfg::ItemId; use crate::{StreamOutcomeAndErrors, ValueAndStreamOutcome}; @@ -12,7 +12,7 @@ pub enum CmdBlockOutcome { /// Relevant to command blocks that deal with a single atomic operation, /// e.g. loading a file. Single(T), - /// A value returned per step. + /// A value returned per item. /// /// # Design Note /// @@ -35,19 +35,19 @@ pub enum CmdBlockOutcome { /// having consumers return a `StreamOutcome` allows them to use the /// `FnGraph` streaming methods, without having to split the value out of /// the `StreamOutcome`. - StepWise { - /// The values returned per step. + ItemWise { + /// The values returned per item. stream_outcome: StreamOutcome, /// Errors from the command execution. - errors: IndexMap, + errors: IndexMap, }, } impl CmdBlockOutcome { - /// Returns a new `CmdBlockOutcome::StepWise` with the given value, and no + /// Returns a new `CmdBlockOutcome::ItemWise` with the given value, and no /// errors. - pub fn new_step_wise(stream_outcome: StreamOutcome) -> Self { - Self::StepWise { + pub fn new_item_wise(stream_outcome: StreamOutcome) -> Self { + Self::ItemWise { stream_outcome, errors: IndexMap::new(), } @@ -57,7 +57,7 @@ impl CmdBlockOutcome { pub fn is_ok(&self) -> bool { match self { Self::Single(_) => true, - Self::StepWise { + Self::ItemWise { stream_outcome: _, errors, } => errors.is_empty(), @@ -72,7 +72,7 @@ impl CmdBlockOutcome { value, stream_outcome: None, }), - Self::StepWise { + Self::ItemWise { stream_outcome, errors, } => { @@ -96,7 +96,7 @@ impl CmdBlockOutcome { pub fn is_err(&self) -> bool { match self { Self::Single(_) => false, - Self::StepWise { + Self::ItemWise { stream_outcome: _, errors, } => !errors.is_empty(), @@ -112,12 +112,12 @@ impl CmdBlockOutcome { let u = f(t); CmdBlockOutcome::Single(u) } - Self::StepWise { + Self::ItemWise { stream_outcome, errors, } => { let stream_outcome = stream_outcome.map(f); - CmdBlockOutcome::StepWise { + CmdBlockOutcome::ItemWise { stream_outcome, errors, } diff --git a/crate/cmd_model/src/cmd_outcome.rs b/crate/cmd_model/src/cmd_outcome.rs index f962bbc90..2ee34cfc8 100644 --- a/crate/cmd_model/src/cmd_outcome.rs +++ b/crate/cmd_model/src/cmd_outcome.rs @@ -1,8 +1,8 @@ use futures::Future; use indexmap::IndexMap; -use peace_cfg::StepId; +use peace_cfg::ItemId; -use crate::{CmdBlockDesc, StepStreamOutcome}; +use crate::{CmdBlockDesc, ItemStreamOutcome}; /// Outcome of a [`CmdExecution`]. /// @@ -25,7 +25,7 @@ pub enum CmdOutcome { /// Execution ended due to an interruption during command block execution. BlockInterrupted { /// The stream outcome of the interrupted command block. - step_stream_outcome: StepStreamOutcome, + item_stream_outcome: ItemStreamOutcome, /// Descriptors of the `CmdBlock`s that were processed. /// /// This does not include the `CmdBlock` that was interrupted. @@ -44,13 +44,13 @@ pub enum CmdOutcome { /// Descriptors of the `CmdBlock`s that were not processed. cmd_blocks_not_processed: Vec, }, - /// Execution ended due to one or more step errors. + /// Execution ended due to one or more item errors. /// /// It is also possible for the stream to be interrupted when an error - /// occurs, so the value is wrapped in a `StepStreamOutcome`. - StepError { + /// occurs, so the value is wrapped in a `ItemStreamOutcome`. + ItemError { /// The outcome value. - step_stream_outcome: StepStreamOutcome, + item_stream_outcome: ItemStreamOutcome, /// Descriptors of the `CmdBlock`s that were processed. /// /// This does not include the `CmdBlock` that erred. @@ -59,8 +59,8 @@ pub enum CmdOutcome { /// /// The first block in this list is the one that erred. cmd_blocks_not_processed: Vec, - /// Step error(s) from the last command block's execution. - errors: IndexMap, + /// Item error(s) from the last command block's execution. + errors: IndexMap, }, } @@ -72,21 +72,21 @@ impl CmdOutcome { cmd_blocks_processed: _, } => Some(value), CmdOutcome::BlockInterrupted { - step_stream_outcome, + item_stream_outcome, cmd_blocks_processed: _, cmd_blocks_not_processed: _, - } => Some(step_stream_outcome.value()), + } => Some(item_stream_outcome.value()), CmdOutcome::ExecutionInterrupted { value, cmd_blocks_processed: _, cmd_blocks_not_processed: _, } => value.as_ref(), - CmdOutcome::StepError { - step_stream_outcome, + CmdOutcome::ItemError { + item_stream_outcome, cmd_blocks_processed: _, cmd_blocks_not_processed: _, errors: _, - } => Some(step_stream_outcome.value()), + } => Some(item_stream_outcome.value()), } } @@ -103,9 +103,9 @@ impl CmdOutcome { ) } - /// Returns whether the command encountered step errors during execution. + /// Returns whether the command encountered item errors during execution. pub fn is_err(&self) -> bool { - matches!(self, Self::StepError { .. }) + matches!(self, Self::ItemError { .. }) } /// Maps the inner value to another, maintaining any collected errors. @@ -125,13 +125,13 @@ impl CmdOutcome { } } Self::BlockInterrupted { - step_stream_outcome, + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } => { - let step_stream_outcome = step_stream_outcome.map(f); + let item_stream_outcome = item_stream_outcome.map(f); CmdOutcome::BlockInterrupted { - step_stream_outcome, + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } @@ -148,15 +148,15 @@ impl CmdOutcome { cmd_blocks_not_processed, } } - Self::StepError { - step_stream_outcome, + Self::ItemError { + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, } => { - let step_stream_outcome = step_stream_outcome.map(f); - CmdOutcome::StepError { - step_stream_outcome, + let item_stream_outcome = item_stream_outcome.map(f); + CmdOutcome::ItemError { + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, @@ -184,15 +184,15 @@ impl CmdOutcome { } } Self::BlockInterrupted { - step_stream_outcome, + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } => { - let (step_stream_outcome, value) = step_stream_outcome.replace(()); + let (item_stream_outcome, value) = item_stream_outcome.replace(()); let value = f(value).await; - let (step_stream_outcome, ()) = step_stream_outcome.replace(value); + let (item_stream_outcome, ()) = item_stream_outcome.replace(value); CmdOutcome::BlockInterrupted { - step_stream_outcome, + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } @@ -212,17 +212,17 @@ impl CmdOutcome { cmd_blocks_not_processed, } } - Self::StepError { - step_stream_outcome, + Self::ItemError { + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, } => { - let (step_stream_outcome, value) = step_stream_outcome.replace(()); + let (item_stream_outcome, value) = item_stream_outcome.replace(()); let value = f(value).await; - let (step_stream_outcome, ()) = step_stream_outcome.replace(value); - CmdOutcome::StepError { - step_stream_outcome, + let (item_stream_outcome, ()) = item_stream_outcome.replace(value); + CmdOutcome::ItemError { + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, @@ -248,16 +248,16 @@ impl CmdOutcome, E> { Err(e) => Err(e), }, Self::BlockInterrupted { - step_stream_outcome, + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, } => { - let (step_stream_outcome, value) = step_stream_outcome.replace(()); + let (item_stream_outcome, value) = item_stream_outcome.replace(()); match value { Ok(value) => { - let (step_stream_outcome, ()) = step_stream_outcome.replace(value); + let (item_stream_outcome, ()) = item_stream_outcome.replace(value); Ok(CmdOutcome::BlockInterrupted { - step_stream_outcome, + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, }) @@ -277,18 +277,18 @@ impl CmdOutcome, E> { }), Err(e) => Err(e), }, - Self::StepError { - step_stream_outcome, + Self::ItemError { + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, } => { - let (step_stream_outcome, value) = step_stream_outcome.replace(()); + let (item_stream_outcome, value) = item_stream_outcome.replace(()); match value { Ok(value) => { - let (step_stream_outcome, ()) = step_stream_outcome.replace(value); - Ok(CmdOutcome::StepError { - step_stream_outcome, + let (item_stream_outcome, ()) = item_stream_outcome.replace(value); + Ok(CmdOutcome::ItemError { + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, diff --git a/crate/cmd_model/src/lib.rs b/crate/cmd_model/src/lib.rs index 0a3329213..b562e647c 100644 --- a/crate/cmd_model/src/lib.rs +++ b/crate/cmd_model/src/lib.rs @@ -9,7 +9,7 @@ pub use indexmap; pub use crate::{ cmd_block_desc::CmdBlockDesc, cmd_block_outcome::CmdBlockOutcome, cmd_execution_error::CmdExecutionError, cmd_execution_id::CmdExecutionId, - cmd_outcome::CmdOutcome, step_stream_outcome::StepStreamOutcome, + cmd_outcome::CmdOutcome, item_stream_outcome::ItemStreamOutcome, stream_outcome_and_errors::StreamOutcomeAndErrors, value_and_stream_outcome::ValueAndStreamOutcome, }; @@ -19,6 +19,6 @@ mod cmd_block_outcome; mod cmd_execution_error; mod cmd_execution_id; mod cmd_outcome; -mod step_stream_outcome; +mod item_stream_outcome; mod stream_outcome_and_errors; mod value_and_stream_outcome; diff --git a/crate/cmd_model/src/step_stream_outcome.rs b/crate/cmd_model/src/step_stream_outcome.rs index b0ece1e26..9f6afcd7d 100644 --- a/crate/cmd_model/src/step_stream_outcome.rs +++ b/crate/cmd_model/src/step_stream_outcome.rs @@ -1,66 +1,66 @@ use fn_graph::StreamOutcomeState; -use peace_cfg::StepId; +use peace_cfg::ItemId; /// How a `Flow` stream operation ended and IDs that were processed. /// -/// Currently this is constructed by `StepStreamOutcomeMapper`. +/// Currently this is constructed by `ItemStreamOutcomeMapper`. #[derive(Clone, Debug, PartialEq, Eq)] -pub struct StepStreamOutcome { +pub struct ItemStreamOutcome { /// The value of the outcome. pub value: T, /// How a `Flow` stream operation ended. pub state: StreamOutcomeState, - /// IDs of the steps that were processed. - pub step_ids_processed: Vec, - /// IDs of the steps that were not processed. - pub step_ids_not_processed: Vec, + /// IDs of the items that were processed. + pub item_ids_processed: Vec, + /// IDs of the items that were not processed. + pub item_ids_not_processed: Vec, } -impl StepStreamOutcome { +impl ItemStreamOutcome { /// Returns a `StepStreamOutcome` that is `Finished`. - pub fn finished_with(value: T, step_ids_processed: Vec) -> Self { + pub fn finished_with(value: T, item_ids_processed: Vec) -> Self { Self { value, state: StreamOutcomeState::Finished, - step_ids_processed, - step_ids_not_processed: Vec::new(), + item_ids_processed, + item_ids_not_processed: Vec::new(), } } /// Maps this outcome's value to another. - pub fn map(self, f: impl FnOnce(T) -> TNew) -> StepStreamOutcome { - let StepStreamOutcome { + pub fn map(self, f: impl FnOnce(T) -> TNew) -> ItemStreamOutcome { + let ItemStreamOutcome { value, state, - step_ids_processed, - step_ids_not_processed, + item_ids_processed, + item_ids_not_processed, } = self; let value = f(value); - StepStreamOutcome { + ItemStreamOutcome { value, state, - step_ids_processed, - step_ids_not_processed, + item_ids_processed, + item_ids_not_processed, } } /// Replaces the value from this outcome with another. - pub fn replace(self, value_new: TNew) -> (StepStreamOutcome, T) { - let StepStreamOutcome { + pub fn replace(self, value_new: TNew) -> (ItemStreamOutcome, T) { + let ItemStreamOutcome { value: value_existing, state, - step_ids_processed, - step_ids_not_processed, + item_ids_processed, + item_ids_not_processed, } = self; ( - StepStreamOutcome { + ItemStreamOutcome { value: value_new, state, - step_ids_processed, - step_ids_not_processed, + item_ids_processed, + item_ids_not_processed, }, value_existing, ) @@ -71,22 +71,22 @@ impl StepStreamOutcome { pub fn replace_with( self, f: impl FnOnce(T) -> (TNew, U), - ) -> (StepStreamOutcome, U) { - let StepStreamOutcome { + ) -> (ItemStreamOutcome, U) { + let ItemStreamOutcome { value, state, - step_ids_processed, - step_ids_not_processed, + item_ids_processed, + item_ids_not_processed, } = self; let (value, extracted) = f(value); ( - StepStreamOutcome { + ItemStreamOutcome { value, state, - step_ids_processed, - step_ids_not_processed, + item_ids_processed, + item_ids_not_processed, }, extracted, ) @@ -108,16 +108,16 @@ impl StepStreamOutcome { self.state } - pub fn step_ids_processed(&self) -> &[StepId] { - self.step_ids_processed.as_ref() + pub fn item_ids_processed(&self) -> &[ItemId] { + self.item_ids_processed.as_ref() } - pub fn step_ids_not_processed(&self) -> &[StepId] { - self.step_ids_not_processed.as_ref() + pub fn item_ids_not_processed(&self) -> &[ItemId] { + self.item_ids_not_processed.as_ref() } } -impl Default for StepStreamOutcome +impl Default for ItemStreamOutcome where T: Default, { @@ -125,8 +125,8 @@ where Self { value: T::default(), state: StreamOutcomeState::NotStarted, - step_ids_processed: Vec::new(), - step_ids_not_processed: Vec::new(), + item_ids_processed: Vec::new(), + item_ids_not_processed: Vec::new(), } } } diff --git a/crate/cmd_model/src/stream_outcome_and_errors.rs b/crate/cmd_model/src/stream_outcome_and_errors.rs index a503a3748..852ec4f3d 100644 --- a/crate/cmd_model/src/stream_outcome_and_errors.rs +++ b/crate/cmd_model/src/stream_outcome_and_errors.rs @@ -1,12 +1,12 @@ use fn_graph::StreamOutcome; use indexmap::IndexMap; -use peace_cfg::StepId; +use peace_cfg::ItemId; -/// `CmdBlock` stream outcome and step wise errors. +/// `CmdBlock` stream outcome and item wise errors. #[derive(Clone, Debug, PartialEq, Eq)] pub struct StreamOutcomeAndErrors { /// The `CmdBlock` stream outcome. pub stream_outcome: StreamOutcome, /// The errors during processing, - pub errors: IndexMap, + pub errors: IndexMap, } diff --git a/crate/cmd_model/src/value_and_stream_outcome.rs b/crate/cmd_model/src/value_and_stream_outcome.rs index 10cfb3a48..17e06f133 100644 --- a/crate/cmd_model/src/value_and_stream_outcome.rs +++ b/crate/cmd_model/src/value_and_stream_outcome.rs @@ -5,7 +5,7 @@ use fn_graph::StreamOutcome; pub struct ValueAndStreamOutcome { /// The value returned by the `CmdBlock`. pub value: T, - /// If the block streams each step in its logic, then this contains the + /// If the block streams each item in its logic, then this contains the /// stream outcome. pub stream_outcome: Option>, } diff --git a/crate/cmd_rt/src/cmd_block.rs b/crate/cmd_rt/src/cmd_block.rs index 7b2430063..0f26f53fe 100644 --- a/crate/cmd_rt/src/cmd_block.rs +++ b/crate/cmd_rt/src/cmd_block.rs @@ -22,26 +22,26 @@ mod cmd_block_rt; mod cmd_block_rt_box; mod cmd_block_wrapper; -/// Runs one [`Step::*`] function for one iteration of steps. +/// Runs one [`Item::*`] function for one iteration of items. /// /// A command may consist of: /// /// 1. Discovering the current state of an environment. -/// 2. Ensuring new steps that are not blocked, e.g. launch new servers before +/// 2. Ensuring new items that are not blocked, e.g. launch new servers before /// taking old servers away. -/// 3. Cleaning unused steps that block new steps from being ensured, e.g. +/// 3. Cleaning unused items that block new items from being ensured, e.g. /// terminating servers before resizing a subnet's CIDR block. -/// 4. Ensuring new / modified steps that are newly unblocked, e.g. launching +/// 4. Ensuring new / modified items that are newly unblocked, e.g. launching /// new servers in the resized subnet. -/// 5. Cleaning unused steps that are no longer needed, e.g. removing an old +/// 5. Cleaning unused items that are no longer needed, e.g. removing an old /// service. /// -/// Each of these is an iteration through steps, running one of the [`Step::*`] +/// Each of these is an iteration through items, running one of the [`Item::*`] /// functions. /// /// A `CmdBlock` is the unit of one iteration logic. /// -/// [`Step::*`]: peace_cfg::Step +/// [`Item::*`]: peace_cfg::Item #[async_trait(?Send)] pub trait CmdBlock: Debug { /// Type parameters passed to the `CmdCtx`. @@ -160,19 +160,19 @@ pub trait CmdBlock: Debug { vec![tynm::type_name::()] } - /// Producer function to process all steps. + /// Producer function to process all items. /// /// This is infallible because errors are expected to be returned associated /// with a step. This may change if there are errors that are related to - /// the block that are not associated with a specific step. + /// the block that are not associated with a specific item. /// /// # Implementors /// /// `StreamOutcome<()>` should be returned if the `CmdBlock` streams the - /// steps, as this captures whether or not the block execution was + /// items, as this captures whether or not the block execution was /// interrupted. /// - /// If the block does not stream steps, `None` should be returned. + /// If the block does not stream items, `None` should be returned. async fn exec( &self, input: Self::InputT, diff --git a/crate/cmd_rt/src/cmd_block/cmd_block_error.rs b/crate/cmd_rt/src/cmd_block/cmd_block_error.rs index 7ec1b507b..c4f9a031a 100644 --- a/crate/cmd_rt/src/cmd_block/cmd_block_error.rs +++ b/crate/cmd_rt/src/cmd_block/cmd_block_error.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use fn_graph::StreamOutcome; use indexmap::IndexMap; -use peace_cfg::StepId; +use peace_cfg::ItemId; use peace_resources::ResourceFetchError; /// Error while executing a `CmdBlock`. @@ -35,19 +35,19 @@ where /// Error originated from `CmdBlock` exec code. #[error("`CmdBlock` block execution or collation logic failed.")] Exec(E), - /// Error originated from at least one step. + /// Error originated from at least one item. /// /// The `CmdBlock::Outcome` is mapped to the `ExecutionOutcome` using /// `fn_partial_exec_handler`. - #[error("`CmdBlock` step logic failed.")] - StepError { + #[error("`CmdBlock` item logic failed.")] + ItemError { /// The outcome value. stream_outcome: StreamOutcome, - /// Step error(s) from the last command block's execution. - errors: IndexMap, + /// Item error(s) from the last command block's execution. + errors: IndexMap, }, /// An interrupt signal was received while the `CmdBlock` was executing. - #[error("`CmdBlock` step logic failed.")] + #[error("`CmdBlock` item logic failed.")] Interrupt { /// The stream outcome of the interrupted command block. stream_outcome: StreamOutcome, diff --git a/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs b/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs index adb63362c..1bd33d5fd 100644 --- a/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs +++ b/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs @@ -24,7 +24,7 @@ cfg_if::cfg_if! { /// * Being in the `peace_cmd` crate, the type erased [`CmdBlockRt`] trait can /// be implemented on this type within this crate. /// * The partial execution handler specifies how a command execution should -/// finish, if execution is interrupted or there is an error with one step +/// finish, if execution is interrupted or there is an error with one item /// within the flow. /// /// [`CmdBlockRt`]: crate::CmdBlockRt @@ -111,7 +111,7 @@ where cmd_block.outcome_insert(cmd_view.resources, block_outcome); Ok(()) } - CmdBlockOutcome::StepWise { + CmdBlockOutcome::ItemWise { stream_outcome, errors, } => { @@ -140,11 +140,11 @@ where } } } else { - // If possible, `CmdBlock` outcomes with step errors need to be mapped to - // the `CmdExecution` outcome type, so we still return the step errors. + // If possible, `CmdBlock` outcomes with item errors need to be mapped to + // the `CmdExecution` outcome type, so we still return the item errors. // // e.g. `StatesCurrentMut` should be mapped into `StatesEnsured` when some - // steps fail to be ensured. + // items fail to be ensured. // // Note, when discovering current and goal states for diffing, and a step // error occurs, mapping the partially accumulated `(StatesCurrentMut, @@ -152,7 +152,7 @@ where // meaningful. let stream_outcome = stream_outcome.map(self.fn_partial_exec_handler); - Err(CmdBlockError::StepError { + Err(CmdBlockError::ItemError { stream_outcome, errors, }) diff --git a/crate/cmd_rt/src/cmd_execution.rs b/crate/cmd_rt/src/cmd_execution.rs index a3e309485..52c1f0bde 100644 --- a/crate/cmd_rt/src/cmd_execution.rs +++ b/crate/cmd_rt/src/cmd_execution.rs @@ -11,7 +11,7 @@ use peace_cmd::{ use peace_cmd_model::{CmdBlockDesc, CmdOutcome}; use peace_resources::{resources::ts::SetUp, Resources}; -use crate::{CmdBlockError, CmdBlockRtBox, StepStreamOutcomeMapper}; +use crate::{CmdBlockError, CmdBlockRtBox, ItemStreamOutcomeMapper}; cfg_if::cfg_if! { if #[cfg(feature = "output_progress")] { @@ -353,7 +353,7 @@ where } CmdBlockError::Exec(error) => Err(error), CmdBlockError::Interrupt { stream_outcome } => { - let step_stream_outcome = StepStreamOutcomeMapper::map(flow, stream_outcome); + let item_stream_outcome = ItemStreamOutcomeMapper::map(flow, stream_outcome); let cmd_blocks_processed = cmd_blocks .range(0..cmd_block_index) .map(|cmd_block_rt| cmd_block_rt.cmd_block_desc()) @@ -364,18 +364,18 @@ where .map(|cmd_block_rt| cmd_block_rt.cmd_block_desc()) .collect::>(); let cmd_outcome = CmdOutcome::BlockInterrupted { - step_stream_outcome, + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, }; Ok(cmd_outcome) } - CmdBlockError::StepError { + CmdBlockError::ItemError { stream_outcome, errors, } => { - let step_stream_outcome = StepStreamOutcomeMapper::map(flow, stream_outcome); + let item_stream_outcome = ItemStreamOutcomeMapper::map(flow, stream_outcome); let cmd_blocks_processed = cmd_blocks .range(0..cmd_block_index) .map(|cmd_block_rt| cmd_block_rt.cmd_block_desc()) @@ -386,8 +386,8 @@ where .map(|cmd_block_rt| cmd_block_rt.cmd_block_desc()) .collect::>(); - let cmd_outcome = CmdOutcome::StepError { - step_stream_outcome, + let cmd_outcome = CmdOutcome::ItemError { + item_stream_outcome, cmd_blocks_processed, cmd_blocks_not_processed, errors, diff --git a/crate/cmd_rt/src/cmd_execution/cmd_execution_builder.rs b/crate/cmd_rt/src/cmd_execution/cmd_execution_builder.rs index c3a83371f..9b0f89dde 100644 --- a/crate/cmd_rt/src/cmd_execution/cmd_execution_builder.rs +++ b/crate/cmd_rt/src/cmd_execution/cmd_execution_builder.rs @@ -23,7 +23,7 @@ where /// /// This is intended for `*Cmd`s that do not have meaningful progress to /// render, such as deserializing a single file on disk, and there is no - /// benefit to presenting empty progress bars for each step to the user + /// benefit to presenting empty progress bars for each item to the user /// /// Defaults to `true`. #[cfg(feature = "output_progress")] @@ -91,7 +91,7 @@ where /// /// This is intended for `*Cmd`s that do not have meaningful progress to /// render, such as deserializing a single file on disk, and there is no - /// benefit to presenting empty progress bars for each step to the user. + /// benefit to presenting empty progress bars for each item to the user. /// /// When this method is called multiple times, the last call wins. #[cfg(feature = "output_progress")] diff --git a/crate/cmd_rt/src/lib.rs b/crate/cmd_rt/src/lib.rs index ca26dd376..7c19a9ed7 100644 --- a/crate/cmd_rt/src/lib.rs +++ b/crate/cmd_rt/src/lib.rs @@ -7,12 +7,12 @@ pub use tynm; pub use crate::{ cmd_block::{CmdBlock, CmdBlockError, CmdBlockRt, CmdBlockRtBox, CmdBlockWrapper}, cmd_execution::{CmdExecution, CmdExecutionBuilder}, - step_stream_outcome_mapper::StepStreamOutcomeMapper, + item_stream_outcome_mapper::ItemStreamOutcomeMapper, }; mod cmd_block; mod cmd_execution; -mod step_stream_outcome_mapper; +mod item_stream_outcome_mapper; cfg_if::cfg_if! { if #[cfg(feature = "output_progress")] { diff --git a/crate/cmd_rt/src/progress.rs b/crate/cmd_rt/src/progress.rs index a2bd75d7d..5f120d45e 100644 --- a/crate/cmd_rt/src/progress.rs +++ b/crate/cmd_rt/src/progress.rs @@ -6,7 +6,7 @@ use peace_cfg::{ CmdProgressUpdate, ProgressDelta, ProgressMsgUpdate, ProgressStatus, ProgressTracker, ProgressUpdate, ProgressUpdateAndId, }, - StepId, + ItemId, }; use peace_rt_model::{output::OutputWrite, IndexMap}; use tokio::sync::mpsc::Receiver; @@ -18,7 +18,7 @@ impl Progress { // TODO: write test for this pub async fn progress_render( output: &mut O, - progress_trackers: &mut IndexMap, + progress_trackers: &mut IndexMap, mut cmd_progress_rx: Receiver, ) where O: OutputWrite, @@ -32,14 +32,14 @@ impl Progress { async fn handle_cmd_progress_update( output: &mut O, - progress_trackers: &mut IndexMap, + progress_trackers: &mut IndexMap, cmd_progress_update: CmdProgressUpdate, ) -> ControlFlow<()> where O: OutputWrite, { match cmd_progress_update { - CmdProgressUpdate::Step { + CmdProgressUpdate::Item { progress_update_and_id, } => { Self::handle_progress_update_and_id( @@ -53,10 +53,10 @@ impl Progress { } CmdProgressUpdate::Interrupt => { stream::iter(progress_trackers.iter_mut()) - .fold(output, |output, (step_id, progress_tracker)| async move { - let step_id = step_id.clone(); + .fold(output, |output, (item_id, progress_tracker)| async move { + let item_id = item_id.clone(); let progress_update_and_id = ProgressUpdateAndId { - step_id, + item_id, progress_update: ProgressUpdate::Interrupt, msg_update: ProgressMsgUpdate::NoChange, }; @@ -76,10 +76,10 @@ impl Progress { } CmdProgressUpdate::ResetToPending => { stream::iter(progress_trackers.iter_mut()) - .fold(output, |output, (step_id, progress_tracker)| async move { - let step_id = step_id.clone(); + .fold(output, |output, (item_id, progress_tracker)| async move { + let item_id = item_id.clone(); let progress_update_and_id = ProgressUpdateAndId { - step_id, + item_id, progress_update: ProgressUpdate::ResetToPending, msg_update: ProgressMsgUpdate::Clear, }; @@ -102,14 +102,14 @@ impl Progress { async fn handle_progress_update_and_id( output: &mut O, - progress_trackers: &mut IndexMap, + progress_trackers: &mut IndexMap, progress_update_and_id: ProgressUpdateAndId, ) where O: OutputWrite, { - let step_id = &progress_update_and_id.step_id; - let Some(progress_tracker) = progress_trackers.get_mut(step_id) else { - panic!("Expected `progress_tracker` to exist for step: `{step_id}`."); + let item_id = &progress_update_and_id.item_id; + let Some(progress_tracker) = progress_trackers.get_mut(item_id) else { + panic!("Expected `progress_tracker` to exist for item: `{item_id}`."); }; Self::handle_progress_tracker_progress_update( @@ -128,7 +128,7 @@ impl Progress { O: OutputWrite, { let ProgressUpdateAndId { - step_id: _, + item_id: _, progress_update, msg_update, } = &progress_update_and_id; diff --git a/crate/cmd_rt/src/step_stream_outcome_mapper.rs b/crate/cmd_rt/src/step_stream_outcome_mapper.rs index 163d0e1ad..3e7a55aa4 100644 --- a/crate/cmd_rt/src/step_stream_outcome_mapper.rs +++ b/crate/cmd_rt/src/step_stream_outcome_mapper.rs @@ -1,5 +1,5 @@ use fn_graph::StreamOutcome; -use peace_cmd_model::StepStreamOutcome; +use peace_cmd_model::ItemStreamOutcome; use peace_rt_model::Flow; /// Maps a `StreamOutcome` to a `StepStreamOutcome`. @@ -16,11 +16,11 @@ use peace_rt_model::Flow; /// / v /// rt_model_core /// ``` -pub struct StepStreamOutcomeMapper; +pub struct ItemStreamOutcomeMapper; -impl StepStreamOutcomeMapper { - /// Maps `FnId`s into `StepId`s for a better information abstraction level. - pub fn map(flow: &Flow, stream_outcome: StreamOutcome) -> StepStreamOutcome +impl ItemStreamOutcomeMapper { + /// Maps `FnId`s into `ItemId`s for a better information abstraction level. + pub fn map(flow: &Flow, stream_outcome: StreamOutcome) -> ItemStreamOutcome where E: 'static, { @@ -31,30 +31,30 @@ impl StepStreamOutcomeMapper { fn_ids_not_processed, } = stream_outcome; - let step_ids_processed = fn_ids_processed + let item_ids_processed = fn_ids_processed .into_iter() .filter_map(|fn_id| { flow.graph() .node_weight(fn_id) - .map(|step| step.id()) + .map(|item| item.id()) .cloned() }) .collect::>(); - let step_ids_not_processed = fn_ids_not_processed + let item_ids_not_processed = fn_ids_not_processed .into_iter() .filter_map(|fn_id| { flow.graph() .node_weight(fn_id) - .map(|step| step.id()) + .map(|item| item.id()) .cloned() }) .collect::>(); - StepStreamOutcome { + ItemStreamOutcome { value, state, - step_ids_processed, - step_ids_not_processed, + item_ids_processed, + item_ids_not_processed, } } } diff --git a/crate/code_gen/src/cmd/impl_build.rs b/crate/code_gen/src/cmd/impl_build.rs index 3e1c07a7f..239ef320b 100644 --- a/crate/code_gen/src/cmd/impl_build.rs +++ b/crate/code_gen/src/cmd/impl_build.rs @@ -549,7 +549,7 @@ fn impl_build_for( // .await?; #flow_params_serialize - // Track steps in memory. + // Track items in memory. let mut resources = peace_resources::Resources::new(); // === WorkspaceParamsSelected === // // crate::ctx::cmd_ctx_builder::workspace_params_insert(workspace_params, &mut resources); @@ -600,10 +600,10 @@ fn impl_build_for( // === MultiProfileSingleFlow === // // let flow_id = flow.flow_id(); - // let step_graph = flow.graph(); + // let item_graph = flow.graph(); // // let (params_specs_type_reg, states_type_reg) = - // crate::ctx::cmd_ctx_builder::params_and_states_type_reg(step_graph); + // crate::ctx::cmd_ctx_builder::params_and_states_type_reg(item_graph); // // let params_specs_type_reg_ref = ¶ms_specs_type_reg; // let profile_to_params_specs = futures::stream::iter( @@ -682,20 +682,20 @@ fn impl_build_for( // >() // .await?; // - // // Call each `Step`'s initialization function. - // let resources = crate::ctx::cmd_ctx_builder::step_graph_setup( - // step_graph, + // // Call each `Item`'s initialization function. + // let resources = crate::ctx::cmd_ctx_builder::item_graph_setup( + // item_graph, // resources // ) // .await?; // // === SingleProfileSingleFlow === // - // // Set up resources for the flow's step graph + // // Set up resources for the flow's item graph // let flow_id = flow.flow_id(); - // let step_graph = flow.graph(); + // let item_graph = flow.graph(); // // let (params_specs_type_reg, states_type_reg) = - // crate::ctx::cmd_ctx_builder::params_and_states_type_reg(step_graph); + // crate::ctx::cmd_ctx_builder::params_and_states_type_reg(item_graph); // // // Params specs loading and storage. // let params_specs_type_reg_ref = ¶ms_specs_type_reg; @@ -741,9 +741,9 @@ fn impl_build_for( // resources.insert(states_current_stored); // } // - // // Call each `Step`'s initialization function. - // let resources = crate::ctx::cmd_ctx_builder::step_graph_setup( - // step_graph, + // // Call each `Item`'s initialization function. + // let resources = crate::ctx::cmd_ctx_builder::item_graph_setup( + // item_graph, // resources // ) // .await?; @@ -754,12 +754,12 @@ fn impl_build_for( // let multi_progress = indicatif::MultiProgress::with_draw_target( // indicatif::ProgressDrawTarget::hidden() // ); - // let progress_trackers = step_graph.iter_insertion().fold( - // peace_rt_model::IndexMap::with_capacity(step_graph.node_count()), - // |mut progress_trackers, step| { + // let progress_trackers = item_graph.iter_insertion().fold( + // peace_rt_model::IndexMap::with_capacity(item_graph.node_count()), + // |mut progress_trackers, item| { // let progress_bar = multi_progress.add(indicatif::ProgressBar::hidden()); // let progress_tracker = peace_core::progress::ProgressTracker::new(progress_bar); - // progress_trackers.insert(step.id().clone(), progress_tracker); + // progress_trackers.insert(item.id().clone(), progress_tracker); // progress_trackers // }, // ); @@ -1600,17 +1600,17 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream proc_macro2::TokenStream::new() } Scope::MultiProfileSingleFlow => { - // * Reads previous step params and stores them in a `Map`. + // * Reads previous item params and stores them in a `Map`. // * Reads previously stored current states and stores them in a `Map`. // // These are then held in the scope for easy access for consumers. quote! { let flow_id = flow.flow_id(); - let step_graph = flow.graph(); + let item_graph = flow.graph(); let (params_specs_type_reg, states_type_reg) = - crate::ctx::cmd_ctx_builder::params_and_states_type_reg(step_graph); + crate::ctx::cmd_ctx_builder::params_and_states_type_reg(item_graph); let params_specs_type_reg_ref = ¶ms_specs_type_reg; let profile_to_params_specs = futures::stream::iter( @@ -1689,9 +1689,9 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream >() .await?; - // Call each `Step`'s initialization function. - let resources = crate::ctx::cmd_ctx_builder::step_graph_setup( - step_graph, + // Call each `Item`'s initialization function. + let resources = crate::ctx::cmd_ctx_builder::item_graph_setup( + item_graph, resources ) .await?; @@ -1703,24 +1703,24 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream // // It is not possible to insert stored current states into resources when // running a command with multiple flows, as the flows will have - // different steps and their state (type)s will be different. + // different items and their state (type)s will be different. // // An example is workspace initialization, where the stored current states per - // step for workspace initialization are likely different to application + // item for workspace initialization are likely different to application // specific flows. // // We currently don't support inserting resources for `MultiProfileSingleFlow` // commands. That would require either multiple `Resources` maps, or a // `Resources` map that contains `Map`. // - // It also requires multiple step graph setups to work without conflicting + // It also requires multiple item graph setups to work without conflicting // with each other. quote! { let flow_id = flow.flow_id(); - let step_graph = flow.graph(); + let item_graph = flow.graph(); let (params_specs_type_reg, states_type_reg) = - crate::ctx::cmd_ctx_builder::params_and_states_type_reg(step_graph); + crate::ctx::cmd_ctx_builder::params_and_states_type_reg(item_graph); // Params specs loading and storage. let params_specs_type_reg_ref = ¶ms_specs_type_reg; @@ -1766,9 +1766,9 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream resources.insert(states_current_stored); } - // Call each `Step`'s initialization function. - let resources = crate::ctx::cmd_ctx_builder::step_graph_setup( - step_graph, + // Call each `Item`'s initialization function. + let resources = crate::ctx::cmd_ctx_builder::item_graph_setup( + item_graph, resources ) .await?; @@ -1779,12 +1779,12 @@ fn states_and_params_read_and_pg_init(scope: Scope) -> proc_macro2::TokenStream let multi_progress = indicatif::MultiProgress::with_draw_target( indicatif::ProgressDrawTarget::hidden() ); - let progress_trackers = step_graph.iter_insertion().fold( - peace_rt_model::IndexMap::with_capacity(step_graph.node_count()), - |mut progress_trackers, step| { + let progress_trackers = item_graph.iter_insertion().fold( + peace_rt_model::IndexMap::with_capacity(item_graph.node_count()), + |mut progress_trackers, item| { let progress_bar = multi_progress.add(indicatif::ProgressBar::hidden()); let progress_tracker = peace_core::progress::ProgressTracker::new(progress_bar); - progress_trackers.insert(step.id().clone(), progress_tracker); + progress_trackers.insert(item.id().clone(), progress_tracker); progress_trackers }, ); diff --git a/crate/code_gen/src/cmd/impl_common_fns.rs b/crate/code_gen/src/cmd/impl_common_fns.rs index 99e4af8c6..aaeceb90b 100644 --- a/crate/code_gen/src/cmd/impl_common_fns.rs +++ b/crate/code_gen/src/cmd/impl_common_fns.rs @@ -36,17 +36,17 @@ pub fn impl_common_fns(scope_struct: &ScopeStruct) -> proc_macro2::TokenStream { common_fns.extend(quote! { /// Sets a step's parameters. /// - /// Note: this **must** be called for each step in the flow. - pub fn with_step_params( + /// Note: this **must** be called for each item in the flow. + pub fn with_item_params( mut self, - step_id: peace_cfg::StepId, + item_id: peace_cfg::ItemId, params_spec: as peace_params::Params>::Spec, ) -> Self where - I: peace_cfg::Step, + I: peace_cfg::Item, AppError: From, { - self.scope_builder.params_specs_provided.insert(step_id, params_spec); + self.scope_builder.params_specs_provided.insert(item_id, params_spec); self } }); diff --git a/crate/code_gen/src/cmd/scope.rs b/crate/code_gen/src/cmd/scope.rs index 81b5ddbd9..d40d0578d 100644 --- a/crate/code_gen/src/cmd/scope.rs +++ b/crate/code_gen/src/cmd/scope.rs @@ -6,13 +6,13 @@ use crate::cmd::{FlowCount, ProfileCount}; #[allow(clippy::enum_variant_names)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Scope { - /// A command that works with multiple profiles, not scoped to a flow. + /// A command that works with multiple profiles, without any items. MultiProfileNoFlow, /// A command that works with multiple profiles, and a single flow. MultiProfileSingleFlow, /// A command that only works with workspace parameters. NoProfileNoFlow, - /// A command that works with a single profile, not scoped to a flow. + /// A command that works with a single profile, without any items. SingleProfileNoFlow, /// A command that works with one profile and one flow. SingleProfileSingleFlow, diff --git a/crate/code_gen/src/cmd/struct_definition.rs b/crate/code_gen/src/cmd/struct_definition.rs index 02818ae60..f4b2c53c6 100644 --- a/crate/code_gen/src/cmd/struct_definition.rs +++ b/crate/code_gen/src/cmd/struct_definition.rs @@ -37,7 +37,7 @@ use crate::cmd::scope_struct::ScopeStruct; /// pub(crate) profile_params_selection: CmdCtxBuilderTypesT::ProfileParamsSelection, /// /// Flow parameters. /// pub(crate) flow_params_selection: CmdCtxBuilderTypesT::FlowParamsSelection, -/// /// Map of step ID to its parameters. `TypeMap` newtype. +/// /// Map of item ID to its parameters. `TypeMap` newtype. /// pub(crate) params_specs_provided: peace_params::ParamsSpecs, /// } /// ``` @@ -129,7 +129,7 @@ mod fields { pub fn params_specs_push(fields_named: &mut FieldsNamed, scope: Scope) { if scope.flow_count() == FlowCount::One { let fields_params_specs: FieldsNamed = parse_quote!({ - /// Map of step ID to its parameters. `TypeMap` newtype. + /// Map of item ID to its parameters. `TypeMap` newtype. pub(crate) params_specs_provided: peace_params::ParamsSpecs }); fields_named.named.extend(fields_params_specs.named); diff --git a/crate/core/src/apply_check.rs b/crate/core/src/apply_check.rs index 36c0cc24b..aaa860aa0 100644 --- a/crate/core/src/apply_check.rs +++ b/crate/core/src/apply_check.rs @@ -6,15 +6,15 @@ use crate::progress::ProgressLimit; /// Whether the `apply` function needs to be executed. #[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum ApplyCheck { - /// Step is not in goal state. + /// Item is not in goal state. #[cfg(not(feature = "output_progress"))] ExecRequired, - /// Step is not in goal state. + /// Item is not in goal state. #[cfg(feature = "output_progress")] ExecRequired { /// Unit of measurement and limit to indicate progress. progress_limit: ProgressLimit, }, - /// Step is already in goal state. + /// Item is already in goal state. ExecNotRequired, } diff --git a/crate/core/src/lib.rs b/crate/core/src/lib.rs index 012e5ca9f..333f07cfa 100644 --- a/crate/core/src/lib.rs +++ b/crate/core/src/lib.rs @@ -3,8 +3,8 @@ //! This crate exists because: //! //! * `peace_cfg` has a dependency on `peace_resources` for `Resources`, used in -//! `Step::setup`. -//! * `peace_resources` has a dependency on `StepId`, as uses `TypeMap` for the `States` maps. //! //! When [peace#67] is implemented, the `progress` module can be moved out @@ -13,13 +13,13 @@ //! [peace#67]: https://github.com/azriel91/peace/issues/67 // Re-exports -pub use peace_static_check_macros::{app_name, flow_id, step_id, profile}; +pub use peace_static_check_macros::{app_name, flow_id, item_id, profile}; pub use crate::{ app_name::{AppName, AppNameInvalidFmt}, apply_check::ApplyCheck, flow_id::{FlowId, FlowIdInvalidFmt}, - step_id::{StepId, StepIdInvalidFmt}, + item_id::{ItemId, ItemIdInvalidFmt}, profile::{Profile, ProfileInvalidFmt}, }; @@ -29,7 +29,7 @@ pub mod progress; mod app_name; mod apply_check; mod flow_id; -mod step_id; +mod item_id; mod profile; /// Implements common behaviour for an ID type. diff --git a/crate/core/src/progress/cmd_progress_update.rs b/crate/core/src/progress/cmd_progress_update.rs index 666562988..4f7af6c8b 100644 --- a/crate/core/src/progress/cmd_progress_update.rs +++ b/crate/core/src/progress/cmd_progress_update.rs @@ -7,13 +7,13 @@ use crate::progress::ProgressUpdateAndId; /// This is sent at the `CmdExecution` level. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum CmdProgressUpdate { - /// `ProgressUpdateAndId` for a single step. + /// `ProgressUpdateAndId` for a single item. /// /// # Design Note /// /// This isn't a tuple newtype as `serde_yaml` `0.9` is unable to serialize /// newtype enum variants. - Step { + Item { /// The update. progress_update_and_id: ProgressUpdateAndId, }, @@ -26,7 +26,7 @@ pub enum CmdProgressUpdate { impl From for CmdProgressUpdate { fn from(progress_update_and_id: ProgressUpdateAndId) -> Self { - Self::Step { + Self::Item { progress_update_and_id, } } diff --git a/crate/core/src/progress/progress_complete.rs b/crate/core/src/progress/progress_complete.rs index df190bbd5..867a6bf42 100644 --- a/crate/core/src/progress/progress_complete.rs +++ b/crate/core/src/progress/progress_complete.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; /// * The end user is using invalid values (need for education). /// * The environment is flakey (need for stabilization). /// -/// Ideally [rust#84277] is implemented so `Step` implementations can use +/// Ideally [rust#84277] is implemented so `Item` implementations can use /// `?` when returning each variant. /// /// [rust#84277]: https://github.com/rust-lang/rust/issues/84277 diff --git a/crate/core/src/progress/progress_delta.rs b/crate/core/src/progress/progress_delta.rs index 9fec83207..f847139ac 100644 --- a/crate/core/src/progress/progress_delta.rs +++ b/crate/core/src/progress/progress_delta.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -/// The amount that the step progressed by. +/// The amount that the item progressed by. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum ProgressDelta { /// Ticks the progress bar without incrementing its value. diff --git a/crate/core/src/progress/progress_sender.rs b/crate/core/src/progress/progress_sender.rs index fa6995959..e2294745a 100644 --- a/crate/core/src/progress/progress_sender.rs +++ b/crate/core/src/progress/progress_sender.rs @@ -4,23 +4,23 @@ use crate::{ progress::{ CmdProgressUpdate, ProgressDelta, ProgressMsgUpdate, ProgressUpdate, ProgressUpdateAndId, }, - StepId, + ItemId, }; /// Submits progress for a step's `ApplyFns::exec` method. #[derive(Clone, Copy, Debug)] pub struct ProgressSender<'exec> { - /// ID of the step this belongs to. - step_id: &'exec StepId, + /// ID of the item this belongs to. + item_id: &'exec ItemId, /// Channel sender to send progress updates to. progress_tx: &'exec Sender, } impl<'exec> ProgressSender<'exec> { /// Returns a new `ProgressSender`. - pub fn new(step_id: &'exec StepId, progress_tx: &'exec Sender) -> Self { + pub fn new(item_id: &'exec ItemId, progress_tx: &'exec Sender) -> Self { Self { - step_id, + item_id, progress_tx, } } @@ -29,7 +29,7 @@ impl<'exec> ProgressSender<'exec> { pub fn inc(&self, unit_count: u64, msg_update: ProgressMsgUpdate) { let _progress_send_unused = self.progress_tx.try_send( ProgressUpdateAndId { - step_id: self.step_id.clone(), + item_id: self.item_id.clone(), progress_update: ProgressUpdate::Delta(ProgressDelta::Inc(unit_count)), msg_update, } @@ -48,7 +48,7 @@ impl<'exec> ProgressSender<'exec> { pub fn tick(&self, msg_update: ProgressMsgUpdate) { let _progress_send_unused = self.progress_tx.try_send( ProgressUpdateAndId { - step_id: self.step_id.clone(), + item_id: self.item_id.clone(), progress_update: ProgressUpdate::Delta(ProgressDelta::Tick), msg_update, } @@ -60,7 +60,7 @@ impl<'exec> ProgressSender<'exec> { pub fn reset(&self) { let _progress_send_unused = self.progress_tx.try_send( ProgressUpdateAndId { - step_id: self.step_id.clone(), + item_id: self.item_id.clone(), progress_update: ProgressUpdate::Reset, msg_update: ProgressMsgUpdate::Clear, } @@ -72,7 +72,7 @@ impl<'exec> ProgressSender<'exec> { pub fn reset_to_pending(&self) { let _progress_send_unused = self.progress_tx.try_send( ProgressUpdateAndId { - step_id: self.step_id.clone(), + item_id: self.item_id.clone(), progress_update: ProgressUpdate::ResetToPending, msg_update: ProgressMsgUpdate::Clear, } diff --git a/crate/core/src/progress/progress_status.rs b/crate/core/src/progress/progress_status.rs index c4dc1e02e..212bcef47 100644 --- a/crate/core/src/progress/progress_status.rs +++ b/crate/core/src/progress/progress_status.rs @@ -27,11 +27,11 @@ use crate::progress::ProgressComplete; /// be `Copy` -- not sure yet. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum ProgressStatus { - /// This step is registered for execution. + /// This item is registered for execution. /// /// This status is used when we don't know the progress limit. Initialized, - /// The step was waiting for execution, when the command was interrupted. + /// The item was waiting for execution, when the command was interrupted. Interrupted, /// Execution has not yet begun. /// @@ -40,8 +40,8 @@ pub enum ProgressStatus { /// * The framework to begin executing the logic. /// * A predecessor's execution completion. ExecPending, - /// Execution has started for this step, but we haven't received - /// `ProgressDelta` update from the step exec logic. + /// Execution has started for this item, but we haven't received + /// `ProgressDelta` update from the item exec logic. Queued, /// Execution is in progress. /// @@ -49,7 +49,7 @@ pub enum ProgressStatus { /// /// * **Units total:** Unknown (spinner) / known (progress bar). /// * **Units current** - /// * **Function:** `Step::{state_current, state_goal, apply}`. + /// * **Function:** `Item::{state_current, state_goal, apply}`. /// /// Certain functions will not be applicable, e.g. when `StateCurrent` /// is feature gated, then the function won't be available when the @@ -57,7 +57,7 @@ pub enum ProgressStatus { Running, /// Progress updates have not been received for a given period. /// - /// Step implementations are responsible for sending progress updates, + /// Item implementations are responsible for sending progress updates, /// but if there are no progress updates, or an identical "it's running" /// progress update is continuously received, then Peace may determine that /// the task may have stalled, and user attention is required. @@ -72,6 +72,6 @@ pub enum ProgressStatus { /// This status is best conveyed alongside additional information: /// /// * **Completion Status**: Success, Failed. - /// * **Function:** `Step::{state_current, state_goal, apply}`. + /// * **Function:** `Item::{state_current, state_goal, apply}`. Complete(ProgressComplete), } diff --git a/crate/core/src/progress/progress_tracker.rs b/crate/core/src/progress/progress_tracker.rs index 559eccb3d..a213d299e 100644 --- a/crate/core/src/progress/progress_tracker.rs +++ b/crate/core/src/progress/progress_tracker.rs @@ -8,7 +8,7 @@ use crate::progress::{ProgressLimit, ProgressStatus}; /// Tracks progress for a step's `ApplyFns::exec` method. #[derive(Debug)] pub struct ProgressTracker { - /// Status of the step's execution progress. + /// Status of the item's execution progress. progress_status: ProgressStatus, /// Internal progress bar to update. progress_bar: ProgressBar, diff --git a/crate/core/src/progress/progress_update_and_id.rs b/crate/core/src/progress/progress_update_and_id.rs index b5607c139..7d34a43c5 100644 --- a/crate/core/src/progress/progress_update_and_id.rs +++ b/crate/core/src/progress/progress_update_and_id.rs @@ -2,14 +2,14 @@ use serde::{Deserialize, Serialize}; use crate::{ progress::{ProgressMsgUpdate, ProgressUpdate}, - StepId, + ItemId, }; -/// An step ID and its progress update. +/// An item ID and its progress update. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub struct ProgressUpdateAndId { - /// ID of the step whose progress is updated. - pub step_id: StepId, + /// ID of the item whose progress is updated. + pub item_id: ItemId, /// Delta update for the progress tracker. pub progress_update: ProgressUpdate, /// Whether to change the progress message. diff --git a/crate/core/src/step_id.rs b/crate/core/src/step_id.rs index f3d89e42c..ac82feb2b 100644 --- a/crate/core/src/step_id.rs +++ b/crate/core/src/step_id.rs @@ -9,21 +9,21 @@ use serde::{Deserialize, Serialize}; /// /// # Examples /// -/// The following are all examples of valid `StepId`s: +/// The following are all examples of valid `ItemId`s: /// /// ```rust -/// # use peace_core::{step_id, StepId}; +/// # use peace_core::{item_id, ItemId}; /// # -/// let _snake = step_id!("snake_case"); -/// let _camel = step_id!("camelCase"); -/// let _pascal = step_id!("PascalCase"); +/// let _snake = item_id!("snake_case"); +/// let _camel = item_id!("camelCase"); +/// let _pascal = item_id!("PascalCase"); /// ``` /// /// # Design Note /// /// TODO: Experiment with upgrades. /// -/// For backward compatibility and migrating steps from old IDs to new IDs, e.g. +/// For backward compatibility and migrating items from old IDs to new IDs, e.g. /// when they were deployed with an old version of the automation software, /// there needs to be a way to: /// @@ -31,8 +31,8 @@ use serde::{Deserialize, Serialize}; /// * Either clean up that state, or migrate that state into a Step with the /// new ID. /// -/// [`Step`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Step.html +/// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html #[derive(Clone, Debug, Hash, PartialEq, Eq, Deserialize, Serialize)] -pub struct StepId(Cow<'static, str>); +pub struct ItemId(Cow<'static, str>); -crate::id_newtype!(StepId, StepIdInvalidFmt, step_id, code_inline); +crate::id_newtype!(ItemId, ItemIdInvalidFmt, item_id, code_inline); diff --git a/crate/data/src/accessors.rs b/crate/data/src/accessors.rs index 7ee8fb1e4..07890eedc 100644 --- a/crate/data/src/accessors.rs +++ b/crate/data/src/accessors.rs @@ -9,7 +9,7 @@ //! * `ROpt<'_, T>`: Immutable access to an `Option` resource. //! * `WOpt<'_, T>`: Mutable access to an `Option` resource. //! -//! Notably if you want to insert a resource during step execution, you +//! Notably if you want to insert a resource during item execution, you //! should use `WOpt` instead of `WMaybe`, and correspondingly read it using //! `ROpt`. pub use self::{r_maybe::RMaybe, r_opt::ROpt, w_maybe::WMaybe, w_opt::WOpt}; diff --git a/crate/data/src/accessors/r_maybe.rs b/crate/data/src/accessors/r_maybe.rs index 68c855e12..e21ea9a1f 100644 --- a/crate/data/src/accessors/r_maybe.rs +++ b/crate/data/src/accessors/r_maybe.rs @@ -4,7 +4,7 @@ use fn_graph::{ resman::{BorrowFail, Ref}, DataAccess, DataAccessDyn, Resources, TypeIds, }; -use peace_core::StepId; +use peace_core::ItemId; use crate::Data; @@ -42,7 +42,7 @@ impl<'borrow, T> Data<'borrow> for RMaybe<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(_step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { + fn borrow(_item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { resources .try_borrow::() .map_err(|borrow_fail| match borrow_fail { diff --git a/crate/data/src/accessors/w_maybe.rs b/crate/data/src/accessors/w_maybe.rs index 8ecaebd14..13d06d8c3 100644 --- a/crate/data/src/accessors/w_maybe.rs +++ b/crate/data/src/accessors/w_maybe.rs @@ -4,7 +4,7 @@ use fn_graph::{ resman::{BorrowFail, RefMut}, DataAccess, DataAccessDyn, Resources, TypeIds, }; -use peace_core::StepId; +use peace_core::ItemId; use crate::Data; @@ -51,7 +51,7 @@ impl<'borrow, T> Data<'borrow> for WMaybe<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(_step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { + fn borrow(_item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { resources .try_borrow_mut::() .map_err(|borrow_fail| match borrow_fail { diff --git a/crate/data/src/data.rs b/crate/data/src/data.rs index 76d9f4cca..15ff4f6e7 100644 --- a/crate/data/src/data.rs +++ b/crate/data/src/data.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; use fn_graph::{DataAccess, DataAccessDyn, DataBorrow, Resources, R, W}; -use peace_core::StepId; +use peace_core::ItemId; /// Defines the logic to instantiate and retrieve runtime data. /// @@ -13,23 +13,23 @@ use peace_core::StepId; pub trait Data<'borrow>: DataAccess + DataAccessDyn + Send { /// Borrows each of `Self`'s fields from the provided [`Resources`]. /// - /// This takes in the `step_id`, so that the type that implements this + /// This takes in the `item_id`, so that the type that implements this /// trait may further filter specific data within the borrowed data, scope - /// to the step. + /// to the item. /// /// # Parameters /// - /// * `step_id`: ID of the step this borrow is used for. + /// * `item_id`: ID of the item this borrow is used for. /// * `resources`: `Any` map to borrow the data from. - fn borrow(step_id: &'borrow StepId, resources: &'borrow Resources) -> Self; + fn borrow(item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self; } impl<'borrow> Data<'borrow> for () { - fn borrow(_step_id: &'borrow StepId, _resources: &'borrow Resources) -> Self {} + fn borrow(_item_id: &'borrow ItemId, _resources: &'borrow Resources) -> Self {} } impl<'borrow> Data<'borrow> for &'borrow () { - fn borrow(_step_id: &'borrow StepId, _resources: &'borrow Resources) -> Self { + fn borrow(_item_id: &'borrow ItemId, _resources: &'borrow Resources) -> Self { &() } } @@ -38,7 +38,7 @@ impl<'borrow, T> Data<'borrow> for R<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(_step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { + fn borrow(_item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { ::borrow(resources) } } @@ -47,7 +47,7 @@ impl<'borrow, T> Data<'borrow> for W<'borrow, T> where T: Debug + Send + Sync + 'static, { - fn borrow(_step_id: &'borrow StepId, resources: &'borrow Resources) -> Self { + fn borrow(_item_id: &'borrow ItemId, resources: &'borrow Resources) -> Self { ::borrow(resources) } } diff --git a/crate/data/src/marker.rs b/crate/data/src/marker.rs index 9808c1c83..25ce33224 100644 --- a/crate/data/src/marker.rs +++ b/crate/data/src/marker.rs @@ -1,9 +1,9 @@ //! Markers for `State`s inserted into `Resources`. //! -//! For `SingleProfileSingleFlow` commands, `Current(None)` and -//! `Goal(None)` are inserted into `Resources` when the +//! For `SingleProfileSingleFlow` commands, `Current(None)` and +//! `Goal(None)` are inserted into `Resources` when the //! command context is built, and automatically mutated to `Some` when either -//! `Step::state_current` or `Step::state_goal` is executed. +//! `Item::state_current` or `Item::state_goal` is executed. // Corresponds to variants in `crate/params/src/value_resolution_mode.rs`. // Remember to update there when updating here. diff --git a/crate/data/src/marker/apply_dry.rs b/crate/data/src/marker/apply_dry.rs index fcd701a26..5e3d1d1dc 100644 --- a/crate/data/src/marker/apply_dry.rs +++ b/crate/data/src/marker/apply_dry.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// An `ApplyDry` is set to `Some` whenever a step is dry applied, +/// An `ApplyDry` is set to `Some` whenever a step is dry applied, /// enabling a subsequent successor's params to access that value when the /// successor's `apply_dry` function is run. /// diff --git a/crate/data/src/marker/clean.rs b/crate/data/src/marker/clean.rs index dafc72a1c..bf8c4defb 100644 --- a/crate/data/src/marker/clean.rs +++ b/crate/data/src/marker/clean.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Clean` is set to `Some` whenever a step's clean state is +/// A `Clean` is set to `Some` whenever a step's clean state is /// needed, e.g. preparing for applying the clean state. enabling a subsequent /// successor's params to access that value when the successor's `state_clean` /// function is run. diff --git a/crate/data/src/marker/current.rs b/crate/data/src/marker/current.rs index 4bf9e6560..707df55fb 100644 --- a/crate/data/src/marker/current.rs +++ b/crate/data/src/marker/current.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Current` is set to `Some` whenever a step's current state +/// A `Current` is set to `Some` whenever a step's current state /// is discovered. enabling a subsequent successor's params to access that value /// when the successor's **goal** state function is run. /// diff --git a/crate/data/src/marker/goal.rs b/crate/data/src/marker/goal.rs index 7aad0caa6..6ba975021 100644 --- a/crate/data/src/marker/goal.rs +++ b/crate/data/src/marker/goal.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; /// This is used for referential param values, where a step param value is /// dependent on the state of a predecessor's state. /// -/// A `Goal` is set to `Some` whenever a step's goal state +/// A `Goal` is set to `Some` whenever a step's goal state /// is discovered. enabling a subsequent successor's params to access that value /// when the successor's goal state function is run. /// diff --git a/crate/data_derive/src/lib.rs b/crate/data_derive/src/lib.rs index 2828f8583..05091fe23 100644 --- a/crate/data_derive/src/lib.rs +++ b/crate/data_derive/src/lib.rs @@ -121,7 +121,7 @@ fn impl_data_access(ast: &DeriveInput) -> proc_macro2::TokenStream { for #name #ty_generics #where_clause { - fn borrow(step_id: & #impl_borrow_lt #peace_cfg_path::StepId, resources: & #impl_borrow_lt #peace_data_path::Resources) -> Self { + fn borrow(item_id: & #impl_borrow_lt #peace_cfg_path::ItemId, resources: & #impl_borrow_lt #peace_data_path::Resources) -> Self { #borrow_return } } @@ -185,7 +185,7 @@ fn data_borrow_impl<'ast>( let borrow_return = quote! { #name { - #( #field_names_tokens: Data::borrow(step_id, resources) ),* + #( #field_names_tokens: Data::borrow(item_id, resources) ),* #(, #phantom_data_fields: ::std::marker::PhantomData)* } }; @@ -199,7 +199,7 @@ fn data_borrow_impl<'ast>( .map(|n| quote!(#n)) .collect::>(); - let borrow = vec![quote! { Data::borrow(step_id, resources) }; count]; + let borrow = vec![quote! { Data::borrow(item_id, resources) }; count]; let borrow_return = quote! { #name ( #( #borrow ),* ) }; diff --git a/crate/flow_model/src/flow_info.rs b/crate/flow_model/src/flow_info.rs index 2880598af..7ae0728cb 100644 --- a/crate/flow_model/src/flow_info.rs +++ b/crate/flow_model/src/flow_info.rs @@ -3,11 +3,11 @@ use peace_core::FlowId; use serde::{Deserialize, Serialize}; -use crate::StepInfo; +use crate::ItemInfo; /// Serializable representation of values in a [`Flow`]. /// -/// This includes values passed into, or produced by `Step`s in the `Flow`. +/// This includes values passed into, or produced by `Item`s in the `Flow`. /// /// [`Flow`]: https://docs.rs/peace_rt_model/latest/peace_rt_model/struct.Flow.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] @@ -15,12 +15,12 @@ pub struct FlowInfo { /// ID of the flow. pub flow_id: FlowId, /// Serialized representation of the flow graph. - pub graph_info: GraphInfo, + pub graph_info: GraphInfo, } impl FlowInfo { /// Returns a new `FlowInfo`. - pub fn new(flow_id: FlowId, graph_info: GraphInfo) -> Self { + pub fn new(flow_id: FlowId, graph_info: GraphInfo) -> Self { Self { flow_id, graph_info, diff --git a/crate/flow_model/src/flow_spec_info.rs b/crate/flow_model/src/flow_spec_info.rs index e7488f4b0..f630b52d2 100644 --- a/crate/flow_model/src/flow_spec_info.rs +++ b/crate/flow_model/src/flow_spec_info.rs @@ -9,7 +9,7 @@ use peace_core::FlowId; use serde::{Deserialize, Serialize}; -use crate::StepSpecInfo; +use crate::ItemSpecInfo; /// Serializable representation of how a [`Flow`] is configured. /// @@ -19,12 +19,12 @@ pub struct FlowSpecInfo { /// ID of the flow. pub flow_id: FlowId, /// Serialized representation of the flow graph. - pub graph_info: GraphInfo, + pub graph_info: GraphInfo, } impl FlowSpecInfo { /// Returns a new `FlowSpecInfo`. - pub fn new(flow_id: FlowId, graph_info: GraphInfo) -> Self { + pub fn new(flow_id: FlowId, graph_info: GraphInfo) -> Self { Self { flow_id, graph_info, @@ -35,12 +35,12 @@ impl FlowSpecInfo { /// execution. pub fn to_progress_info_graph(&self) -> InfoGraph { let graph_info = &self.graph_info; - let step_count = graph_info.node_count(); + let item_count = graph_info.node_count(); let hierarchy = graph_info.iter_insertion_with_indices().fold( - NodeHierarchy::with_capacity(step_count), - |mut hierarchy, (_node_index, step_spec_info)| { - let node_id = step_spec_info_to_node_id(step_spec_info); + NodeHierarchy::with_capacity(item_count), + |mut hierarchy, (_node_index, item_spec_info)| { + let node_id = item_spec_info_to_node_id(item_spec_info); // Progress nodes have no nested nodes. hierarchy.insert(node_id, NodeHierarchy::new()); hierarchy @@ -62,15 +62,15 @@ impl FlowSpecInfo { /// execution. pub fn to_outcome_info_graph(&self) -> InfoGraph { let graph_info = &self.graph_info; - let step_count = graph_info.node_count(); + let item_count = graph_info.node_count(); - let mut visited = HashSet::with_capacity(step_count); + let mut visited = HashSet::with_capacity(item_count); let visited = &mut visited; let hierarchy = graph_info .iter_insertion_with_indices() - .filter_map(|(node_index, step_spec_info)| { + .filter_map(|(node_index, item_spec_info)| { let node_hierarchy = outcome_node_hierarchy(graph_info, visited, node_index); - let node_id = step_spec_info_to_node_id(step_spec_info); + let node_id = item_spec_info_to_node_id(item_spec_info); node_hierarchy.map(|node_hierarchy| (node_id, node_hierarchy)) }) .fold( @@ -96,7 +96,7 @@ impl FlowSpecInfo { /// Returns a `NodeHierarchy` for the given node, if it has not already been /// visited. fn outcome_node_hierarchy( - graph_info: &GraphInfo, + graph_info: &GraphInfo, visited: &mut HashSet, node_index: FnId, ) -> Option { @@ -120,18 +120,18 @@ fn outcome_node_hierarchy( // * Host machines: // // A file transfer would have a source host, source path, dest host, dest - // path, and these exist in the same Step's parameters. + // path, and these exist in the same Item's parameters. // // * Physical nesting: // // - Configuration that lives inside a server. // - Cloud resource that lives inside a subnet. // - // Should this be provided by the step or tool developer? + // Should this be provided by the item or tool developer? // - // Probably the step. The step knows its parameters (which may be mapped - // from other steps' state), so the containment is returned based on the - // step knowing its parent container is from a source / destination + // Probably the item. The item knows its parameters (which may be mapped + // from other items' state), so the containment is returned based on the + // item knowing its parent container is from a source / destination // parameter. if matches!( graph_info.edge_weight(edge_index).copied(), @@ -146,9 +146,9 @@ fn outcome_node_hierarchy( if let Some(child_node_hierarchy) = outcome_node_hierarchy(graph_info, visited, child_node_index) { - let step_spec_info = &graph_info[child_node_index]; + let item_spec_info = &graph_info[child_node_index]; hierarchy.insert( - step_spec_info_to_node_id(step_spec_info), + item_spec_info_to_node_id(item_spec_info), child_node_hierarchy, ); } @@ -157,11 +157,11 @@ fn outcome_node_hierarchy( Some(hierarchy) } -/// Returns the list of edges between steps in the graph. -fn outcome_node_edges(graph_info: &GraphInfo) -> Edges { +/// Returns the list of edges between items in the graph. +fn outcome_node_edges(graph_info: &GraphInfo) -> Edges { graph_info.iter_insertion_with_indices().fold( Edges::with_capacity(graph_info.node_count()), - |mut edges, (node_index, step_spec_info)| { + |mut edges, (node_index, item_spec_info)| { // let children = graph_info.children(node_index); children @@ -181,14 +181,14 @@ fn outcome_node_edges(graph_info: &GraphInfo) -> Edges { } }) .for_each(|child_node_index| { - let step_id = step_spec_info_to_node_id(step_spec_info); - let child_step_id = step_spec_info_to_node_id(&graph_info[child_node_index]); + let item_id = item_spec_info_to_node_id(item_spec_info); + let child_item_id = item_spec_info_to_node_id(&graph_info[child_node_index]); edges.insert( - EdgeId::try_from(format!("{step_id}__{child_step_id}")).expect( - "Expected `peace` `StepId`s concatenated \ + EdgeId::try_from(format!("{item_id}__{child_item_id}")).expect( + "Expected `peace` `ItemId`s concatenated \ to be valid `dot_ix` `EdgeId`s.", ), - [step_id, child_step_id], + [item_id, child_item_id], ); }); @@ -197,15 +197,15 @@ fn outcome_node_edges(graph_info: &GraphInfo) -> Edges { ) } -/// Returns the list of edges between steps in the graph for progress. +/// Returns the list of edges between items in the graph for progress. /// /// For progress graphs, an edge is rendered between pairs of predecessor and -/// successor steps, regardless of whether their dependency is `Edge::Logic` +/// successor items, regardless of whether their dependency is `Edge::Logic` /// (adjacent) or `Edge::Contains` (nested). -fn progress_node_edges(graph_info: &GraphInfo) -> Edges { +fn progress_node_edges(graph_info: &GraphInfo) -> Edges { graph_info.iter_insertion_with_indices().fold( Edges::with_capacity(graph_info.node_count()), - |mut edges, (node_index, step_spec_info)| { + |mut edges, (node_index, item_spec_info)| { // let children = graph_info.children(node_index); children @@ -228,14 +228,14 @@ fn progress_node_edges(graph_info: &GraphInfo) -> Edges { } }) .for_each(|child_node_index| { - let step_id = step_spec_info_to_node_id(step_spec_info); - let child_step_id = step_spec_info_to_node_id(&graph_info[child_node_index]); + let item_id = item_spec_info_to_node_id(item_spec_info); + let child_item_id = item_spec_info_to_node_id(&graph_info[child_node_index]); edges.insert( - EdgeId::try_from(format!("{step_id}__{child_step_id}")).expect( - "Expected `peace` `StepId`s concatenated \ + EdgeId::try_from(format!("{item_id}__{child_item_id}")).expect( + "Expected `peace` `ItemId`s concatenated \ to be valid `dot_ix` `EdgeId`s.", ), - [step_id, child_step_id], + [item_id, child_item_id], ); }); @@ -244,24 +244,24 @@ fn progress_node_edges(graph_info: &GraphInfo) -> Edges { ) } -/// Returns the list of edges between steps in the graph. -fn node_names(graph_info: &GraphInfo) -> NodeNames { +/// Returns the list of edges between items in the graph. +fn node_names(graph_info: &GraphInfo) -> NodeNames { graph_info.iter_insertion_with_indices().fold( NodeNames::with_capacity(graph_info.node_count()), - |mut node_names, (_node_index, step_spec_info)| { - let step_id = step_spec_info_to_node_id(step_spec_info); + |mut node_names, (_node_index, item_spec_info)| { + let item_id = item_spec_info_to_node_id(item_spec_info); // Note: This does not have to be the ID, it can be a human readable name. - let node_name = step_id.to_string(); + let node_name = item_id.to_string(); - node_names.insert(step_id, node_name); + node_names.insert(item_id, node_name); node_names }, ) } -fn step_spec_info_to_node_id(step_spec_info: &StepSpecInfo) -> NodeId { - NodeId::try_from(step_spec_info.step_id.to_string()) - .expect("Expected `peace` `StepId`s to be valid `dot_ix` `NodeId`s.`") +fn item_spec_info_to_node_id(item_spec_info: &ItemSpecInfo) -> NodeId { + NodeId::try_from(item_spec_info.item_id.to_string()) + .expect("Expected `peace` `ItemId`s to be valid `dot_ix` `NodeId`s.`") } diff --git a/crate/flow_model/src/lib.rs b/crate/flow_model/src/lib.rs index 38e361464..971056353 100644 --- a/crate/flow_model/src/lib.rs +++ b/crate/flow_model/src/lib.rs @@ -8,11 +8,11 @@ pub use dot_ix; pub use fn_graph::GraphInfo; pub use crate::{ - flow_info::FlowInfo, flow_spec_info::FlowSpecInfo, step_info::StepInfo, - step_spec_info::StepSpecInfo, + flow_info::FlowInfo, flow_spec_info::FlowSpecInfo, item_info::ItemInfo, + item_spec_info::ItemSpecInfo, }; mod flow_info; mod flow_spec_info; -mod step_info; -mod step_spec_info; +mod item_info; +mod item_spec_info; diff --git a/crate/flow_model/src/step_info.rs b/crate/flow_model/src/step_info.rs index 48d18e94b..c58ffe246 100644 --- a/crate/flow_model/src/step_info.rs +++ b/crate/flow_model/src/step_info.rs @@ -1,18 +1,18 @@ -use peace_core::StepId; +use peace_core::ItemId; use serde::{Deserialize, Serialize}; /// Serializable representation of values used for / produced by a [`Step`]. /// -/// [`Step`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Step.html +/// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct StepInfo { - /// ID of the `Step`. - pub step_id: StepId, +pub struct ItemInfo { + /// ID of the `Item`. + pub item_id: ItemId, } -impl StepInfo { - /// Returns a new `StepInfo`. - pub fn new(step_id: StepId) -> Self { - Self { step_id } +impl ItemInfo { + /// Returns a new `ItemInfo`. + pub fn new(item_id: ItemId) -> Self { + Self { item_id } } } diff --git a/crate/flow_model/src/step_spec_info.rs b/crate/flow_model/src/step_spec_info.rs index 6129eede4..21cf029df 100644 --- a/crate/flow_model/src/step_spec_info.rs +++ b/crate/flow_model/src/step_spec_info.rs @@ -1,18 +1,18 @@ -use peace_core::StepId; +use peace_core::ItemId; use serde::{Deserialize, Serialize}; /// Serializable representation of how a [`Step`] is configured. /// -/// [`Step`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Step.html +/// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct StepSpecInfo { - /// ID of the `Step`. - pub step_id: StepId, +pub struct ItemSpecInfo { + /// ID of the `Item`. + pub item_id: ItemId, } -impl StepSpecInfo { - /// Returns a new `StepSpecInfo`. - pub fn new(step_id: StepId) -> Self { - Self { step_id } +impl ItemSpecInfo { + /// Returns a new `ItemSpecInfo`. + pub fn new(item_id: ItemId) -> Self { + Self { item_id } } } diff --git a/crate/fmt/src/lib.rs b/crate/fmt/src/lib.rs index d1c4511f8..44c53275c 100644 --- a/crate/fmt/src/lib.rs +++ b/crate/fmt/src/lib.rs @@ -24,7 +24,7 @@ mod presenter; /// ```rust,ignore /// use peace_fmt::{present, Presentable}; /// -/// present!(output, "a str", step, "\n"); +/// present!(output, "a str", item, "\n"); /// ``` #[macro_export] macro_rules! present { @@ -40,7 +40,7 @@ macro_rules! present { /// ```rust,ignore /// use peace_fmt::{present, Presentable}; /// -/// presentln!(output, "a str", step, "\n"); +/// presentln!(output, "a str", item, "\n"); /// ``` #[macro_export] macro_rules! presentln { diff --git a/crate/fmt/src/presentable.rs b/crate/fmt/src/presentable.rs index f1a555446..adf522a5d 100644 --- a/crate/fmt/src/presentable.rs +++ b/crate/fmt/src/presentable.rs @@ -48,7 +48,7 @@ mod tuple_impl; /// /// # Examples /// -/// Presenting a list step with a name and value: +/// Presenting a list item with a name and value: /// /// ```rust /// # use peace_fmt::{Presentable, Presenter}; @@ -56,13 +56,13 @@ mod tuple_impl; /// // use peace::fmt::{Presentable, Presenter}; /// /// #[derive(Clone, Deserialize, Serialize)] -/// struct Step { +/// struct Item { /// name: String, /// desc: String, /// } /// /// #[async_trait::async_trait(?Send)] -/// impl Presentable for Step { +/// impl Presentable for Item { /// async fn present<'output, PR>(&self, presenter: &mut PR) -> Result<(), PR::Error> /// where /// PR: Presenter<'output>, diff --git a/crate/fmt/src/presenter.rs b/crate/fmt/src/presenter.rs index d14baadfe..1b761ba1d 100644 --- a/crate/fmt/src/presenter.rs +++ b/crate/fmt/src/presenter.rs @@ -54,14 +54,14 @@ pub trait Presenter<'output> { /// /// # Purposes /// - /// * An ID with no spaces, e.g. "my_step" + /// * An ID with no spaces, e.g. "my_item" async fn id(&mut self, id: &str) -> Result<(), Self::Error>; /// Presents text as a step name. /// /// # Purposes /// - /// * A display name with spaces, e.g. "My Step" + /// * A display name with spaces, e.g. "My Item" async fn name(&mut self, name: &str) -> Result<(), Self::Error>; /// Presents text as plain text. @@ -95,7 +95,7 @@ pub trait Presenter<'output> { /// /// # Purposes /// - /// * A list of items. + /// * A list of steps. async fn list_numbered<'f, P, I>(&mut self, iter: I) -> Result<(), Self::Error> where P: Presentable + ?Sized + 'f, @@ -106,7 +106,7 @@ pub trait Presenter<'output> { /// /// # Purposes /// - /// * A list of items. + /// * A list of steps. async fn list_numbered_with<'f, P, I, T, F>( &mut self, iter: I, diff --git a/crate/params/src/any_spec_rt.rs b/crate/params/src/any_spec_rt.rs index 4b4375955..b25245fce 100644 --- a/crate/params/src/any_spec_rt.rs +++ b/crate/params/src/any_spec_rt.rs @@ -3,7 +3,7 @@ use crate::AnySpecDataType; /// Runtime logic of how to look up values for each field in this struct. /// /// This trait is automatically implemented by `#[derive(Params)]` on an -/// `Step::Params`, as well as in the `peace_params` crate for standard +/// `Item::Params`, as well as in the `peace_params` crate for standard /// library types. pub trait AnySpecRt { /// Whether this `Spec` is usable to resolve values. @@ -17,7 +17,7 @@ pub trait AnySpecRt { /// /// This means where `self` is `Self::Value`, `Self::InMemory`, /// `Self::MappingFn`, and `Self::FieldWise`, these would take priority over - /// any stored spec values. + /// any stored item variants. /// /// For `Self::FieldWise`, a recursive merge would happen per field /// `ValueSpec`. diff --git a/crate/params/src/field_wise_spec_rt.rs b/crate/params/src/field_wise_spec_rt.rs index 64c5b2dfc..0a84bcca8 100644 --- a/crate/params/src/field_wise_spec_rt.rs +++ b/crate/params/src/field_wise_spec_rt.rs @@ -8,7 +8,7 @@ use crate::{AnySpecRt, ParamsResolveError, ValueResolutionCtx}; /// Runtime logic of how to look up values for each field in this struct. /// /// This trait is automatically implemented by `#[derive(Params)]` on an -/// `Step::Params`, as well as manual implementations for standard library +/// `Item::Params`, as well as manual implementations for standard library /// types. pub trait FieldWiseSpecRt: AnySpecRt { /// The original value type. `MyParamsFieldWiseSpec::ValueType` is @@ -17,7 +17,7 @@ pub trait FieldWiseSpecRt: AnySpecRt { /// The `Params` type, but with each of its fields wrapped in `Option`. type Partial: Clone + Debug + Default + Serialize + DeserializeOwned + Send + Sync + 'static; - /// Resolves the values to construct the step `Params`. + /// Resolves the values to construct the item `Params`. /// /// This function returns an error if any value is not present in /// [`Resources`]. For cases where missing values are not an error, see @@ -29,7 +29,7 @@ pub trait FieldWiseSpecRt: AnySpecRt { resources: &Resources, value_resolution_ctx: &mut ValueResolutionCtx, ) -> Result; - /// Resolves the values to construct the step `Params`. + /// Resolves the values to construct the item `Params`. /// /// Values that are not present in `Resources` will be `None`. fn resolve_partial( diff --git a/crate/params/src/lib.rs b/crate/params/src/lib.rs index b3196ffcd..fce5e15d7 100644 --- a/crate/params/src/lib.rs +++ b/crate/params/src/lib.rs @@ -4,12 +4,12 @@ //! framework. //! //! This crate defines types and traits for implementors and users to work with -//! step params. +//! item params. //! //! # Design //! //! When a step is defined, implementors define the parameters type for -//! that step. +//! that item. //! //! For Peace to derive additional functionality from that type, this crate: //! @@ -37,20 +37,20 @@ //! : : '----------------------------' : : //! : : : : //! : : .-------------------. : : -//! : : | struct MyStep; | : : +//! : : | struct MyItem; | : : //! : : | | : ---. : -//! : : | impl Step for | : | : -//! : : | MyStep { | : | : +//! : : | impl Item for | : | : +//! : : | MyItem { | : | : //! : : | type Params = | : ' : //! : : | MyParams; | : exposes API : //! : : | } | : with constraints : //! : : '-------------------' : from : -//! : : : : //! : | cmd_ctx_builder | : : . : -//! : | .with_step_params | <-------------------------------------' : +//! : | .with_item_params | <-------------------------------------' : //! : | ::( | : : : -//! : | step_id, | : : : +//! : | item_id, | : : : //! : | my_p_spec_builder | : : : //! : | .with_f(123) | : : : //! : | .with_from(..) | : : : diff --git a/crate/params/src/mapping_fn_impl.rs b/crate/params/src/mapping_fn_impl.rs index a1f7befd6..a77966b06 100644 --- a/crate/params/src/mapping_fn_impl.rs +++ b/crate/params/src/mapping_fn_impl.rs @@ -315,7 +315,7 @@ macro_rules! arg_resolve { // Either: // // * `A0` in the function is incorrect, so `Current` is not registered by any - // step, or + // item, or // * There is a bug in Peace. BorrowFail::ValueNotFound => match borrow_direct { Ok(arg) => BorrowedData::Direct(arg), @@ -323,7 +323,7 @@ macro_rules! arg_resolve { // Either: // // * `A0` in the function is incorrect, so `Current` is not registered - // by any step, or + // by any item, or // * There is a bug in Peace. BorrowFail::ValueNotFound => { return Err(ParamsResolveError::FromMap { @@ -380,7 +380,7 @@ macro_rules! try_arg_resolve { // Either: // // * `A0` in the function is incorrect, so `Current` is not registered by any - // step, or + // item, or // * There is a bug in Peace. BorrowFail::ValueNotFound => match borrow_direct { Ok(arg) => BorrowedData::Direct(arg), @@ -388,7 +388,7 @@ macro_rules! try_arg_resolve { // Either: // // * `A0` in the function is incorrect, so `Current` is not registered - // by any step, or + // by any item, or // * There is a bug in Peace. BorrowFail::ValueNotFound => return Ok(None), BorrowFail::BorrowConflictImm | BorrowFail::BorrowConflictMut => { diff --git a/crate/params/src/params_spec.rs b/crate/params/src/params_spec.rs index eb410f15e..d5daa5ef3 100644 --- a/crate/params/src/params_spec.rs +++ b/crate/params/src/params_spec.rs @@ -17,7 +17,7 @@ use crate::{ /// For deserialization: /// /// 1. A `ParamsSpecsTypeReg` is constructed, and deserialization functions are -/// registered from `StepId` to `ParamsSpecDe`, where `F` and `U` +/// registered from `ItemId` to `ParamsSpecDe`, where `F` and `U` /// are derived from the `ValueSpec` provided by the user. /// /// 2. `value_specs.yaml` is deserialized using that type registry. @@ -26,7 +26,7 @@ use crate::{ /// `AnySpecRtBoxed` to be passed around in a `CmdCtx`. /// /// 4. These `AnySpecRtBoxed`s are downcasted back to `ValueSpec` when -/// resolving values for step params and params partials. +/// resolving values for item params and params partials. #[derive(Clone, Serialize, Deserialize)] #[serde(from = "crate::ParamsSpecDe", bound = "T: Params")] pub enum ParamsSpec diff --git a/crate/params/src/params_spec_fieldless.rs b/crate/params/src/params_spec_fieldless.rs index bc2bc5978..7cde56617 100644 --- a/crate/params/src/params_spec_fieldless.rs +++ b/crate/params/src/params_spec_fieldless.rs @@ -17,7 +17,7 @@ use crate::{ /// For deserialization: /// /// 1. A `ParamsSpecsTypeReg` is constructed, and deserialization functions are -/// registered from `StepId` to `ParamsSpecFieldlessDe`, where `F` +/// registered from `ItemId` to `ParamsSpecFieldlessDe`, where `F` /// and `U` are derived from the `ValueSpec` provided by the user. /// /// 2. `value_specs.yaml` is deserialized using that type registry. @@ -27,7 +27,7 @@ use crate::{ /// around in a `CmdCtx`. /// /// 4. These `AnySpecRtBoxed`s are downcasted back to `ParamsSpecFieldless` -/// when resolving values for step params and params partials. +/// when resolving values for item params and params partials. #[derive(Clone, Serialize, Deserialize)] #[serde(from = "crate::ParamsSpecFieldlessDe")] pub enum ParamsSpecFieldless diff --git a/crate/params/src/params_specs.rs b/crate/params/src/params_specs.rs index 398f244ea..56e9a7b10 100644 --- a/crate/params/src/params_specs.rs +++ b/crate/params/src/params_specs.rs @@ -1,32 +1,32 @@ use std::ops::{Deref, DerefMut}; -use peace_core::StepId; +use peace_core::ItemId; use peace_resources::type_reg::untagged::TypeMap; use serde::Serialize; use crate::AnySpecRtBoxed; -/// Map of step ID to its params' specs. `TypeMap` newtype. /// /// The concrete `*ValueSpec` type can be obtained by calling -/// `.get(step_id)` with the correct type: +/// `.get(item_id)` with the correct type: /// /// ```rust,ignore -/// let step_params_spec = MyStepParams::spec().build(); +/// let item_params_spec = MyItemParams::spec().build(); /// let mut params_specs = ParamsSpecs::new(); -/// params_specs.insert(step_id!("my_step"), step_params_spec); +/// params_specs.insert(item_id!("my_item"), item_params_spec); /// /// // later /// -/// let step_params_spec = params_specs.get::(&step_id!("my_step")); +/// let item_params_spec = params_specs.get::(&item_id!("my_item")); /// ``` /// /// The information may not be of the same type across flows, as flows are /// different in what they are doing. #[derive(Clone, Debug, Default, Serialize)] #[serde(transparent)] // Needed to serialize as a map instead of a list. -pub struct ParamsSpecs(TypeMap); +pub struct ParamsSpecs(TypeMap); impl ParamsSpecs { /// Returns a new `ParamsSpecs` map. @@ -44,13 +44,13 @@ impl ParamsSpecs { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } impl Deref for ParamsSpecs { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 @@ -63,8 +63,8 @@ impl DerefMut for ParamsSpecs { } } -impl From> for ParamsSpecs { - fn from(type_map: TypeMap) -> Self { +impl From> for ParamsSpecs { + fn from(type_map: TypeMap) -> Self { Self(type_map) } } diff --git a/crate/params/src/value_resolution_ctx.rs b/crate/params/src/value_resolution_ctx.rs index 91c22f56e..7f9edc240 100644 --- a/crate/params/src/value_resolution_ctx.rs +++ b/crate/params/src/value_resolution_ctx.rs @@ -1,6 +1,6 @@ use std::fmt; -use peace_core::StepId; +use peace_core::ItemId; use crate::{FieldNameAndType, ValueResolutionMode}; @@ -10,9 +10,9 @@ pub struct ValueResolutionCtx { /// When resolving `Value`s, whether to look up `Current` or /// `Goal`. value_resolution_mode: ValueResolutionMode, - /// ID of the step whose params are being resolved. - step_id: StepId, - /// Name of the `Step::Params` type. + /// ID of the item whose params are being resolved. + item_id: ItemId, + /// Name of the `Item::Params` type. params_type_name: String, /// Hierarchy of fields traversed to resolve this value. resolution_chain: Vec, @@ -21,12 +21,12 @@ pub struct ValueResolutionCtx { impl ValueResolutionCtx { pub fn new( value_resolution_mode: ValueResolutionMode, - step_id: StepId, + item_id: ItemId, params_type_name: String, ) -> Self { Self { value_resolution_mode, - step_id, + item_id, params_type_name, resolution_chain: Vec::new(), } @@ -36,8 +36,8 @@ impl ValueResolutionCtx { self.value_resolution_mode } - pub fn step_id(&self) -> &StepId { - &self.step_id + pub fn item_id(&self) -> &ItemId { + &self.item_id } pub fn params_type_name(&self) -> &str { diff --git a/crate/params/src/value_spec.rs b/crate/params/src/value_spec.rs index 15523a151..21e1f543e 100644 --- a/crate/params/src/value_spec.rs +++ b/crate/params/src/value_spec.rs @@ -17,7 +17,7 @@ use crate::{ /// For deserialization: /// /// 1. A `ParamsSpecsTypeReg` is constructed, and deserialization functions are -/// registered from `StepId` to `ValueSpecDe`, where `F` and `U` are +/// registered from `ItemId` to `ValueSpecDe`, where `F` and `U` are /// derived from the `ValueSpec` provided by the user. /// /// 2. `value_specs.yaml` is deserialized using that type registry. @@ -26,7 +26,7 @@ use crate::{ /// `AnySpecRtBoxed` to be passed around in a `CmdCtx`. /// /// 4. These `AnySpecRtBoxed`s are downcasted back to `ValueSpec` when -/// resolving values for step params and params partials. +/// resolving values for item params and params partials. #[derive(Clone, Serialize, Deserialize)] #[serde(from = "crate::ValueSpecDe")] pub enum ValueSpec diff --git a/crate/params/src/value_spec_rt.rs b/crate/params/src/value_spec_rt.rs index 0551a7ddb..b996855ad 100644 --- a/crate/params/src/value_spec_rt.rs +++ b/crate/params/src/value_spec_rt.rs @@ -7,7 +7,7 @@ use crate::{AnySpecRt, ParamsResolveError, ValueResolutionCtx}; /// Runtime logic of how to look up values for each field in this struct. /// /// This trait is automatically implemented by `#[derive(Params)]` on an -/// `Step::Params`, as well as in the `peace_params` crate for standard +/// `Item::Params`, as well as in the `peace_params` crate for standard /// library types. pub trait ValueSpecRt: AnySpecRt { /// The original value type. `MyParamsValueSpec::ValueType` is `MyParams`. diff --git a/crate/params_derive/src/impl_field_wise_builder.rs b/crate/params_derive/src/impl_field_wise_builder.rs index 24cbb7927..a0d10d638 100644 --- a/crate/params_derive/src/impl_field_wise_builder.rs +++ b/crate/params_derive/src/impl_field_wise_builder.rs @@ -404,7 +404,7 @@ fn builder_field_methods( // .build(); // // let mut cmd_ctx = // .. - // .with_step_params::<_>(step_id, params_spec) + // .with_item_params::<_>(item_id, params_spec) // .await?; // ``` quote! { diff --git a/crate/params_derive/src/impl_from_params_for_params_partial.rs b/crate/params_derive/src/impl_from_params_for_params_partial.rs index db90c143d..cdf7e65d6 100644 --- a/crate/params_derive/src/impl_from_params_for_params_partial.rs +++ b/crate/params_derive/src/impl_from_params_for_params_partial.rs @@ -6,7 +6,7 @@ use syn::{ use crate::util::{fields_deconstruct, fields_deconstruct_some, variant_match_arm}; /// `impl From for ParamsPartial`, so that users can use -/// `params_partial.try_into()` in `Step::try_state_*` without needing to +/// `params_partial.try_into()` in `Item::try_state_*` without needing to /// deconstruct the `Params::Partial`. pub fn impl_from_params_for_params_partial( ast: &DeriveInput, diff --git a/crate/params_derive/src/impl_try_from_params_partial_for_params.rs b/crate/params_derive/src/impl_try_from_params_partial_for_params.rs index 7f94f89b2..fef8db15f 100644 --- a/crate/params_derive/src/impl_try_from_params_partial_for_params.rs +++ b/crate/params_derive/src/impl_try_from_params_partial_for_params.rs @@ -9,7 +9,7 @@ use crate::util::{ }; /// `impl TryFrom for Params`, so that users can use -/// `params_partial.try_into()` in `Step::try_state_*` without needing to +/// `params_partial.try_into()` in `Item::try_state_*` without needing to /// deconstruct the `Params::Partial`. pub fn impl_try_from_params_partial_for_params( ast: &DeriveInput, diff --git a/crate/params_derive/src/lib.rs b/crate/params_derive/src/lib.rs index 6c54f2e65..bc827eafc 100644 --- a/crate/params_derive/src/lib.rs +++ b/crate/params_derive/src/lib.rs @@ -89,7 +89,7 @@ mod util; )] pub fn value_spec(input: TokenStream) -> TokenStream { let mut ast = syn::parse(input) - .expect("`Params` derive: Failed to parse input as struct, enum, or union."); + .expect("`Params` derive: Failed to parse item as struct, enum, or union."); let gen = impl_value(&mut ast, ImplMode::Fieldwise); @@ -123,7 +123,7 @@ pub fn value_spec(input: TokenStream) -> TokenStream { )] pub fn value_spec_fieldless(input: TokenStream) -> TokenStream { let mut ast = syn::parse(input) - .expect("`ParamsFieldless` derive: Failed to parse input as struct, enum, or union."); + .expect("`ParamsFieldless` derive: Failed to parse item as struct, enum, or union."); let gen = impl_value(&mut ast, ImplMode::Fieldless); @@ -133,7 +133,7 @@ pub fn value_spec_fieldless(input: TokenStream) -> TokenStream { #[proc_macro] pub fn value_impl(input: TokenStream) -> TokenStream { let mut ast = syn::parse(input) - .expect("`peace_params::value_impl`: Failed to parse input as struct, enum, or union."); + .expect("`peace_params::value_impl`: Failed to parse item as struct, enum, or union."); let gen = impl_value(&mut ast, ImplMode::Fieldless); @@ -362,7 +362,7 @@ fn t_partial( &[ parse_quote! { #[doc="\ - Step parameters that may not necessarily have values.\n\ + Item parameters that may not necessarily have values.\n\ \n\ This is used for `try_state_current` and `try_state_goal` where values \n\ could be referenced from predecessors, which may not yet be available, such \n\ @@ -414,7 +414,7 @@ fn t_partial_external( &[ parse_quote! { #[doc="\ - Step parameters that may not necessarily have values.\n\ + Item parameters that may not necessarily have values.\n\ \n\ This is used for `try_state_current` and `try_state_goal` where values \n\ could be referenced from predecessors, which may not yet be available, such \n\ diff --git a/crate/params_derive/src/util.rs b/crate/params_derive/src/util.rs index cb2e3589b..81fd00ebb 100644 --- a/crate/params_derive/src/util.rs +++ b/crate/params_derive/src/util.rs @@ -37,7 +37,7 @@ static STD_LIB_TYPES: &[&str] = &[ /// This attribute must be: /// /// * attached to std library types defined outside the `peace_params` crate. -/// * attached to each `Params`' field defined outside the step crate. +/// * attached to each `Params`' field defined outside the item crate. pub fn is_fieldless_type(ast: &DeriveInput) -> bool { is_known_fieldless_std_lib_spec(&ast.ident) || is_tagged_fieldless(&ast.attrs) } @@ -57,7 +57,7 @@ fn is_known_fieldless_std_lib_spec(ty_name: &Ident) -> bool { /// /// * attached to std library types defined outside the `peace_params` crate, if /// it isn't already covered by `STD_LIB_TYPES`. -/// * attached to each field in `Params` that is defined outside the step crate. +/// * attached to each field in `Params` that is defined outside the item crate. pub fn is_tagged_fieldless(attrs: &[Attribute]) -> bool { attrs.iter().any(|attr| { if attr.path().is_ident("value_spec") { diff --git a/crate/resources/src/internal/state_diffs_mut.rs b/crate/resources/src/internal/state_diffs_mut.rs index 65e1ffa47..270dfc24e 100644 --- a/crate/resources/src/internal/state_diffs_mut.rs +++ b/crate/resources/src/internal/state_diffs_mut.rs @@ -1,10 +1,10 @@ use std::ops::{Deref, DerefMut}; -use peace_core::StepId; +use peace_core::ItemId; use serde::Serialize; use type_reg::untagged::{BoxDtDisplay, TypeMap}; -/// Diffs of `State`s for each `Step`s. `TypeMap` +/// Diffs of `State`s for each `Item`s. `TypeMap` /// newtype. /// /// # Implementors @@ -15,7 +15,7 @@ use type_reg::untagged::{BoxDtDisplay, TypeMap}; /// [`StateDiffs`]: crate::StateDiffs /// [`Resources`]: crate::Resources #[derive(Debug, Default, Serialize)] -pub struct StateDiffsMut(TypeMap); +pub struct StateDiffsMut(TypeMap); impl StateDiffsMut { /// Returns a new `StateDiffsMut` map. @@ -32,13 +32,13 @@ impl StateDiffsMut { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } impl Deref for StateDiffsMut { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 @@ -51,16 +51,16 @@ impl DerefMut for StateDiffsMut { } } -impl From> for StateDiffsMut { - fn from(type_map: TypeMap) -> Self { +impl From> for StateDiffsMut { + fn from(type_map: TypeMap) -> Self { Self(type_map) } } -impl Extend<(StepId, BoxDtDisplay)> for StateDiffsMut { - fn extend>(&mut self, iter: T) { - iter.into_iter().for_each(|(step_id, state_diff)| { - self.insert_raw(step_id, state_diff); +impl Extend<(ItemId, BoxDtDisplay)> for StateDiffsMut { + fn extend>(&mut self, iter: T) { + iter.into_iter().for_each(|(item_id, state_diff)| { + self.insert_raw(item_id, state_diff); }); } } diff --git a/crate/resources/src/internal/states_mut.rs b/crate/resources/src/internal/states_mut.rs index c9a103c2b..f76b7eb1c 100644 --- a/crate/resources/src/internal/states_mut.rs +++ b/crate/resources/src/internal/states_mut.rs @@ -3,17 +3,17 @@ use std::{ ops::{Deref, DerefMut}, }; -use peace_core::StepId; +use peace_core::ItemId; use serde::Serialize; use type_reg::untagged::{BoxDtDisplay, TypeMap}; -/// `State`s for all `Step`s. `TypeMap` newtype. +/// `State`s for all `Item`s. `TypeMap` newtype. /// /// # Implementors /// -/// To reference State from another `Step`, in `Step::Data`, you should +/// To reference State from another `Item`, in `Item::Data`, you should /// reference [`Current`] or [`Goal`], where `T` is the predecessor -/// step's state. +/// item's state. /// /// # Type Parameters /// @@ -26,7 +26,7 @@ use type_reg::untagged::{BoxDtDisplay, TypeMap}; /// [`StatesCurrent`]: crate::StatesCurrent /// [`StatesRw`]: crate::StatesRw #[derive(Debug, Serialize)] -pub struct StatesMut(TypeMap, PhantomData); +pub struct StatesMut(TypeMap, PhantomData); impl StatesMut { /// Returns a new `StatesMut` map. @@ -43,7 +43,7 @@ impl StatesMut { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } @@ -55,7 +55,7 @@ impl Default for StatesMut { } impl Deref for StatesMut { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 @@ -68,16 +68,16 @@ impl DerefMut for StatesMut { } } -impl From> for StatesMut { - fn from(type_map: TypeMap) -> Self { +impl From> for StatesMut { + fn from(type_map: TypeMap) -> Self { Self(type_map, PhantomData) } } -impl Extend<(StepId, BoxDtDisplay)> for StatesMut { - fn extend>(&mut self, iter: T) { - iter.into_iter().for_each(|(step_id, state)| { - self.insert_raw(step_id, state); +impl Extend<(ItemId, BoxDtDisplay)> for StatesMut { + fn extend>(&mut self, iter: T) { + iter.into_iter().for_each(|(item_id, state)| { + self.insert_raw(item_id, state); }); } } diff --git a/crate/resources/src/lib.rs b/crate/resources/src/lib.rs index 491236a93..16339077a 100644 --- a/crate/resources/src/lib.rs +++ b/crate/resources/src/lib.rs @@ -7,11 +7,11 @@ pub use resman::*; pub use type_reg; -pub use crate::{step_rt_id::StepRtId, resources::Resources}; +pub use crate::{item_rt_id::ItemRtId, resources::Resources}; pub mod internal; pub mod paths; pub mod resources; pub mod states; -mod step_rt_id; +mod item_rt_id; diff --git a/crate/resources/src/paths.rs b/crate/resources/src/paths.rs index 49b54e805..4231c1008 100644 --- a/crate/resources/src/paths.rs +++ b/crate/resources/src/paths.rs @@ -38,7 +38,7 @@ //! | | |- 00000007_2022-08-23T13_07_31_artifact_publish.yaml //! | | //! | |- .meta.yaml # Store the last discovered time so we can inform the user. -//! | | # Should time be stored per step, or per invocation? +//! | | # Should time be stored per item, or per invocation? //! | | //! | |- dev_env # flow name //! | | |- states_goal.yaml diff --git a/crate/resources/src/paths/params_specs_file.rs b/crate/resources/src/paths/params_specs_file.rs index 605575574..71e475cfd 100644 --- a/crate/resources/src/paths/params_specs_file.rs +++ b/crate/resources/src/paths/params_specs_file.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use crate::paths::FlowDir; -/// Path to the file that stores steps' states. +/// Path to the file that stores items' states. /// /// Typically `$workspace_dir/.peace/$profile/$flow_id/params_specs.yaml`. /// diff --git a/crate/resources/src/paths/states_current_file.rs b/crate/resources/src/paths/states_current_file.rs index f0e79a59a..f0dd95368 100644 --- a/crate/resources/src/paths/states_current_file.rs +++ b/crate/resources/src/paths/states_current_file.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use crate::paths::FlowDir; -/// Path to the file that stores steps' states. +/// Path to the file that stores items' states. /// /// Typically `$workspace_dir/.peace/$profile/$flow_id/states_current.yaml`. /// diff --git a/crate/resources/src/paths/states_goal_file.rs b/crate/resources/src/paths/states_goal_file.rs index 55b3718b6..3e2a9687d 100644 --- a/crate/resources/src/paths/states_goal_file.rs +++ b/crate/resources/src/paths/states_goal_file.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use crate::paths::FlowDir; -/// Path to the file that stores steps' states. +/// Path to the file that stores items' states. /// /// Typically `$workspace_dir/.peace/$profile/$flow_id/states_goal.yaml`. /// diff --git a/crate/resources/src/resources.rs b/crate/resources/src/resources.rs index 130807f65..d8ca41f37 100644 --- a/crate/resources/src/resources.rs +++ b/crate/resources/src/resources.rs @@ -20,7 +20,7 @@ pub mod ts; /// /// * `TS`: The type state of the `Resources` map. /// -/// [`StepId`]: peace_cfg::StepId +/// [`ItemId`]: peace_cfg::ItemId #[derive(Debug)] pub struct Resources { inner: resman::Resources, @@ -64,7 +64,7 @@ impl DerefMut for Resources { } } -// For `StepGraph` after resources have been set up. +// For `ItemGraph` after resources have been set up. impl From> for Resources { fn from(resources: Resources) -> Self { Self { diff --git a/crate/resources/src/resources/ts.rs b/crate/resources/src/resources/ts.rs index 92b7dc1db..1b96acc9e 100644 --- a/crate/resources/src/resources/ts.rs +++ b/crate/resources/src/resources/ts.rs @@ -12,6 +12,6 @@ #[derive(Debug)] pub struct Empty; -/// `Step::setup` has been run over [`Resources`]. +/// `Item::setup` has been run over [`Resources`]. #[derive(Debug)] pub struct SetUp; diff --git a/crate/resources/src/states.rs b/crate/resources/src/states.rs index 15ba7fecb..8a5f30f88 100644 --- a/crate/resources/src/states.rs +++ b/crate/resources/src/states.rs @@ -13,7 +13,7 @@ pub mod ts; use std::{marker::PhantomData, ops::Deref}; -use peace_core::StepId; +use peace_core::ItemId; use peace_fmt::{Presentable, Presenter}; use serde::Serialize; use type_reg::untagged::{BoxDtDisplay, TypeMap}; @@ -33,7 +33,7 @@ mod states_goal_stored; mod states_previous; mod states_serde; -/// Map of `State`s for all `Step`s. `TypeMap` newtype. +/// Map of `State`s for all `Item`s. `TypeMap` newtype. /// /// # Type Parameters /// @@ -45,41 +45,41 @@ mod states_serde; /// /// # Design /// -/// When states are serialized, we want there to be an entry for each step. +/// When states are serialized, we want there to be an entry for each item. /// -/// 1. This means the `States` map should contain an entry for each step, -/// regardless of whether a `State` is recorded for that step. +/// 1. This means the `States` map should contain an entry for each item, +/// regardless of whether a `State` is recorded for that item. /// -/// 2. Inserting an `Option<_>` layer around the `Step::State` turns the map -/// into a `Map>`. +/// 2. Inserting an `Option<_>` layer around the `Item::State` turns the map +/// into a `Map>`. /// -/// 3. Calling `states.get(step_id)` returns `Option>`, the -/// outer layer for whether the step had an entry, and the inner layer for +/// 3. Calling `states.get(item_id)` returns `Option>`, the +/// outer layer for whether the item had an entry, and the inner layer for /// whether there was any `State` recorded. /// -/// 4. If we can guarantee the step ID is valid -- an ID of a step in the flow +/// 4. If we can guarantee the item ID is valid -- an ID of a step in the flow /// -- we could remove that outer `Option` layer. Currently we cannot make /// this guarantee, as: /// -/// - step IDs are constructed by developer code, without any constraints -/// for which steps are inserted into the Flow, and which are inserted +/// - item IDs are constructed by developer code, without any constraints +/// for which items are inserted into the Flow, and which are inserted /// into `States` -- although insertion into `States` is largely managed /// by `peace`. /// -/// - `States` may contain different steps across different versions of an +/// - `States` may contain different items across different versions of an /// automation tool, so it is possible (and valid) to: /// -/// + Deserialize `States` that contain states for `Step`s that are no +/// + Deserialize `States` that contain states for `Item`s that are no /// longer in the flow. -/// + Deserialize `States` that do not contain states for `Step`s that +/// + Deserialize `States` that do not contain states for `Item`s that /// are newly added to the flow. -/// + Have a combination of the above for renamed steps. +/// + Have a combination of the above for renamed items. /// /// 5. For clarity of each of these `Option` layers, we can wrap them in a /// newtype. /// /// 6. For code cleanliness, this additional layer requires calling -/// [`flatten()`] on `states.get(step_id)`. +/// [`flatten()`] on `states.get(item_id)`. /// /// 7. We *could* introduce a different type during serialization that handles /// this additional layer, to remove the additional `flatten()`. How do we @@ -92,31 +92,31 @@ mod states_serde; /// /// ## `StatesSerde` Separate Type /// -/// Newtype for `Map>`. +/// Newtype for `Map>`. /// -/// ### Step Additions +/// ### Item Additions /// -/// * Flow contains the `Step`. -/// * Stored state doesn't contain an entry for the step. -/// * Deserialized `StatesSerde` should contain `(step_id!("new"), None)` -- may +/// * Flow contains the `Item`. +/// * Stored state doesn't contain an entry for the item. +/// * Deserialized `StatesSerde` should contain `(item_id!("new"), None)` -- may /// need custom deserialization code. /// -/// ### Step Removals +/// ### Item Removals /// -/// * Flow does not contain the `Step`. -/// * Stored state contains an entry for the step, but cannot be deserialized. +/// * Flow does not contain the `Item`. +/// * Stored state contains an entry for the item, but cannot be deserialized. /// * Deserialized `StatesSerde` would not contain any entry. -/// * Deserialization will return the unable to be deserialized step state in +/// * Deserialization will return the unable to be deserialized item state in /// the return value. Meaning, `StatesSerde` will contain it in a separate /// "removed" field. /// /// After deserialization, `StatesSerde` is explicitly mapped into `States`, and -/// we can inform the developer and/or user of the removed steps if it is +/// we can inform the developer and/or user of the removed items if it is /// useful. /// -/// ## `States` With Optional Step State +/// ## `States` With Optional Item State /// -/// Developers will frequently use `states.get(step_id).flatten()` to access +/// Developers will frequently use `states.get(item_id).flatten()` to access /// state. /// /// Deserialization has all the same properties as the `StatesSerde` separate @@ -128,16 +128,16 @@ mod states_serde; /// encountered? If so, then: /// /// * `peace` should store the version of the flow in the stored states files -/// * steps that have ever been used in flows must be shipped in the automation +/// * items that have ever been used in flows must be shipped in the automation /// software, in order to support safe upgrades. /// /// How would this work? /// -/// * Newly added steps just work. -/// * Removed steps need to be removed: +/// * Newly added items just work. +/// * Removed items need to be removed: /// - Successors may need their parameters specified from new predecessors. -/// - If removing multiple steps, we need to clean them in reverse. -/// * Renamed steps may need to be re-applied, or potentially cleaned and +/// - If removing multiple items, we need to clean them in reverse. +/// * Renamed items may need to be re-applied, or potentially cleaned and /// re-ensured. This doesn't support data retention if a predecessor needs to /// be cleaned, forcing successors to be cleaned, and reensured after. Unless, /// `peace` supports backup and restore. @@ -146,7 +146,7 @@ mod states_serde; #[derive(Debug, Serialize)] #[serde(transparent)] // Needed to serialize as a map instead of a list. pub struct States( - pub(crate) TypeMap, + pub(crate) TypeMap, pub(crate) PhantomData, ); @@ -165,7 +165,7 @@ impl States { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } @@ -176,7 +176,7 @@ impl Clone for States { clone.0.extend( self.0 .iter() - .map(|(step_id, state)| (step_id.clone(), state.clone())), + .map(|(item_id, state)| (item_id.clone(), state.clone())), ); clone @@ -190,15 +190,15 @@ impl Default for States { } impl Deref for States { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 } } -impl From> for States { - fn from(type_map: TypeMap) -> Self { +impl From> for States { + fn from(type_map: TypeMap) -> Self { Self(type_map, PhantomData) } } @@ -216,8 +216,8 @@ impl Presentable for States { PR: Presenter<'output>, { presenter - .list_numbered_with(self.iter(), |(step_id, state)| { - (step_id, format!(": {state}")) + .list_numbered_with(self.iter(), |(item_id, state)| { + (item_id, format!(": {state}")) }) .await } diff --git a/crate/resources/src/states/state_diffs.rs b/crate/resources/src/states/state_diffs.rs index d209a86d9..34b56948a 100644 --- a/crate/resources/src/states/state_diffs.rs +++ b/crate/resources/src/states/state_diffs.rs @@ -1,13 +1,13 @@ use std::ops::Deref; -use peace_core::StepId; +use peace_core::ItemId; use peace_fmt::{Presentable, Presenter}; use serde::Serialize; use type_reg::untagged::{BoxDtDisplay, TypeMap}; use crate::internal::StateDiffsMut; -/// Diffs of `State`s for each `Step`s. `TypeMap` +/// Diffs of `State`s for each `Item`s. `TypeMap` /// newtype. /// /// [`External`] fields are not necessarily used in `StateDiff` computations. @@ -20,7 +20,7 @@ use crate::internal::StateDiffsMut; /// [`External`]: peace_cfg::state::External /// [`Resources`]: crate::Resources #[derive(Debug, Default, Serialize)] -pub struct StateDiffs(TypeMap); +pub struct StateDiffs(TypeMap); impl StateDiffs { /// Returns a new `StateDiffs` map. @@ -37,21 +37,21 @@ impl StateDiffs { } /// Returns the inner map. - pub fn into_inner(self) -> TypeMap { + pub fn into_inner(self) -> TypeMap { self.0 } } impl Deref for StateDiffs { - type Target = TypeMap; + type Target = TypeMap; fn deref(&self) -> &Self::Target { &self.0 } } -impl From> for StateDiffs { - fn from(type_map: TypeMap) -> Self { +impl From> for StateDiffs { + fn from(type_map: TypeMap) -> Self { Self(type_map) } } @@ -69,8 +69,8 @@ impl Presentable for StateDiffs { PR: Presenter<'output>, { presenter - .list_numbered_with(self.iter(), |(step_id, state_diff)| { - (step_id, format!(": {state_diff}")) + .list_numbered_with(self.iter(), |(item_id, state_diff)| { + (item_id, format!(": {state_diff}")) }) .await } diff --git a/crate/resources/src/states/states_clean.rs b/crate/resources/src/states/states_clean.rs index 5a78a02ab..e619b2a3c 100644 --- a/crate/resources/src/states/states_clean.rs +++ b/crate/resources/src/states/states_clean.rs @@ -1,8 +1,8 @@ use crate::states::{ts::Clean, States}; -/// Clean `State`s for all `Step`s. +/// Clean `State`s for all `Item`s. /// -/// These are the states that each step would be in, if `Step::apply` were to be +/// These are the states that each item would be in, if `Item::apply` were to be /// run with `state_clean` as the target state. /// /// **Note:** Not to be confused with [`StatesCleaned`]. diff --git a/crate/resources/src/states/states_cleaned.rs b/crate/resources/src/states/states_cleaned.rs index f642f9329..26b13e4ce 100644 --- a/crate/resources/src/states/states_cleaned.rs +++ b/crate/resources/src/states/states_cleaned.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::Cleaned, States, StatesCurrent}; -/// Cleaned `State`s for all `Step`s. `TypeMap` newtype. +/// Cleaned `State`s for all `Item`s. `TypeMap` newtype. /// /// These are the `State`s collected after `CleanOpSpec::exec` has been run. /// diff --git a/crate/resources/src/states/states_cleaned_dry.rs b/crate/resources/src/states/states_cleaned_dry.rs index 771ed9ec0..97f235eed 100644 --- a/crate/resources/src/states/states_cleaned_dry.rs +++ b/crate/resources/src/states/states_cleaned_dry.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::CleanedDry, States, StatesCurrent}; -/// Dry-run ensured `State`s for all `Step`s. +/// Dry-run ensured `State`s for all `Item`s. /// /// These are the `State`s collected after `CleanOpSpec::exec_dry` has been /// run. diff --git a/crate/resources/src/states/states_current.rs b/crate/resources/src/states/states_current.rs index 7d0b7cf44..13281fa5f 100644 --- a/crate/resources/src/states/states_current.rs +++ b/crate/resources/src/states/states_current.rs @@ -5,7 +5,7 @@ use crate::states::{ States, }; -/// Current `State`s for all `Step`s. +/// Current `State`s for all `Item`s. /// /// This is strictly only present when the [`States`] are discovered in the /// current execution. `States` read from the [`StatesCurrentFile`] are @@ -15,7 +15,7 @@ use crate::states::{ /// # Implementors /// /// If a `Step`'s state discovery depends on the `State` of a previous -/// `Step`, then you should insert the predecessor's state into +/// `Item`, then you should insert the predecessor's state into /// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]: /// /// ```rust @@ -42,7 +42,7 @@ use crate::states::{ /// /// You may reference [`StatesCurrent`] in `ApplyFns::Data` for reading. It /// is not mutable as `StatesCurrent` must remain unchanged so that all -/// `Step`s operate over consistent data. +/// `Item`s operate over consistent data. /// /// [`Data`]: peace_data::Data /// [`Resources`]: crate::Resources diff --git a/crate/resources/src/states/states_current_stored.rs b/crate/resources/src/states/states_current_stored.rs index 3b547cd13..9ee60eff4 100644 --- a/crate/resources/src/states/states_current_stored.rs +++ b/crate/resources/src/states/states_current_stored.rs @@ -5,7 +5,7 @@ use crate::states::{ States, }; -/// Stored current `State`s for all `Step`s. +/// Stored current `State`s for all `Item`s. /// /// This is loaded into [`Resources`] at the beginning of any command execution, /// from the [`StatesCurrentFile`]. @@ -20,7 +20,7 @@ use crate::states::{ /// # Implementors /// /// If a `Step`'s state discovery depends on the `State` of a previous -/// `Step`, then you should insert the predecessor's state into +/// `Item`, then you should insert the predecessor's state into /// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]: /// /// ```rust @@ -47,7 +47,7 @@ use crate::states::{ /// /// You may reference [`StatesCurrentStored`] in `ApplyFns::Data` for reading. /// It is not mutable as `StatesCurrentStored` must remain unchanged so that all -/// `Step`s operate over consistent data. +/// `Item`s operate over consistent data. /// /// [`StatesCurrentFile`]: crate::paths::StatesCurrentFile /// [`Data`]: peace_data::Data diff --git a/crate/resources/src/states/states_ensured.rs b/crate/resources/src/states/states_ensured.rs index 34a965d6b..c97ef2545 100644 --- a/crate/resources/src/states/states_ensured.rs +++ b/crate/resources/src/states/states_ensured.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::Ensured, States, StatesCurrent}; -/// Ensured `State`s for all `Step`s. `TypeMap` newtype. +/// Ensured `State`s for all `Item`s. `TypeMap` newtype. /// /// These are the `State`s collected after `ApplyFns::exec` has been run. /// diff --git a/crate/resources/src/states/states_ensured_dry.rs b/crate/resources/src/states/states_ensured_dry.rs index b0043c964..af7ed3307 100644 --- a/crate/resources/src/states/states_ensured_dry.rs +++ b/crate/resources/src/states/states_ensured_dry.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::EnsuredDry, States, StatesCurrent}; -/// Dry-run ensured `State`s for all `Step`s. +/// Dry-run ensured `State`s for all `Item`s. /// /// These are the `State`s collected after `ApplyFns::exec_dry` has been /// run. diff --git a/crate/resources/src/states/states_goal.rs b/crate/resources/src/states/states_goal.rs index 21e02b701..16e3698b9 100644 --- a/crate/resources/src/states/states_goal.rs +++ b/crate/resources/src/states/states_goal.rs @@ -5,15 +5,15 @@ use crate::states::{ States, }; -/// Goal `State`s for all `Step`s. +/// Goal `State`s for all `Item`s. /// -/// These are the states that each step would be in, if `Step::apply` were to be +/// These are the states that each item would be in, if `Item::apply` were to be /// run with `state_goal` as the target state. /// /// # Implementors /// /// If a `Step`'s goal state discovery depends on the goal `State` of -/// a previous `Step`, then you should insert the predecessor's goal +/// a previous `Item`, then you should insert the predecessor's goal /// state into [`Resources`], and reference that in the subsequent /// `TryFnSpec`'s [`Data`]: /// @@ -41,7 +41,7 @@ use crate::states::{ /// /// You may reference [`StatesGoal`] in `ApplyFns::Data` for reading. It /// is not mutable as `StatesGoal` must remain unchanged so that all -/// `Step`s operate over consistent data. +/// `Item`s operate over consistent data. /// /// [`Data`]: peace_data::Data /// [`Resources`]: crate::Resources diff --git a/crate/resources/src/states/states_goal_stored.rs b/crate/resources/src/states/states_goal_stored.rs index 157c27008..4e366efa0 100644 --- a/crate/resources/src/states/states_goal_stored.rs +++ b/crate/resources/src/states/states_goal_stored.rs @@ -5,9 +5,9 @@ use crate::states::{ States, }; -/// Stored goal `State`s for all `Step`s. +/// Stored goal `State`s for all `Item`s. /// -/// These are the states that each step would be in, if `Step::apply` were to be +/// These are the states that each item would be in, if `Item::apply` were to be /// run with `state_goal` as the target state. /// /// This is loaded into [`Resources`] at the beginning of any command execution, diff --git a/crate/resources/src/states/states_previous.rs b/crate/resources/src/states/states_previous.rs index 54143551a..35185845c 100644 --- a/crate/resources/src/states/states_previous.rs +++ b/crate/resources/src/states/states_previous.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use crate::states::{ts::Previous, States, StatesCurrent}; -/// Previous `State`s for all `Step`s. +/// Previous `State`s for all `Item`s. /// /// This is present when an `ApplyCmd` (`EnsureCmd` or `CleanCmd`) is run, /// whereby the current states have changed to the newly ensured states. diff --git a/crate/resources/src/states/states_serde.rs b/crate/resources/src/states/states_serde.rs index 3ce04ab53..4428cd2f3 100644 --- a/crate/resources/src/states/states_serde.rs +++ b/crate/resources/src/states/states_serde.rs @@ -2,33 +2,33 @@ use std::{fmt::Debug, ops::Deref}; -use peace_core::StepId; +use peace_core::ItemId; use serde::Serialize; use type_reg::{ common::UnknownEntriesSome, untagged::{BoxDtDisplay, TypeMapOpt}, }; -/// Map of `State`s for all `Step`s. `TypeMapOpt` +/// Map of `State`s for all `Item`s. `TypeMapOpt` /// newtype. /// -/// Conceptually you can think of this as a `Map>`. +/// Conceptually you can think of this as a `Map>`. /// /// This map should: /// -/// * Always contain an entry for every step in the flow. -/// * Contain an unknown entry for deserialized unknown steps. +/// * Always contain an entry for every item in the flow. +/// * Contain an unknown entry for deserialized unknown items. /// /// This map can be initialized either through one of: /// /// * Deserialization. -/// * `From<&StepGraph>`: All states are initialized to `None`. -/// * [`FromIterator::<(StepId, Option)>::from_iter`]. +/// * `From<&ItemGraph>`: All states are initialized to `None`. +/// * [`FromIterator::<(ItemId, Option)>::from_iter`]. /// -/// [`FromIterator::<(StepId, Option)>::from_iter`]: std::iter::FromIterator +/// [`FromIterator::<(ItemId, Option)>::from_iter`]: std::iter::FromIterator #[derive(Debug, Serialize)] #[serde(transparent)] // Needed to serialize as a map instead of a list. -pub struct StatesSerde(TypeMapOpt>) +pub struct StatesSerde(TypeMapOpt>) where ValueT: Clone + Debug + PartialEq + Eq; @@ -45,7 +45,7 @@ where } /// Returns the inner map. - pub fn into_inner(self) -> TypeMapOpt> { + pub fn into_inner(self) -> TypeMapOpt> { self.0 } } @@ -59,7 +59,7 @@ where clone.0.extend( self.0 .iter() - .map(|(step_id, state)| (step_id.clone(), state.clone())), + .map(|(item_id, state)| (item_id.clone(), state.clone())), ); clone @@ -70,34 +70,34 @@ impl Deref for StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, { - type Target = TypeMapOpt>; + type Target = TypeMapOpt>; fn deref(&self) -> &Self::Target { &self.0 } } -impl FromIterator<(StepId, Option)> for StatesSerde +impl FromIterator<(ItemId, Option)> for StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, { - fn from_iter)>>(iter: T) -> Self { + fn from_iter)>>(iter: T) -> Self { iter.into_iter().fold( Self(TypeMapOpt::new_typed()), - |mut states_serde, (step_id, state_boxed)| { - states_serde.0.insert_raw(step_id, state_boxed); + |mut states_serde, (item_id, state_boxed)| { + states_serde.0.insert_raw(item_id, state_boxed); states_serde }, ) } } -impl From>> +impl From>> for StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, { - fn from(type_map_opt: TypeMapOpt>) -> Self { + fn from(type_map_opt: TypeMapOpt>) -> Self { Self(type_map_opt) } } diff --git a/crate/resources/src/states/ts.rs b/crate/resources/src/states/ts.rs index 12cc0b697..08dd9ee09 100644 --- a/crate/resources/src/states/ts.rs +++ b/crate/resources/src/states/ts.rs @@ -6,47 +6,47 @@ use serde::{Deserialize, Serialize}; -/// Clean / blank states of steps. +/// Clean / blank states of items. /// /// Not to be confused with [`Cleaned`]. #[derive(Debug, Deserialize, Serialize)] pub struct Clean; -/// Stored current states of steps. +/// Stored current states of items. #[derive(Debug, Deserialize, Serialize)] pub struct CurrentStored; -/// Current states of steps. +/// Current states of items. #[derive(Debug, Deserialize, Serialize)] pub struct Current; -/// Stored goal states of steps. +/// Stored goal states of items. #[derive(Debug, Deserialize, Serialize)] pub struct GoalStored; -/// Goal states of steps. +/// Goal states of items. #[derive(Debug, Deserialize, Serialize)] pub struct Goal; -/// States of steps after running the `EnsureCmd`. +/// States of items after running the `EnsureCmd`. #[derive(Debug, Deserialize, Serialize)] pub struct Ensured; -/// States of steps after dry-running `EnsureCmd`. +/// States of items after dry-running `EnsureCmd`. #[derive(Debug, Deserialize, Serialize)] pub struct EnsuredDry; -/// States of steps after running the `CleanCmd`. +/// States of items after running the `CleanCmd`. /// /// Not to be confused with [`Clean`]. #[derive(Debug, Deserialize, Serialize)] pub struct Cleaned; -/// States of steps after dry-running `CleanCmd`. +/// States of items after dry-running `CleanCmd`. #[derive(Debug, Deserialize, Serialize)] pub struct CleanedDry; -/// Previous states of steps. +/// Previous states of items. /// /// This is intended as a record of `States` before an `ApplyCmd` (`EnsureCmd` /// or `CleanCmd`) are run. diff --git a/crate/resources/src/step_rt_id.rs b/crate/resources/src/step_rt_id.rs index 4c42fbd83..332a5dccf 100644 --- a/crate/resources/src/step_rt_id.rs +++ b/crate/resources/src/step_rt_id.rs @@ -5,14 +5,14 @@ use peace_data::fn_graph::FnId; /// Runtime identifier for a [`Step`]. [`FnId`] newtype. /// /// This is a cheap identifier to copy around, instead of cloning -/// [`StepId`]. +/// [`ItemId`]. /// -/// [`StepId`]: peace_cfg::StepId +/// [`ItemId`]: peace_cfg::ItemId #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub struct StepRtId(FnId); +pub struct ItemRtId(FnId); -impl StepRtId { - /// Returns a new `StepRtId`. +impl ItemRtId { + /// Returns a new `ItemRtId`. pub fn new(fn_id: FnId) -> Self { Self(fn_id) } @@ -23,7 +23,7 @@ impl StepRtId { } } -impl Deref for StepRtId { +impl Deref for ItemRtId { type Target = FnId; fn deref(&self) -> &Self::Target { @@ -31,19 +31,19 @@ impl Deref for StepRtId { } } -impl DerefMut for StepRtId { +impl DerefMut for ItemRtId { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl From for StepRtId { +impl From for ItemRtId { fn from(index: usize) -> Self { Self(FnId::new(index)) } } -impl From for StepRtId { +impl From for ItemRtId { fn from(fn_id: FnId) -> Self { Self(fn_id) } diff --git a/crate/rt/src/cmd_blocks.rs b/crate/rt/src/cmd_blocks.rs index c13925bf9..54be86333 100644 --- a/crate/rt/src/cmd_blocks.rs +++ b/crate/rt/src/cmd_blocks.rs @@ -1,6 +1,6 @@ -//! Blocks of logic that run one [`Step`] function +//! Blocks of logic that run one [`Item`] function //! -//! [`Step`]: peace_cfg::Step +//! [`Item`]: peace_cfg::Item pub use self::{ apply_exec_cmd_block::ApplyExecCmdBlock, diff --git a/crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs b/crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs index 3df4c772d..f81310299 100644 --- a/crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/apply_exec_cmd_block.rs @@ -2,7 +2,7 @@ use std::{fmt::Debug, marker::PhantomData}; use fn_graph::{StreamOpts, StreamOutcome}; use futures::join; -use peace_cfg::{ApplyCheck, FnCtx, StepId}; +use peace_cfg::{ApplyCheck, FnCtx, ItemId}; use peace_cmd::{ctx::CmdCtxTypesConstrained, scopes::SingleProfileSingleFlowView}; use peace_cmd_model::CmdBlockOutcome; use peace_cmd_rt::{async_trait, CmdBlock}; @@ -17,8 +17,8 @@ use peace_resources::{ ResourceFetchError, Resources, }; use peace_rt_model::{ - outcomes::{StepApplyBoxed, StepApplyPartialBoxed}, - StepBoxed, StepRt, + outcomes::{ItemApplyBoxed, ItemApplyPartialBoxed}, + ItemBoxed, ItemRt, }; use tokio::sync::mpsc::{self, Receiver}; @@ -123,40 +123,40 @@ where /// up: /// /// ```rust,ignore - /// async fn step_apply_exec( + /// async fn item_apply_exec( /// resources: &Resources, - /// outcomes_tx: &Sender::AppError>>, - /// step: FnRef<'_, StepBoxed<::AppError>>, + /// outcomes_tx: &Sender::AppError>>, + /// item: FnRef<'_, ItemBoxed<::AppError>>, /// f: F, /// ) -> bool /// where - /// F: (Fn(&dyn StepRt<::AppError>, fn_ctx: OpCtx<'_>, &Resources, &mut StepApplyBoxed) -> Fut) + Copy, + /// F: (Fn(&dyn ItemRt<::AppError>, fn_ctx: OpCtx<'_>, &Resources, &mut ItemApplyBoxed) -> Fut) + Copy, /// Fut: Future::AppError>>, /// ``` - async fn step_apply_exec( - step_apply_exec_ctx: StepApplyExecCtx< + async fn item_apply_exec( + item_apply_exec_ctx: ItemApplyExecCtx< '_, ::AppError, >, - step: &StepBoxed<::AppError>, + item: &ItemBoxed<::AppError>, ) -> Result<(), ()> { - let StepApplyExecCtx { + let ItemApplyExecCtx { params_specs, resources, apply_for_internal, #[cfg(feature = "output_progress")] progress_tx, outcomes_tx, - } = step_apply_exec_ctx; + } = item_apply_exec_ctx; - let step_id = step.id(); + let item_id = item.id(); - // Indicate this step is running, so that an `Interrupt` message from + // Indicate this item is running, so that an `Interrupt` message from // `CmdExecution` does not cause it to be rendered as `Interrupted`. #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step_id.clone(), + item_id: item_id.clone(), progress_update: ProgressUpdate::Queued, msg_update: ProgressMsgUpdate::NoChange, } @@ -164,28 +164,28 @@ where ); let apply_fn = if StatesTs::dry_run() { - StepRt::apply_exec_dry + ItemRt::apply_exec_dry } else { - StepRt::apply_exec + ItemRt::apply_exec }; let fn_ctx = FnCtx::new( - step_id, + item_id, #[cfg(feature = "output_progress")] - ProgressSender::new(step_id, progress_tx), + ProgressSender::new(item_id, progress_tx), ); - let step_apply = match apply_for_internal { + let item_apply = match apply_for_internal { ApplyForInternal::Ensure => { - StepRt::ensure_prepare(&**step, params_specs, resources, fn_ctx).await + ItemRt::ensure_prepare(&**item, params_specs, resources, fn_ctx).await } ApplyForInternal::Clean { states_current } => { - StepRt::clean_prepare(&**step, states_current, params_specs, resources).await + ItemRt::clean_prepare(&**item, states_current, params_specs, resources).await } }; - match step_apply { - Ok(mut step_apply) => { - match step_apply.apply_check() { + match item_apply { + Ok(mut item_apply) => { + match item_apply.apply_check() { #[cfg(not(feature = "output_progress"))] ApplyCheck::ExecRequired => {} #[cfg(feature = "output_progress")] @@ -193,7 +193,7 @@ where // Update `OutputWrite`s with progress limit. let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step_id.clone(), + item_id: item_id.clone(), progress_update: ProgressUpdate::Limit(progress_limit), msg_update: ProgressMsgUpdate::Set(String::from("in progress")), } @@ -204,7 +204,7 @@ where #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step_id.clone(), + item_id: item_id.clone(), progress_update: ProgressUpdate::Complete( ProgressComplete::Success, ), @@ -217,9 +217,9 @@ where // In case of an interrupt or power failure, we may not have written states // to disk. outcomes_tx - .send(StepApplyOutcome::Success { - step_id: step.id().clone(), - step_apply, + .send(ItemApplyOutcome::Success { + item_id: item.id().clone(), + item_apply, }) .await .expect("unreachable: `outcomes_rx` is in a sibling task."); @@ -228,14 +228,14 @@ where return Ok(()); } } - match apply_fn(&**step, params_specs, resources, fn_ctx, &mut step_apply).await { + match apply_fn(&**item, params_specs, resources, fn_ctx, &mut item_apply).await { Ok(()) => { // apply succeeded #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step_id.clone(), + item_id: item_id.clone(), progress_update: ProgressUpdate::Complete( ProgressComplete::Success, ), @@ -245,9 +245,9 @@ where ); outcomes_tx - .send(StepApplyOutcome::Success { - step_id: step.id().clone(), - step_apply, + .send(ItemApplyOutcome::Success { + item_id: item.id().clone(), + item_apply, }) .await .expect("unreachable: `outcomes_rx` is in a sibling task."); @@ -260,7 +260,7 @@ where #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step_id.clone(), + item_id: item_id.clone(), progress_update: ProgressUpdate::Complete(ProgressComplete::Fail), msg_update: ProgressMsgUpdate::Set( error @@ -273,9 +273,9 @@ where ); outcomes_tx - .send(StepApplyOutcome::Fail { - step_id: step.id().clone(), - step_apply, + .send(ItemApplyOutcome::Fail { + item_id: item.id().clone(), + item_apply, error, }) .await @@ -286,11 +286,11 @@ where } } } - Err((error, step_apply_partial)) => { + Err((error, item_apply_partial)) => { #[cfg(feature = "output_progress")] let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step.id().clone(), + item_id: item.id().clone(), progress_update: ProgressUpdate::Complete(ProgressComplete::Fail), msg_update: ProgressMsgUpdate::Set( error @@ -303,9 +303,9 @@ where ); outcomes_tx - .send(StepApplyOutcome::PrepareFail { - step_id: step.id().clone(), - step_apply_partial, + .send(ItemApplyOutcome::PrepareFail { + item_id: item.id().clone(), + item_apply_partial, error, }) .await @@ -318,7 +318,7 @@ where async fn outcome_collate_task( mut outcomes_rx: Receiver< - StepApplyOutcome<::AppError>, + ItemApplyOutcome<::AppError>, >, mut states_applied_mut: StatesMut, mut states_target_mut: StatesMut, @@ -326,17 +326,17 @@ where ( States, States, - IndexMap::AppError>, + IndexMap::AppError>, ), ::AppError, > { let mut errors = IndexMap::new(); - while let Some(step_outcome) = outcomes_rx.recv().await { + while let Some(item_outcome) = outcomes_rx.recv().await { Self::outcome_collate( &mut states_applied_mut, &mut states_target_mut, &mut errors, - step_outcome, + item_outcome, )?; } @@ -349,38 +349,38 @@ where fn outcome_collate( states_applied_mut: &mut StatesMut, states_target_mut: &mut StatesMut, - errors: &mut IndexMap::AppError>, - outcome_partial: StepApplyOutcome<::AppError>, + errors: &mut IndexMap::AppError>, + outcome_partial: ItemApplyOutcome<::AppError>, ) -> Result<(), ::AppError> { let apply_for = StatesTs::apply_for(); match outcome_partial { - StepApplyOutcome::PrepareFail { - step_id, - step_apply_partial, + ItemApplyOutcome::PrepareFail { + item_id, + item_apply_partial, error, } => { - errors.insert(step_id.clone(), error); + errors.insert(item_id.clone(), error); // Save `state_target` (which is `state_goal`) if we are not cleaning // up. match apply_for { ApplyFor::Ensure => { - if let Some(state_target) = step_apply_partial.state_target() { - states_target_mut.insert_raw(step_id, state_target); + if let Some(state_target) = item_apply_partial.state_target() { + states_target_mut.insert_raw(item_id, state_target); } } ApplyFor::Clean => {} } } - StepApplyOutcome::Success { - step_id, - step_apply, + ItemApplyOutcome::Success { + item_id, + item_apply, } => { - if let Some(state_applied) = step_apply.state_applied() { - states_applied_mut.insert_raw(step_id.clone(), state_applied); + if let Some(state_applied) = item_apply.state_applied() { + states_applied_mut.insert_raw(item_id.clone(), state_applied); } else { - // Step was already in the goal state. + // Item was already in the goal state. // No change to current state. } @@ -388,28 +388,28 @@ where // up. match apply_for { ApplyFor::Ensure => { - let state_target = step_apply.state_target(); - states_target_mut.insert_raw(step_id, state_target); + let state_target = item_apply.state_target(); + states_target_mut.insert_raw(item_id, state_target); } ApplyFor::Clean => {} } } - StepApplyOutcome::Fail { - step_id, - step_apply, + ItemApplyOutcome::Fail { + item_id, + item_apply, error, } => { - errors.insert(step_id.clone(), error); - if let Some(state_applied) = step_apply.state_applied() { - states_applied_mut.insert_raw(step_id.clone(), state_applied); + errors.insert(item_id.clone(), error); + if let Some(state_applied) = item_apply.state_applied() { + states_applied_mut.insert_raw(item_id.clone(), state_applied); } // Save `state_target` (which is state_target) if we are not cleaning // up. match apply_for { ApplyFor::Ensure => { - let state_target = step_apply.state_target(); - states_target_mut.insert_raw(step_id, state_target); + let state_target = item_apply.state_target(); + states_target_mut.insert_raw(item_id, state_target); } ApplyFor::Clean => {} } @@ -493,7 +493,7 @@ where .. } = cmd_view; - let step_graph = flow.graph(); + let item_graph = flow.graph(); let resources_ref = &*resources; let apply_for = StatesTs::apply_for(); let apply_for_internal = match apply_for { @@ -502,8 +502,8 @@ where }; let (outcomes_tx, outcomes_rx) = mpsc::channel::< - StepApplyOutcome<::AppError>, - >(step_graph.node_count()); + ItemApplyOutcome<::AppError>, + >(item_graph.node_count()); let stream_opts = { let stream_opts = StreamOpts::new() @@ -516,10 +516,10 @@ where }; let (stream_outcome_result, outcome_collate) = { - let step_apply_exec_task = async move { - let stream_outcome = step_graph - .try_for_each_concurrent_with(BUFFERED_FUTURES_MAX, stream_opts, |step| { - let step_apply_exec_ctx = StepApplyExecCtx { + let item_apply_exec_task = async move { + let stream_outcome = item_graph + .try_for_each_concurrent_with(BUFFERED_FUTURES_MAX, stream_opts, |item| { + let item_apply_exec_ctx = ItemApplyExecCtx { params_specs, resources: resources_ref, apply_for_internal: &apply_for_internal, @@ -527,7 +527,7 @@ where progress_tx, outcomes_tx: &outcomes_tx, }; - Self::step_apply_exec(step_apply_exec_ctx, step) + Self::item_apply_exec(item_apply_exec_ctx, item) }) .await; @@ -538,7 +538,7 @@ where let outcome_collate_task = Self::outcome_collate_task(outcomes_rx, states_applied_mut, states_target_mut); - join!(step_apply_exec_task, outcome_collate_task) + join!(item_apply_exec_task, outcome_collate_task) }; let (states_applied, states_target, errors) = outcome_collate?; @@ -550,7 +550,7 @@ where stream_outcome.map(|()| (states_previous, states_applied, states_target)) }; - Ok(CmdBlockOutcome::StepWise { + Ok(CmdBlockOutcome::ItemWise { stream_outcome, errors, }) @@ -573,37 +573,37 @@ enum ApplyForInternal { Clean { states_current: StatesCurrent }, } -struct StepApplyExecCtx<'f, E> { - /// Map of step ID to its params' specs. +struct ItemApplyExecCtx<'f, E> { + /// Map of item ID to its params' specs. params_specs: &'f ParamsSpecs, /// Map of all types at runtime. resources: &'f Resources, /// Whether the `ApplyCmd` is for `Ensure` or `Clean`. apply_for_internal: &'f ApplyForInternal, - /// Channel sender for `CmdBlock` step outcomes. + /// Channel sender for `CmdBlock` item outcomes. #[cfg(feature = "output_progress")] progress_tx: &'f Sender, - outcomes_tx: &'f Sender>, + outcomes_tx: &'f Sender>, } #[derive(Debug)] -pub enum StepApplyOutcome { +pub enum ItemApplyOutcome { /// Error occurred when discovering current state, goal states, state /// diff, or `ApplyCheck`. PrepareFail { - step_id: StepId, - step_apply_partial: StepApplyPartialBoxed, + item_id: ItemId, + item_apply_partial: ItemApplyPartialBoxed, error: E, }, /// Ensure execution succeeded. Success { - step_id: StepId, - step_apply: StepApplyBoxed, + item_id: ItemId, + item_apply: ItemApplyBoxed, }, /// Ensure execution failed. Fail { - step_id: StepId, - step_apply: StepApplyBoxed, + item_id: ItemId, + item_apply: ItemApplyBoxed, error: E, }, } diff --git a/crate/rt/src/cmd_blocks/apply_state_sync_check_cmd_block.rs b/crate/rt/src/cmd_blocks/apply_state_sync_check_cmd_block.rs index 36567f79d..98d5a52c2 100644 --- a/crate/rt/src/cmd_blocks/apply_state_sync_check_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/apply_state_sync_check_cmd_block.rs @@ -9,7 +9,7 @@ use peace_resources::{ ResourceFetchError, Resources, }; use peace_rt_model::Error; -use peace_rt_model_core::{ApplyCmdError, StepsStateStoredStale, StateStoredAndDiscovered}; +use peace_rt_model_core::{ApplyCmdError, ItemsStateStoredStale, StateStoredAndDiscovered}; cfg_if::cfg_if! { if #[cfg(feature = "output_progress")] { @@ -122,42 +122,42 @@ impl where CmdCtxTypesT: CmdCtxTypesConstrained, { - fn steps_state_stored_stale( + fn items_state_stored_stale( cmd_view: &SingleProfileSingleFlowView<'_, CmdCtxTypesT>, states_stored: &States, states_discovered: &States, #[cfg(feature = "output_progress")] progress_tx: &Sender, - ) -> Result::AppError> { - let steps_state_stored_stale = cmd_view.flow.graph().iter_insertion().try_fold( - StepsStateStoredStale::new(), - |mut steps_state_stored_stale, step_rt| { - let step_id = step_rt.id(); - let state_stored = states_stored.get_raw(step_id); - let state_discovered = states_discovered.get_raw(step_id); + ) -> Result::AppError> { + let items_state_stored_stale = cmd_view.flow.graph().iter_insertion().try_fold( + ItemsStateStoredStale::new(), + |mut items_state_stored_stale, item_rt| { + let item_id = item_rt.id(); + let state_stored = states_stored.get_raw(item_id); + let state_discovered = states_discovered.get_raw(item_id); match (state_stored, state_discovered) { (None, None) => { - // Step not discoverable, may be dependent on + // Item not discoverable, may be dependent on // predecessor } (None, Some(state_discovered)) => { - let step_id = step_id.clone(); + let item_id = item_id.clone(); let state_discovered = state_discovered.clone(); - steps_state_stored_stale.insert( - step_id, + items_state_stored_stale.insert( + item_id, StateStoredAndDiscovered::OnlyDiscoveredExists { state_discovered }, ); } (Some(state_stored), None) => { - let step_id = step_id.clone(); + let item_id = item_id.clone(); let state_stored = state_stored.clone(); - steps_state_stored_stale.insert( - step_id, + items_state_stored_stale.insert( + item_id, StateStoredAndDiscovered::OnlyStoredExists { state_stored }, ); } (Some(state_stored), Some(state_discovered)) => { - let state_eq = step_rt.state_eq(state_stored, state_discovered); + let state_eq = item_rt.state_eq(state_stored, state_discovered); match state_eq { Ok(true) => { #[cfg(feature = "output_progress")] @@ -165,7 +165,7 @@ where let state_type = tynm::type_name::(); let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step_id.clone(), + item_id: item_id.clone(), progress_update: ProgressUpdate::Delta( ProgressDelta::Tick, ), @@ -183,7 +183,7 @@ where let state_type = tynm::type_name::(); let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step_id.clone(), + item_id: item_id.clone(), progress_update: ProgressUpdate::Complete( ProgressComplete::Fail, ), @@ -195,11 +195,11 @@ where ); } - let step_id = step_id.clone(); + let item_id = item_id.clone(); let state_stored = state_stored.clone(); let state_discovered = state_discovered.clone(); - steps_state_stored_stale.insert( - step_id, + items_state_stored_stale.insert( + item_id, StateStoredAndDiscovered::ValuesDiffer { state_stored, state_discovered, @@ -211,11 +211,11 @@ where } } - Ok(steps_state_stored_stale) + Ok(items_state_stored_stale) }, )?; - Ok(steps_state_stored_stale) + Ok(items_state_stored_stale) } } @@ -303,7 +303,7 @@ where > { let (states_current_stored, states_current) = &mut input; - let state_current_stale_result = Self::steps_state_stored_stale( + let state_current_stale_result = Self::items_state_stored_stale( cmd_view, states_current_stored, states_current, @@ -311,12 +311,12 @@ where progress_tx, ); match state_current_stale_result { - Ok(steps_state_stored_stale) => { - if steps_state_stored_stale.stale() { + Ok(items_state_stored_stale) => { + if items_state_stored_stale.stale() { return outcome_collate( input, OutcomeResult::StatesCurrentOutOfSync { - steps_state_stored_stale, + items_state_stored_stale, }, ); } @@ -377,7 +377,7 @@ where > { let (states_goal_stored, states_goal) = &mut input; - let state_goal_stale_result = Self::steps_state_stored_stale( + let state_goal_stale_result = Self::items_state_stored_stale( cmd_view, states_goal_stored, states_goal, @@ -385,12 +385,12 @@ where progress_tx, ); match state_goal_stale_result { - Ok(steps_state_stored_stale) => { - if steps_state_stored_stale.stale() { + Ok(items_state_stored_stale) => { + if items_state_stored_stale.stale() { return outcome_collate( input, OutcomeResult::StatesGoalOutOfSync { - steps_state_stored_stale, + items_state_stored_stale, }, ); } @@ -471,7 +471,7 @@ where > { let (states_current_stored, states_current, states_goal_stored, states_goal) = &mut input; - let state_current_stale_result = Self::steps_state_stored_stale( + let state_current_stale_result = Self::items_state_stored_stale( cmd_view, states_current_stored, states_current, @@ -479,12 +479,12 @@ where progress_tx, ); match state_current_stale_result { - Ok(steps_state_stored_stale) => { - if steps_state_stored_stale.stale() { + Ok(items_state_stored_stale) => { + if items_state_stored_stale.stale() { return outcome_collate( input, OutcomeResult::StatesCurrentOutOfSync { - steps_state_stored_stale, + items_state_stored_stale, }, ); } @@ -494,7 +494,7 @@ where } }; - let state_goal_stale_result = Self::steps_state_stored_stale( + let state_goal_stale_result = Self::items_state_stored_stale( cmd_view, states_goal_stored, states_goal, @@ -502,12 +502,12 @@ where progress_tx, ); match state_goal_stale_result { - Ok(steps_state_stored_stale) => { - if steps_state_stored_stale.stale() { + Ok(items_state_stored_stale) => { + if items_state_stored_stale.stale() { return outcome_collate( input, OutcomeResult::StatesGoalOutOfSync { - steps_state_stored_stale, + items_state_stored_stale, }, ); } @@ -527,17 +527,17 @@ enum OutcomeResult { Ok, /// Stored current states are not in sync with the actual current state. StatesCurrentOutOfSync { - /// Steps whose stored current state is out of sync with the discovered + /// Items whose stored current state is out of sync with the discovered /// state. - steps_state_stored_stale: StepsStateStoredStale, + items_state_stored_stale: ItemsStateStoredStale, }, /// Stored goal states are not in sync with the actual goal state. StatesGoalOutOfSync { - /// Steps whose stored goal state is out of sync with the discovered + /// Items whose stored goal state is out of sync with the discovered /// state. - steps_state_stored_stale: StepsStateStoredStale, + items_state_stored_stale: ItemsStateStoredStale, }, - /// Error downcasting a boxed step state to its concrete stype. + /// Error downcasting a boxed item state to its concrete stype. StatesDowncastError { /// The error from state downcast. error: E, @@ -574,17 +574,17 @@ where match outcome_result { OutcomeResult::Ok => Ok(CmdBlockOutcome::Single(states_stored_and_discovered)), OutcomeResult::StatesCurrentOutOfSync { - steps_state_stored_stale, + items_state_stored_stale, } => Err(AppErrorT::from(Error::ApplyCmdError( ApplyCmdError::StatesCurrentOutOfSync { - steps_state_stored_stale, + items_state_stored_stale, }, ))), OutcomeResult::StatesGoalOutOfSync { - steps_state_stored_stale, + items_state_stored_stale, } => Err(AppErrorT::from(Error::ApplyCmdError( ApplyCmdError::StatesGoalOutOfSync { - steps_state_stored_stale, + items_state_stored_stale, }, ))), OutcomeResult::StatesDowncastError { error } => Err(error), diff --git a/crate/rt/src/cmd_blocks/diff_cmd_block.rs b/crate/rt/src/cmd_blocks/diff_cmd_block.rs index 71ed6ddf3..7c551b57b 100644 --- a/crate/rt/src/cmd_blocks/diff_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/diff_cmd_block.rs @@ -2,7 +2,7 @@ use std::{fmt::Debug, marker::PhantomData}; use fn_graph::{StreamOpts, StreamOutcome}; use futures::FutureExt; -use peace_cfg::StepId; +use peace_cfg::ItemId; use peace_cmd::{ ctx::CmdCtxTypesConstrained, interruptible::InterruptibilityState, scopes::SingleProfileSingleFlowView, @@ -54,21 +54,21 @@ impl DiffCmdBlock, flow: &Flow<::AppError>, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result, ::AppError> { let stream_outcome_result = flow .graph() @@ -77,16 +77,16 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state) .interrupted_next_item_include(false), - |mut state_diffs_mut, step| { + |mut state_diffs_mut, item| { async move { let _params_specs = ¶ms_specs; - let state_diff_opt = step + let state_diff_opt = item .state_diff_exec(params_specs, resources, states_a, states_b) .await?; if let Some(state_diff) = state_diff_opt { - state_diffs_mut.insert_raw(step.id().clone(), state_diff); + state_diffs_mut.insert_raw(item.id().clone(), state_diff); } Result::<_, ::AppError>::Ok( @@ -184,7 +184,7 @@ where .await? .map(move |state_diffs| (state_diffs, (states_ts0, states_ts1))); - Ok(CmdBlockOutcome::new_step_wise(stream_outcome)) + Ok(CmdBlockOutcome::new_item_wise(stream_outcome)) } } diff --git a/crate/rt/src/cmd_blocks/states_clean_insertion_cmd_block.rs b/crate/rt/src/cmd_blocks/states_clean_insertion_cmd_block.rs index 888b9539c..4b7101241 100644 --- a/crate/rt/src/cmd_blocks/states_clean_insertion_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/states_clean_insertion_cmd_block.rs @@ -20,9 +20,9 @@ cfg_if::cfg_if! { } } -/// Inserts [`StatesClean`]s for each step. +/// Inserts [`StatesClean`]s for each item. /// -/// This calls [`Step::state_clean`] for each step, and groups them together +/// This calls [`Item::state_clean`] for each item, and groups them together /// into `StatesClean`. #[derive(Debug)] pub struct StatesCleanInsertionCmdBlock(PhantomData); @@ -86,18 +86,18 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state.reborrow()) .interrupted_next_item_include(false), - |(mut states_clean_mut, mut errors), step_rt| { + |(mut states_clean_mut, mut errors), item_rt| { async move { - let step_id = step_rt.id().clone(); + let item_id = item_rt.id().clone(); let state_clean_boxed_result = - step_rt.state_clean(params_specs, resources).await; + item_rt.state_clean(params_specs, resources).await; match state_clean_boxed_result { Ok(state_clean_boxed) => { - states_clean_mut.insert_raw(step_id, state_clean_boxed); + states_clean_mut.insert_raw(item_id, state_clean_boxed); } Err(error) => { - errors.insert(step_id, error); + errors.insert(item_id, error); } } @@ -111,7 +111,7 @@ where let stream_outcome = stream_outcome.map(StatesClean::from); - Ok(CmdBlockOutcome::StepWise { + Ok(CmdBlockOutcome::ItemWise { stream_outcome, errors, }) diff --git a/crate/rt/src/cmd_blocks/states_current_read_cmd_block.rs b/crate/rt/src/cmd_blocks/states_current_read_cmd_block.rs index 008c9909e..93ebb1751 100644 --- a/crate/rt/src/cmd_blocks/states_current_read_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/states_current_read_cmd_block.rs @@ -1,6 +1,6 @@ use std::{fmt::Debug, marker::PhantomData}; -use peace_cfg::{FlowId, StepId}; +use peace_cfg::{FlowId, ItemId}; use peace_cmd::{ctx::CmdCtxTypesConstrained, scopes::SingleProfileSingleFlowView}; use peace_cmd_model::CmdBlockOutcome; use peace_cmd_rt::{async_trait, CmdBlock}; @@ -41,7 +41,7 @@ where pub(crate) async fn deserialize_internal( resources: &mut Resources, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, ) -> Result::AppError> { let flow_id = resources.borrow::(); let flow_dir = resources.borrow::(); diff --git a/crate/rt/src/cmd_blocks/states_discover_cmd_block.rs b/crate/rt/src/cmd_blocks/states_discover_cmd_block.rs index b4f374f3d..5d44ad563 100644 --- a/crate/rt/src/cmd_blocks/states_discover_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/states_discover_cmd_block.rs @@ -1,7 +1,7 @@ use std::{fmt::Debug, marker::PhantomData}; use futures::join; -use peace_cfg::{FnCtx, StepId}; +use peace_cfg::{FnCtx, ItemId}; use peace_cmd::{ctx::CmdCtxTypesConstrained, scopes::SingleProfileSingleFlowView}; use peace_cmd_model::CmdBlockOutcome; use peace_cmd_rt::{async_trait, CmdBlock}; @@ -15,7 +15,7 @@ use peace_resources::{ type_reg::untagged::BoxDtDisplay, ResourceFetchError, Resources, }; -use peace_rt_model::{fn_graph::StreamOpts, StepBoxed}; +use peace_rt_model::{fn_graph::StreamOpts, ItemBoxed}; use peace_rt_model_core::IndexMap; use tokio::sync::mpsc::{self, Receiver}; @@ -129,25 +129,25 @@ where self } - async fn step_states_discover( + async fn item_states_discover( #[cfg(feature = "output_progress")] progress_tx: &Sender, #[cfg(feature = "output_progress")] progress_complete_on_success: bool, params_specs: &peace_params::ParamsSpecs, resources: &Resources, outcomes_tx: &tokio::sync::mpsc::Sender< - StepDiscoverOutcome<::AppError>, + ItemDiscoverOutcome<::AppError>, >, - step: &StepBoxed<::AppError>, + item: &ItemBoxed<::AppError>, ) { - let step_id = step.id(); + let item_id = item.id(); let fn_ctx = FnCtx::new( - step_id, + item_id, #[cfg(feature = "output_progress")] - ProgressSender::new(step_id, progress_tx), + ProgressSender::new(item_id, progress_tx), ); let (states_current_result, states_goal_result) = - DiscoverFor::discover(step, params_specs, resources, fn_ctx).await; + DiscoverFor::discover(item, params_specs, resources, fn_ctx).await; // Send progress update. #[cfg(feature = "output_progress")] @@ -156,15 +156,15 @@ where states_current_result.as_ref(), states_goal_result.as_ref(), progress_tx, - step_id, + item_id, ); - let mut step_error = None; + let mut item_error = None; let state_current = if let Some(states_current_result) = states_current_result { match states_current_result { Ok(state_current_opt) => state_current_opt, Err(error) => { - step_error = Some(error); + item_error = Some(error); None } } @@ -179,8 +179,8 @@ where // It's probably more crucial to store the // `states_current` // error than the states goal error, if both err. - if step_error.is_none() { - step_error = Some(error); + if item_error.is_none() { + item_error = Some(error); } None } @@ -189,10 +189,10 @@ where None }; - if let Some(error) = step_error { + if let Some(error) = item_error { outcomes_tx - .send(StepDiscoverOutcome::Fail { - step_id: step_id.clone(), + .send(ItemDiscoverOutcome::Fail { + item_id: item_id.clone(), state_current, state_goal, error, @@ -201,8 +201,8 @@ where .expect("unreachable: `outcomes_rx` is in a sibling task."); } else { outcomes_tx - .send(StepDiscoverOutcome::Success { - step_id: step_id.clone(), + .send(ItemDiscoverOutcome::Success { + item_id: item_id.clone(), state_current, state_goal, }) @@ -221,7 +221,7 @@ where &Result, ::AppError>, >, progress_tx: &Sender, - step_id: &StepId, + item_id: &ItemId, ) { if let Some((progress_update, msg_update)) = DiscoverFor::progress_update( progress_complete_on_success, @@ -230,7 +230,7 @@ where ) { let _progress_send_unused = progress_tx.try_send( ProgressUpdateAndId { - step_id: step_id.clone(), + item_id: item_id.clone(), progress_update, msg_update, } @@ -241,16 +241,16 @@ where } #[derive(Debug)] -pub enum StepDiscoverOutcome { +pub enum ItemDiscoverOutcome { /// Discover succeeded. Success { - step_id: StepId, + item_id: ItemId, state_current: Option, state_goal: Option, }, /// Discover failed. Fail { - step_id: StepId, + item_id: ItemId, state_current: Option, state_goal: Option, error: AppErrorT, @@ -292,13 +292,13 @@ where } = cmd_view; let (outcomes_tx, outcomes_rx) = mpsc::channel::< - StepDiscoverOutcome<::AppError>, + ItemDiscoverOutcome<::AppError>, >(flow.graph().node_count()); let (stream_outcome, outcome_collate) = { let states_current_mut = StatesMut::::with_capacity(flow.graph().node_count()); - let step_states_discover_task = async move { + let item_states_discover_task = async move { let stream_outcome = flow .graph() .for_each_concurrent_with( @@ -306,8 +306,8 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state.reborrow()) .interrupted_next_item_include(false), - |step| { - Self::step_states_discover( + |item| { + Self::item_states_discover( #[cfg(feature = "output_progress")] progress_tx, #[cfg(feature = "output_progress")] @@ -315,7 +315,7 @@ where params_specs, resources, &outcomes_tx, - step, + item, ) }, ) @@ -328,12 +328,12 @@ where let outcome_collate_task = Self::outcome_collate_task(outcomes_rx, states_current_mut); - join!(step_states_discover_task, outcome_collate_task) + join!(item_states_discover_task, outcome_collate_task) }; outcome_collate.map(|(states_current, errors)| { let (stream_outcome, ()) = stream_outcome.replace(states_current); - CmdBlockOutcome::StepWise { + CmdBlockOutcome::ItemWise { stream_outcome, errors, } @@ -347,19 +347,19 @@ where { async fn outcome_collate_task( mut outcomes_rx: Receiver< - StepDiscoverOutcome<::AppError>, + ItemDiscoverOutcome<::AppError>, >, mut states_current_mut: StatesMut, ) -> Result< ( States, - IndexMap::AppError>, + IndexMap::AppError>, ), ::AppError, > { let mut errors = IndexMap::new(); - while let Some(step_outcome) = outcomes_rx.recv().await { - Self::outcome_collate(&mut states_current_mut, &mut errors, step_outcome)?; + while let Some(item_outcome) = outcomes_rx.recv().await { + Self::outcome_collate(&mut states_current_mut, &mut errors, item_outcome)?; } let states_current = States::::from(states_current_mut); @@ -369,29 +369,29 @@ where fn outcome_collate( states_current_mut: &mut StatesMut, - errors: &mut IndexMap::AppError>, - outcome_partial: StepDiscoverOutcome<::AppError>, + errors: &mut IndexMap::AppError>, + outcome_partial: ItemDiscoverOutcome<::AppError>, ) -> Result<(), ::AppError> { match outcome_partial { - StepDiscoverOutcome::Success { - step_id, + ItemDiscoverOutcome::Success { + item_id, state_current, state_goal: _, } => { if let Some(state_current) = state_current { - states_current_mut.insert_raw(step_id.clone(), state_current); + states_current_mut.insert_raw(item_id.clone(), state_current); } } - StepDiscoverOutcome::Fail { - step_id, + ItemDiscoverOutcome::Fail { + item_id, state_current, state_goal: _, error, } => { - errors.insert(step_id.clone(), error); + errors.insert(item_id.clone(), error); if let Some(state_current) = state_current { - states_current_mut.insert_raw(step_id.clone(), state_current); + states_current_mut.insert_raw(item_id.clone(), state_current); } } } @@ -435,13 +435,13 @@ where } = cmd_view; let (outcomes_tx, outcomes_rx) = mpsc::channel::< - StepDiscoverOutcome<::AppError>, + ItemDiscoverOutcome<::AppError>, >(flow.graph().node_count()); let (stream_outcome, outcome_collate) = { let states_goal_mut = StatesMut::::with_capacity(flow.graph().node_count()); - let step_states_discover_task = async move { + let item_states_discover_task = async move { let stream_outcome = flow .graph() .for_each_concurrent_with( @@ -449,8 +449,8 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state.reborrow()) .interrupted_next_item_include(false), - |step| { - Self::step_states_discover( + |item| { + Self::item_states_discover( #[cfg(feature = "output_progress")] progress_tx, #[cfg(feature = "output_progress")] @@ -458,7 +458,7 @@ where params_specs, resources, &outcomes_tx, - step, + item, ) }, ) @@ -471,12 +471,12 @@ where let outcome_collate_task = Self::outcome_collate_task(outcomes_rx, states_goal_mut); - join!(step_states_discover_task, outcome_collate_task) + join!(item_states_discover_task, outcome_collate_task) }; outcome_collate.map(|(states_goal, errors)| { let (stream_outcome, ()) = stream_outcome.replace(states_goal); - CmdBlockOutcome::StepWise { + CmdBlockOutcome::ItemWise { stream_outcome, errors, } @@ -490,19 +490,19 @@ where { async fn outcome_collate_task( mut outcomes_rx: Receiver< - StepDiscoverOutcome<::AppError>, + ItemDiscoverOutcome<::AppError>, >, mut states_goal_mut: StatesMut, ) -> Result< ( States, - IndexMap::AppError>, + IndexMap::AppError>, ), ::AppError, > { let mut errors = IndexMap::new(); - while let Some(step_outcome) = outcomes_rx.recv().await { - Self::outcome_collate(&mut states_goal_mut, &mut errors, step_outcome)?; + while let Some(item_outcome) = outcomes_rx.recv().await { + Self::outcome_collate(&mut states_goal_mut, &mut errors, item_outcome)?; } let states_goal = States::::from(states_goal_mut); @@ -512,29 +512,29 @@ where fn outcome_collate( states_goal_mut: &mut StatesMut, - errors: &mut IndexMap::AppError>, - outcome_partial: StepDiscoverOutcome<::AppError>, + errors: &mut IndexMap::AppError>, + outcome_partial: ItemDiscoverOutcome<::AppError>, ) -> Result<(), ::AppError> { match outcome_partial { - StepDiscoverOutcome::Success { - step_id, + ItemDiscoverOutcome::Success { + item_id, state_current: _, state_goal, } => { if let Some(state_goal) = state_goal { - states_goal_mut.insert_raw(step_id, state_goal); + states_goal_mut.insert_raw(item_id, state_goal); } } - StepDiscoverOutcome::Fail { - step_id, + ItemDiscoverOutcome::Fail { + item_id, state_current: _, state_goal, error, } => { - errors.insert(step_id.clone(), error); + errors.insert(item_id.clone(), error); if let Some(state_goal) = state_goal { - states_goal_mut.insert_raw(step_id, state_goal); + states_goal_mut.insert_raw(item_id, state_goal); } } } @@ -591,14 +591,14 @@ where } = cmd_view; let (outcomes_tx, outcomes_rx) = mpsc::channel::< - StepDiscoverOutcome<::AppError>, + ItemDiscoverOutcome<::AppError>, >(flow.graph().node_count()); let (stream_outcome, outcome_collate) = { let states_current_mut = StatesMut::::with_capacity(flow.graph().node_count()); let states_goal_mut = StatesMut::::with_capacity(flow.graph().node_count()); - let step_states_discover_task = async move { + let item_states_discover_task = async move { let stream_outcome = flow .graph() .for_each_concurrent_with( @@ -606,8 +606,8 @@ where StreamOpts::new() .interruptibility_state(interruptibility_state.reborrow()) .interrupted_next_item_include(false), - |step| { - Self::step_states_discover( + |item| { + Self::item_states_discover( #[cfg(feature = "output_progress")] progress_tx, #[cfg(feature = "output_progress")] @@ -615,7 +615,7 @@ where params_specs, resources, &outcomes_tx, - step, + item, ) }, ) @@ -629,12 +629,12 @@ where let outcome_collate_task = Self::outcome_collate_task(outcomes_rx, states_current_mut, states_goal_mut); - join!(step_states_discover_task, outcome_collate_task) + join!(item_states_discover_task, outcome_collate_task) }; outcome_collate.map(|(states_current, states_goal, errors)| { let (stream_outcome, ()) = stream_outcome.replace((states_current, states_goal)); - CmdBlockOutcome::StepWise { + CmdBlockOutcome::ItemWise { stream_outcome, errors, } @@ -648,7 +648,7 @@ where { async fn outcome_collate_task( mut outcomes_rx: Receiver< - StepDiscoverOutcome<::AppError>, + ItemDiscoverOutcome<::AppError>, >, mut states_current_mut: StatesMut, mut states_goal_mut: StatesMut, @@ -656,17 +656,17 @@ where ( States, States, - IndexMap::AppError>, + IndexMap::AppError>, ), ::AppError, > { let mut errors = IndexMap::new(); - while let Some(step_outcome) = outcomes_rx.recv().await { + while let Some(item_outcome) = outcomes_rx.recv().await { Self::outcome_collate( &mut states_current_mut, &mut states_goal_mut, &mut errors, - step_outcome, + item_outcome, )?; } @@ -679,35 +679,35 @@ where fn outcome_collate( states_current_mut: &mut StatesMut, states_goal_mut: &mut StatesMut, - errors: &mut IndexMap::AppError>, - outcome_partial: StepDiscoverOutcome<::AppError>, + errors: &mut IndexMap::AppError>, + outcome_partial: ItemDiscoverOutcome<::AppError>, ) -> Result<(), ::AppError> { match outcome_partial { - StepDiscoverOutcome::Success { - step_id, + ItemDiscoverOutcome::Success { + item_id, state_current, state_goal, } => { if let Some(state_current) = state_current { - states_current_mut.insert_raw(step_id.clone(), state_current); + states_current_mut.insert_raw(item_id.clone(), state_current); } if let Some(state_goal) = state_goal { - states_goal_mut.insert_raw(step_id, state_goal); + states_goal_mut.insert_raw(item_id, state_goal); } } - StepDiscoverOutcome::Fail { - step_id, + ItemDiscoverOutcome::Fail { + item_id, state_current, state_goal, error, } => { - errors.insert(step_id.clone(), error); + errors.insert(item_id.clone(), error); if let Some(state_current) = state_current { - states_current_mut.insert_raw(step_id.clone(), state_current); + states_current_mut.insert_raw(item_id.clone(), state_current); } if let Some(state_goal) = state_goal { - states_goal_mut.insert_raw(step_id, state_goal); + states_goal_mut.insert_raw(item_id, state_goal); } } } @@ -720,7 +720,7 @@ where #[async_trait::async_trait(?Send)] pub trait Discover { async fn discover( - step: &StepBoxed, + item: &ItemBoxed, params_specs: &peace_params::ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, @@ -744,7 +744,7 @@ pub trait Discover { #[async_trait::async_trait(?Send)] impl Discover for DiscoverForCurrent { async fn discover( - step: &StepBoxed, + item: &ItemBoxed, params_specs: &peace_params::ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, @@ -755,7 +755,7 @@ impl Discover for DiscoverForCurrent { where AppErrorT: peace_value_traits::AppError + From, { - let states_current_result = step + let states_current_result = item .state_current_try_exec(params_specs, resources, fn_ctx) .await; @@ -792,7 +792,7 @@ impl Discover for DiscoverForCurrent { #[async_trait::async_trait(?Send)] impl Discover for DiscoverForGoal { async fn discover( - step: &StepBoxed, + item: &ItemBoxed, params_specs: &peace_params::ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, @@ -803,7 +803,7 @@ impl Discover for DiscoverForGoal { where AppErrorT: peace_value_traits::AppError + From, { - let states_goal_result = step + let states_goal_result = item .state_goal_try_exec(params_specs, resources, fn_ctx) .await; @@ -840,7 +840,7 @@ impl Discover for DiscoverForGoal { #[async_trait::async_trait(?Send)] impl Discover for DiscoverForCurrentAndGoal { async fn discover( - step: &StepBoxed, + item: &ItemBoxed, params_specs: &peace_params::ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, @@ -851,10 +851,10 @@ impl Discover for DiscoverForCurrentAndGoal { where AppErrorT: peace_value_traits::AppError + From, { - let states_current_result = step + let states_current_result = item .state_current_try_exec(params_specs, resources, fn_ctx) .await; - let states_goal_result = step + let states_goal_result = item .state_goal_try_exec(params_specs, resources, fn_ctx) .await; diff --git a/crate/rt/src/cmd_blocks/states_goal_read_cmd_block.rs b/crate/rt/src/cmd_blocks/states_goal_read_cmd_block.rs index c2cb5dd60..8086ca396 100644 --- a/crate/rt/src/cmd_blocks/states_goal_read_cmd_block.rs +++ b/crate/rt/src/cmd_blocks/states_goal_read_cmd_block.rs @@ -1,6 +1,6 @@ use std::{fmt::Debug, marker::PhantomData}; -use peace_cfg::{FlowId, StepId}; +use peace_cfg::{FlowId, ItemId}; use peace_cmd::{ctx::CmdCtxTypesConstrained, scopes::SingleProfileSingleFlowView}; use peace_cmd_model::CmdBlockOutcome; use peace_cmd_rt::{async_trait, CmdBlock}; @@ -41,7 +41,7 @@ where pub(crate) async fn deserialize_internal( resources: &mut Resources, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, ) -> Result::AppError> { let flow_id = resources.borrow::(); let flow_dir = resources.borrow::(); diff --git a/crate/rt/src/cmds/clean_cmd.rs b/crate/rt/src/cmds/clean_cmd.rs index 22cd64d84..2cde8f007 100644 --- a/crate/rt/src/cmds/clean_cmd.rs +++ b/crate/rt/src/cmds/clean_cmd.rs @@ -12,7 +12,7 @@ use peace_resources::{ states::{States, StatesCleaned, StatesCleanedDry, StatesPrevious}, Resources, }; -use peace_rt_model::{StepGraph, Storage}; +use peace_rt_model::{ItemGraph, Storage}; use crate::{ cmd_blocks::{ @@ -29,37 +29,37 @@ impl CleanCmd where CmdCtxTypesT: CmdCtxTypesConstrained, { - /// Conditionally runs [`Step::apply_exec_dry`] for each [`Step`]. + /// Conditionally runs [`Item::apply_exec_dry`] for each [`Item`]. /// - /// In practice this runs [`Step::apply_check`], and only runs + /// In practice this runs [`Item::apply_check`], and only runs /// [`apply_exec_dry`] if execution is required. /// /// # Design /// - /// The grouping of step functions run for a `Clean` execution to work + /// The grouping of item functions run for a `Clean` execution to work /// is as follows: /// - /// 1. Run [`StatesDiscoverCmd::current`] for all `Step`s in the *forward* + /// 1. Run [`StatesDiscoverCmd::current`] for all `Item`s in the *forward* /// direction. /// /// This populates `resources` with `Current`, needed for - /// `Step::try_state_current` during `StepRt::clean_prepare`. + /// `Item::try_state_current` during `ItemRt::clean_prepare`. /// - /// 2. In the *reverse* direction, for each `Step` run - /// `StepRt::clean_prepare`, which runs: + /// 2. In the *reverse* direction, for each `Item` run + /// `ItemRt::clean_prepare`, which runs: /// - /// 1. `Step::try_state_current`, which resolves parameters from the + /// 1. `Item::try_state_current`, which resolves parameters from the /// *current* state. - /// 2. `Step::state_goal` - /// 3. `Step::apply_check` + /// 2. `Item::state_goal` + /// 3. `Item::apply_check` /// - /// 3. For `Step`s that return `ApplyCheck::ExecRequired`, run - /// `Step::apply_exec_dry`. + /// 3. For `Item`s that return `ApplyCheck::ExecRequired`, run + /// `Item::apply_exec_dry`. /// - /// [`apply_exec_dry`]: peace_cfg::Step::apply_exec_dry - /// [`Step::apply_check`]: peace_cfg::Step::apply_check - /// [`Step::apply_exec_dry`]: peace_cfg::StepRt::apply_exec_dry - /// [`Step`]: peace_cfg::Step + /// [`apply_exec_dry`]: peace_cfg::Item::apply_exec_dry + /// [`Item::apply_check`]: peace_cfg::Item::apply_check + /// [`Item::apply_exec_dry`]: peace_cfg::ItemRt::apply_exec_dry + /// [`Item`]: peace_cfg::Item pub async fn exec_dry<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -72,7 +72,7 @@ where Self::exec_dry_with(cmd_ctx, ApplyStoredStateSync::Both).await } - /// Conditionally runs [`Step::apply_exec_dry`] for each [`Step`]. + /// Conditionally runs [`Item::apply_exec_dry`] for each [`Item`]. /// /// See [`Self::exec_dry`] for full documentation. /// @@ -106,37 +106,37 @@ where Ok(cmd_outcome) } - /// Conditionally runs [`Step::apply_exec`] for each [`Step`]. + /// Conditionally runs [`Item::apply_exec`] for each [`Item`]. /// - /// In practice this runs [`Step::apply_check`], and only runs + /// In practice this runs [`Item::apply_check`], and only runs /// [`apply_exec`] if execution is required. /// /// # Design /// - /// The grouping of step functions run for a `Clean` execution to work + /// The grouping of item functions run for a `Clean` execution to work /// is as follows: /// - /// 1. Run [`StatesDiscoverCmd::current`] for all `Step`s in the *forward* + /// 1. Run [`StatesDiscoverCmd::current`] for all `Item`s in the *forward* /// direction. /// /// This populates `resources` with `Current`, needed for - /// `Step::try_state_current` during `StepRt::clean_prepare`. + /// `Item::try_state_current` during `ItemRt::clean_prepare`. /// - /// 2. In the *reverse* direction, for each `Step` run - /// `StepRt::clean_prepare`, which runs: + /// 2. In the *reverse* direction, for each `Item` run + /// `ItemRt::clean_prepare`, which runs: /// - /// 1. `Step::try_state_current`, which resolves parameters from the + /// 1. `Item::try_state_current`, which resolves parameters from the /// *current* state. - /// 2. `Step::state_goal` - /// 3. `Step::apply_check` + /// 2. `Item::state_goal` + /// 3. `Item::apply_check` /// - /// 3. For `Step`s that return `ApplyCheck::ExecRequired`, run - /// `Step::apply_exec`. + /// 3. For `Item`s that return `ApplyCheck::ExecRequired`, run + /// `Item::apply_exec`. /// - /// [`apply_exec`]: peace_cfg::Step::apply_exec - /// [`Step::apply_check`]: peace_cfg::Step::apply_check - /// [`Step::apply_exec`]: peace_cfg::StepRt::apply_exec - /// [`Step`]: peace_cfg::Step + /// [`apply_exec`]: peace_cfg::Item::apply_exec + /// [`Item::apply_check`]: peace_cfg::Item::apply_check + /// [`Item::apply_exec`]: peace_cfg::ItemRt::apply_exec + /// [`Item`]: peace_cfg::Item pub async fn exec<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -149,7 +149,7 @@ where Self::exec_with(cmd_ctx, ApplyStoredStateSync::Both).await } - /// Conditionally runs [`Step::apply_exec`] for each [`Step`]. + /// Conditionally runs [`Item::apply_exec`] for each [`Item`]. /// /// See [`Self::exec`] for full documentation. /// @@ -170,7 +170,7 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (step_graph, resources) = (flow.graph(), resources); + let (item_graph, resources) = (flow.graph(), resources); // We shouldn't serialize current if we returned from an interruption / error // handler. @@ -180,7 +180,7 @@ where CleanExecChange::None => Ok(Default::default()), CleanExecChange::Some(states_previous_and_cleaned) => { let (states_previous, states_cleaned) = *states_previous_and_cleaned; - Self::serialize_current(step_graph, resources, &states_cleaned).await?; + Self::serialize_current(item_graph, resources, &states_cleaned).await?; resources.insert::(states_previous); @@ -193,14 +193,14 @@ where cmd_outcome.transpose() } - /// Conditionally runs [`ApplyFns`]`::`[`exec`] for each [`Step`]. + /// Conditionally runs [`ApplyFns`]`::`[`exec`] for each [`Item`]. /// /// Same as [`Self::exec`], but does not change the type state, and returns /// [`StatesCleaned`]. /// /// [`exec`]: peace_cfg::ApplyFns::exec - /// [`Step`]: peace_cfg::Step - /// [`ApplyFns`]: peace_cfg::Step::ApplyFns + /// [`Item`]: peace_cfg::Item + /// [`ApplyFns`]: peace_cfg::Item::ApplyFns async fn exec_internal<'ctx, 'ctx_ref, StatesTs>( cmd_ctx: &'ctx_ref mut CmdCtx>, apply_stored_state_sync: ApplyStoredStateSync, @@ -269,10 +269,10 @@ where // i.e. is it part of `ApplyFns::exec`'s contract to return the state. // // * It may be duplication of code. - // * `FileDownloadStep` needs to know the ETag from the last request, which: + // * `FileDownloadItem` needs to know the ETag from the last request, which: // - in `StatesCurrentFn` comes from `StatesCurrent` // - in `CleanCmd` comes from `Cleaned` - // * `ShCmdStep` doesn't return the state in the apply script, so in the step we + // * `ShCmdItem` doesn't return the state in the apply script, so in the item we // run the state current script after the apply exec script. Ok(cmd_outcome) @@ -280,7 +280,7 @@ where // TODO: This duplicates a bit of code with `StatesDiscoverCmd`, async fn serialize_current( - step_graph: &StepGraph<::AppError>, + item_graph: &ItemGraph<::AppError>, resources: &Resources, states_cleaned: &StatesCleaned, ) -> Result<(), ::AppError> { @@ -290,7 +290,7 @@ where let storage = resources.borrow::(); let states_current_file = StatesCurrentFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, step_graph, states_cleaned, &states_current_file) + StatesSerializer::serialize(&storage, item_graph, states_cleaned, &states_current_file) .await?; drop(flow_dir); diff --git a/crate/rt/src/cmds/diff_cmd.rs b/crate/rt/src/cmds/diff_cmd.rs index 921d2ef43..e1171864d 100644 --- a/crate/rt/src/cmds/diff_cmd.rs +++ b/crate/rt/src/cmds/diff_cmd.rs @@ -1,7 +1,7 @@ use std::{fmt::Debug, marker::PhantomData}; use futures::{StreamExt, TryStreamExt}; -use peace_cfg::{StepId, Profile}; +use peace_cfg::{ItemId, Profile}; use peace_cmd::{ ctx::{CmdCtx, CmdCtxTypesConstrained}, scopes::{MultiProfileSingleFlow, MultiProfileSingleFlowView, SingleProfileSingleFlow}, @@ -55,7 +55,7 @@ where /// DiffCmd::diff(cmd_ctx, DiffStateSpec::CurrentStored, DiffStateSpec::GoalStored).await?; /// ``` /// - /// [`state_diff`]: peace_cfg::Step::state_diff + /// [`state_diff`]: peace_cfg::Item::state_diff /// [`StatesDiscoverCmd::current_and_goal`]: crate::cmds::StatesDiscoverCmd::current_and_goal pub async fn diff_stored( cmd_ctx: &mut CmdCtx>, @@ -74,7 +74,7 @@ where /// For `Current` and `Goal` states, though they are discovered during the /// `DiffCmd` execution, they are not serialized. /// - /// [`state_diff`]: peace_cfg::Step::state_diff + /// [`state_diff`]: peace_cfg::Item::state_diff /// [`StatesDiscoverCmd::current_and_goal`]: crate::cmds::StatesDiscoverCmd::current_and_goal pub async fn diff( cmd_ctx: &mut CmdCtx>, @@ -143,7 +143,7 @@ where /// Both profiles' current states must have been discovered prior to /// running this. See [`StatesDiscoverCmd::current`]. /// - /// [`state_diff`]: peace_cfg::Step::state_diff + /// [`state_diff`]: peace_cfg::Item::state_diff /// [`StatesDiscoverCmd::current`]: crate::cmds::StatesDiscoverCmd::current pub async fn diff_current_stored( cmd_ctx: &mut CmdCtx>, @@ -209,32 +209,32 @@ impl DiffCmd where CmdCtxTypesT: CmdCtxTypesConstrained, { - /// Returns the [`state_diff`]` for each [`Step`]. + /// Returns the [`state_diff`]` for each [`Item`]. /// /// This does not take in `CmdCtx` as it may be used by both /// `SingleProfileSingleFlow` and `MultiProfileSingleFlow` /// commands. /// - /// [`Step`]: peace_cfg::Step - /// [`state_diff`]: peace_cfg::Step::state_diff + /// [`Item`]: peace_cfg::Item + /// [`state_diff`]: peace_cfg::Item::state_diff pub async fn diff_any( flow: &Flow<::AppError>, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result::AppError> { let state_diffs = { let state_diffs_mut = flow .graph() .stream() .map(Result::<_, ::AppError>::Ok) - .try_filter_map(|step| async move { - let state_diff_opt = step + .try_filter_map(|item| async move { + let state_diff_opt = item .state_diff_exec(params_specs, resources, states_a, states_b) .await?; - Ok(state_diff_opt.map(|state_diff| (step.id().clone(), state_diff))) + Ok(state_diff_opt.map(|state_diff| (item.id().clone(), state_diff))) }) .try_collect::() .await?; diff --git a/crate/rt/src/cmds/ensure_cmd.rs b/crate/rt/src/cmds/ensure_cmd.rs index b18a58149..213612f02 100644 --- a/crate/rt/src/cmds/ensure_cmd.rs +++ b/crate/rt/src/cmds/ensure_cmd.rs @@ -12,7 +12,7 @@ use peace_resources::{ states::{States, StatesEnsured, StatesEnsuredDry, StatesGoal, StatesPrevious}, Resources, }; -use peace_rt_model::{StepGraph, Storage}; +use peace_rt_model::{ItemGraph, Storage}; use crate::{ cmd_blocks::{ @@ -29,29 +29,29 @@ impl EnsureCmd where CmdCtxTypesT: CmdCtxTypesConstrained, { - /// Conditionally runs [`Step::apply_exec_dry`] for each [`Step`]. + /// Conditionally runs [`Item::apply_exec_dry`] for each [`Item`]. /// - /// In practice this runs [`Step::apply_check`], and only runs + /// In practice this runs [`Item::apply_check`], and only runs /// [`apply_exec_dry`] if execution is required. /// /// # Design /// - /// The grouping of step functions run for an `Ensure` execution to + /// The grouping of item functions run for an `Ensure` execution to /// work is as follows: /// - /// 1. For each `Step` run `StepRt::ensure_prepare`, which runs: + /// 1. For each `Item` run `ItemRt::ensure_prepare`, which runs: /// - /// 1. `Step::state_current` - /// 2. `Step::state_goal` - /// 3. `Step::apply_check` + /// 1. `Item::state_current` + /// 2. `Item::state_goal` + /// 3. `Item::apply_check` /// - /// 2. For `Step`s that return `ApplyCheck::ExecRequired`, run - /// `Step::apply_exec_dry`. + /// 2. For `Item`s that return `ApplyCheck::ExecRequired`, run + /// `Item::apply_exec_dry`. /// - /// [`apply_exec_dry`]: peace_cfg::Step::apply_exec_dry - /// [`Step::apply_check`]: peace_cfg::Step::apply_check - /// [`Step::apply_exec_dry`]: peace_cfg::StepRt::apply_exec_dry - /// [`Step`]: peace_cfg::Step + /// [`apply_exec_dry`]: peace_cfg::Item::apply_exec_dry + /// [`Item::apply_check`]: peace_cfg::Item::apply_check + /// [`Item::apply_exec_dry`]: peace_cfg::ItemRt::apply_exec_dry + /// [`Item`]: peace_cfg::Item pub async fn exec_dry<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -64,7 +64,7 @@ where Self::exec_dry_with(cmd_ctx, ApplyStoredStateSync::Both).await } - /// Conditionally runs [`Step::apply_exec_dry`] for each [`Step`]. + /// Conditionally runs [`Item::apply_exec_dry`] for each [`Item`]. /// /// See [`Self::exec_dry`] for full documentation. /// @@ -98,29 +98,29 @@ where Ok(cmd_outcome) } - /// Conditionally runs [`Step::apply_exec`] for each [`Step`]. + /// Conditionally runs [`Item::apply_exec`] for each [`Item`]. /// - /// In practice this runs [`Step::apply_check`], and only runs + /// In practice this runs [`Item::apply_check`], and only runs /// [`apply_exec`] if execution is required. /// /// # Design /// - /// The grouping of step functions run for an `Ensure` execution to + /// The grouping of item functions run for an `Ensure` execution to /// work is as follows: /// - /// 1. For each `Step` run `StepRt::ensure_prepare`, which runs: + /// 1. For each `Item` run `ItemRt::ensure_prepare`, which runs: /// - /// 1. `Step::state_current` - /// 2. `Step::state_goal` - /// 3. `Step::apply_check` + /// 1. `Item::state_current` + /// 2. `Item::state_goal` + /// 3. `Item::apply_check` /// - /// 2. For `Step`s that return `ApplyCheck::ExecRequired`, run - /// `Step::apply_exec`. + /// 2. For `Item`s that return `ApplyCheck::ExecRequired`, run + /// `Item::apply_exec`. /// - /// [`apply_exec`]: peace_cfg::Step::apply_exec - /// [`Step::apply_check`]: peace_cfg::Step::apply_check - /// [`Step::apply_exec`]: peace_cfg::StepRt::apply_exec - /// [`Step`]: peace_cfg::Step + /// [`apply_exec`]: peace_cfg::Item::apply_exec + /// [`Item::apply_check`]: peace_cfg::Item::apply_check + /// [`Item::apply_exec`]: peace_cfg::ItemRt::apply_exec + /// [`Item`]: peace_cfg::Item pub async fn exec<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -133,7 +133,7 @@ where Self::exec_with(cmd_ctx, ApplyStoredStateSync::Both).await } - /// Conditionally runs [`Step::apply_exec`] for each [`Step`]. + /// Conditionally runs [`Item::apply_exec`] for each [`Item`]. /// /// See [`Self::exec`] for full documentation. /// @@ -154,7 +154,7 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (step_graph, resources) = (flow.graph(), resources); + let (item_graph, resources) = (flow.graph(), resources); // We shouldn't serialize current or goal if we returned from an interruption / // error handler. @@ -164,8 +164,8 @@ where EnsureExecChange::None => Ok(Default::default()), EnsureExecChange::Some(stateses_boxed) => { let (states_previous, states_applied, states_goal) = *stateses_boxed; - Self::serialize_current(step_graph, resources, &states_applied).await?; - Self::serialize_goal(step_graph, resources, &states_goal).await?; + Self::serialize_current(item_graph, resources, &states_applied).await?; + Self::serialize_goal(item_graph, resources, &states_goal).await?; resources.insert::(states_previous); @@ -178,14 +178,14 @@ where cmd_outcome.transpose() } - /// Conditionally runs [`ApplyFns`]`::`[`exec`] for each [`Step`]. + /// Conditionally runs [`ApplyFns`]`::`[`exec`] for each [`Item`]. /// /// Same as [`Self::exec`], but does not change the type state, and returns /// [`StatesEnsured`]. /// /// [`exec`]: peace_cfg::ApplyFns::exec - /// [`Step`]: peace_cfg::Step - /// [`ApplyFns`]: peace_cfg::Step::ApplyFns + /// [`Item`]: peace_cfg::Item + /// [`ApplyFns`]: peace_cfg::Item::ApplyFns async fn exec_internal<'ctx, StatesTs>( cmd_ctx: &mut CmdCtx>, apply_stored_state_sync: ApplyStoredStateSync, @@ -281,10 +281,10 @@ where // i.e. is it part of `ApplyFns::exec`'s contract to return the state. // // * It may be duplication of code. - // * `FileDownloadStep` needs to know the ETag from the last request, which: + // * `FileDownloadItem` needs to know the ETag from the last request, which: // - in `StatesCurrentFn` comes from `StatesCurrent` // - in `EnsureCmd` comes from `Ensured` - // * `ShCmdStep` doesn't return the state in the apply script, so in the step we + // * `ShCmdItem` doesn't return the state in the apply script, so in the item we // run the state current script after the apply exec script. Ok(ensure_exec_change) @@ -292,7 +292,7 @@ where // TODO: This duplicates a bit of code with `StatesDiscoverCmd`, async fn serialize_current( - step_graph: &StepGraph<::AppError>, + item_graph: &ItemGraph<::AppError>, resources: &Resources, states_applied: &StatesEnsured, ) -> Result<(), ::AppError> { @@ -302,7 +302,7 @@ where let storage = resources.borrow::(); let states_current_file = StatesCurrentFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, step_graph, states_applied, &states_current_file) + StatesSerializer::serialize(&storage, item_graph, states_applied, &states_current_file) .await?; drop(flow_dir); @@ -312,7 +312,7 @@ where } async fn serialize_goal( - step_graph: &StepGraph<::AppError>, + item_graph: &ItemGraph<::AppError>, resources: &Resources, states_goal: &StatesGoal, ) -> Result<(), ::AppError> { @@ -322,7 +322,7 @@ where let storage = resources.borrow::(); let states_goal_file = StatesGoalFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, step_graph, states_goal, &states_goal_file).await?; + StatesSerializer::serialize(&storage, item_graph, states_goal, &states_goal_file).await?; drop(flow_dir); drop(storage); diff --git a/crate/rt/src/cmds/states_discover_cmd.rs b/crate/rt/src/cmds/states_discover_cmd.rs index f6eb4929f..a437d9f6f 100644 --- a/crate/rt/src/cmds/states_discover_cmd.rs +++ b/crate/rt/src/cmds/states_discover_cmd.rs @@ -12,7 +12,7 @@ use peace_resources::{ states::{StatesCurrent, StatesGoal}, Resources, }; -use peace_rt_model::{StepGraph, Storage}; +use peace_rt_model::{ItemGraph, Storage}; use crate::cmd_blocks::StatesDiscoverCmdBlock; @@ -28,14 +28,14 @@ impl StatesDiscoverCmd where CmdCtxTypesT: CmdCtxTypesConstrained, { - /// Runs [`try_state_current`] for each [`Step`]. + /// Runs [`try_state_current`] for each [`Item`]. /// /// At the end of this function, [`Resources`] will be populated with /// [`StatesCurrent`], and will be serialized to /// `$flow_dir/states_current.yaml`. /// /// If any `state_current` function needs to read the `State` from a - /// previous `Step`, it may automatically be referenced using [`Current`] + /// previous `Item`, it may automatically be referenced using [`Current`] /// where `T` us the predecessor's state. Peace will have automatically /// inserted it into `Resources`, and the successor should references it /// in their [`Data`]. @@ -44,8 +44,8 @@ where /// /// [`Current`]: https://docs.rs/peace_data/latest/peace_data/marker/struct.Current.html /// [`Data`]: peace_cfg::TryFnSpec::Data - /// [`Step`]: peace_cfg::Step - /// [`try_state_current`]: peace_cfg::Step::try_state_current + /// [`Item`]: peace_cfg::Item + /// [`try_state_current`]: peace_cfg::Item::try_state_current pub async fn current<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -58,7 +58,7 @@ where Self::current_with(cmd_ctx, true).await } - /// Runs [`try_state_current`] for each [`Step`]. + /// Runs [`try_state_current`] for each [`Item`]. /// /// See [`Self::current`] for full documentation. /// @@ -71,7 +71,7 @@ where /// * `serialize_to_storage`: Whether to write states to storage after /// discovery. /// - /// [`try_state_current`]: peace_cfg::Step::try_state_current + /// [`try_state_current`]: peace_cfg::Item::try_state_current pub async fn current_with<'ctx>( cmd_ctx: &mut CmdCtx>, serialize_to_storage: bool, @@ -98,24 +98,24 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (step_graph, resources) = (flow.graph(), resources); + let (item_graph, resources) = (flow.graph(), resources); if serialize_to_storage { - Self::serialize_current(step_graph, resources, states_current).await?; + Self::serialize_current(item_graph, resources, states_current).await?; } } Ok(cmd_outcome) } - /// Runs [`try_state_goal`] for each [`Step`]. + /// Runs [`try_state_goal`] for each [`Item`]. /// /// At the end of this function, [`Resources`] will be populated with /// [`StatesGoal`], and will be serialized to /// `$flow_dir/states_goal.yaml`. /// /// If any `state_goal` function needs to read the `State` from a - /// previous `Step`, it may automatically be referenced using [`Goal`] + /// previous `Item`, it may automatically be referenced using [`Goal`] /// where `T` us the predecessor's state. Peace will have automatically /// inserted it into `Resources`, and the successor should references it /// in their [`Data`]. @@ -124,8 +124,8 @@ where /// /// [`Data`]: peace_cfg::TryFnSpec::Data /// [`Goal`]: https://docs.rs/peace_data/latest/peace_data/marker/struct.Goal.html - /// [`Step`]: peace_cfg::Step - /// [`try_state_goal`]: peace_cfg::Step::try_state_goal + /// [`Item`]: peace_cfg::Item + /// [`try_state_goal`]: peace_cfg::Item::try_state_goal pub async fn goal<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -138,7 +138,7 @@ where Self::goal_with(cmd_ctx, true).await } - /// Runs [`try_state_goal`] for each [`Step`]. + /// Runs [`try_state_goal`] for each [`Item`]. /// /// See [`Self::goal`] for full documentation. /// @@ -151,7 +151,7 @@ where /// * `serialize_to_storage`: Whether to write states to storage after /// discovery. /// - /// [`try_state_goal`]: peace_cfg::Step::try_state_goal + /// [`try_state_goal`]: peace_cfg::Item::try_state_goal pub async fn goal_with<'ctx>( cmd_ctx: &mut CmdCtx>, serialize_to_storage: bool, @@ -178,10 +178,10 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (step_graph, resources) = (flow.graph(), resources); + let (item_graph, resources) = (flow.graph(), resources); if serialize_to_storage { - Self::serialize_goal(step_graph, resources, states_goal).await?; + Self::serialize_goal(item_graph, resources, states_goal).await?; } } @@ -189,7 +189,7 @@ where } /// Runs [`try_state_current`] and [`try_state_goal`]` for each - /// [`Step`]. + /// [`Item`]. /// /// At the end of this function, [`Resources`] will be populated with /// [`StatesCurrent`] and [`StatesGoal`], and states will be serialized @@ -197,12 +197,12 @@ where /// `$flow_dir/states_goal.yaml`. /// /// If any `state_current` function needs to read the `State` from a - /// previous `Step`, the predecessor should insert a copy / clone of + /// previous `Item`, the predecessor should insert a copy / clone of /// their state into `Resources`, and the successor should references it /// in their [`Data`]. /// /// If any `state_goal` function needs to read the `State` from a - /// previous `Step`, it may automatically be referenced using + /// previous `Item`, it may automatically be referenced using /// [`Goal`] where `T` us the predecessor's state. Peace will have /// automatically inserted it into `Resources`, and the successor should /// references it in their [`Data`]. @@ -212,9 +212,9 @@ where /// [`Current`]: https://docs.rs/peace_data/latest/peace_data/marker/struct.Current.html /// [`Data`]: peace_cfg::TryFnSpec::Data /// [`Goal`]: https://docs.rs/peace_data/latest/peace_data/marker/struct.Goal.html - /// [`Step`]: peace_cfg::Step - /// [`try_state_current`]: peace_cfg::Step::try_state_current - /// [`try_state_goal`]: peace_cfg::Step::try_state_goal + /// [`Item`]: peace_cfg::Item + /// [`try_state_current`]: peace_cfg::Item::try_state_current + /// [`try_state_goal`]: peace_cfg::Item::try_state_goal pub async fn current_and_goal<'ctx>( cmd_ctx: &mut CmdCtx>, ) -> Result< @@ -228,7 +228,7 @@ where } /// Runs [`try_state_current`] and [`try_state_goal`]` for each - /// [`Step`]. + /// [`Item`]. /// /// See [`Self::goal`] for full documentation. /// @@ -241,8 +241,8 @@ where /// * `serialize_to_storage`: Whether to write states to storage after /// discovery. /// - /// [`try_state_current`]: peace_cfg::Step::try_state_current - /// [`try_state_goal`]: peace_cfg::Step::try_state_goal + /// [`try_state_current`]: peace_cfg::Item::try_state_current + /// [`try_state_goal`]: peace_cfg::Item::try_state_goal pub async fn current_and_goal_with<'ctx>( cmd_ctx: &mut CmdCtx>, serialize_to_storage: bool, @@ -282,11 +282,11 @@ where let SingleProfileSingleFlowView { flow, resources, .. } = cmd_ctx.view(); - let (step_graph, resources) = (flow.graph(), resources); + let (item_graph, resources) = (flow.graph(), resources); if serialize_to_storage { - Self::serialize_current(step_graph, resources, states_current).await?; - Self::serialize_goal(step_graph, resources, states_goal).await?; + Self::serialize_current(item_graph, resources, states_current).await?; + Self::serialize_goal(item_graph, resources, states_goal).await?; } } @@ -295,7 +295,7 @@ where // TODO: This duplicates a bit of code with `EnsureCmd` and `CleanCmd`. async fn serialize_current( - step_graph: &StepGraph<::AppError>, + item_graph: &ItemGraph<::AppError>, resources: &mut Resources, states_current: &StatesCurrent, ) -> Result<(), ::AppError> { @@ -305,7 +305,7 @@ where let storage = resources.borrow::(); let states_current_file = StatesCurrentFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, step_graph, states_current, &states_current_file) + StatesSerializer::serialize(&storage, item_graph, states_current, &states_current_file) .await?; drop(flow_dir); @@ -317,7 +317,7 @@ where } async fn serialize_goal( - step_graph: &StepGraph<::AppError>, + item_graph: &ItemGraph<::AppError>, resources: &mut Resources, states_goal: &StatesGoal, ) -> Result<(), ::AppError> { @@ -327,7 +327,7 @@ where let storage = resources.borrow::(); let states_goal_file = StatesGoalFile::from(&*flow_dir); - StatesSerializer::serialize(&storage, step_graph, states_goal, &states_goal_file).await?; + StatesSerializer::serialize(&storage, item_graph, states_goal, &states_goal_file).await?; drop(flow_dir); drop(storage); diff --git a/crate/rt/src/lib.rs b/crate/rt/src/lib.rs index 8a43b816c..d1b068d7a 100644 --- a/crate/rt/src/lib.rs +++ b/crate/rt/src/lib.rs @@ -1,6 +1,6 @@ //! Runtime logic for the peace automation library. -/// Maximum number of steps to execute simultaneously. +/// Maximum number of items to execute simultaneously. /// /// 64 is arbitrarily chosen, as there is not enough data to inform us what a /// suitable number is. diff --git a/crate/rt_model/src/flow.rs b/crate/rt_model/src/flow.rs index 93141d09d..993112a7e 100644 --- a/crate/rt_model/src/flow.rs +++ b/crate/rt_model/src/flow.rs @@ -1,23 +1,23 @@ use peace_cfg::FlowId; use peace_data::fn_graph::GraphInfo; -use peace_flow_model::{FlowSpecInfo, StepSpecInfo}; +use peace_flow_model::{FlowSpecInfo, ItemSpecInfo}; -use crate::StepGraph; +use crate::ItemGraph; -/// A flow to manage steps. +/// A flow to manage items. /// /// A Flow ID is strictly associated with a [`StepGraph`], as the graph -/// contains the definitions to read and write the steps' [`State`]s. +/// contains the definitions to read and write the items' [`State`]s. /// -/// [`State`]: peace_cfg::Step::State +/// [`State`]: peace_cfg::Item::State #[derive(Debug)] pub struct Flow { /// ID of this flow. flow_id: FlowId, - /// Graph of [`Step`]s in this flow. + /// Graph of [`Item`]s in this flow. /// - /// [`Step`]: peace_cfg::Step - graph: StepGraph, + /// [`Item`]: peace_cfg::Item + graph: ItemGraph, } impl PartialEq for Flow @@ -42,7 +42,7 @@ impl Eq for Flow where E: 'static {} impl Flow { /// Returns a new `Flow`. - pub fn new(flow_id: FlowId, graph: StepGraph) -> Self { + pub fn new(flow_id: FlowId, graph: ItemGraph) -> Self { Self { flow_id, graph } } @@ -51,13 +51,13 @@ impl Flow { &self.flow_id } - /// Returns the step graph. - pub fn graph(&self) -> &StepGraph { + /// Returns the item graph. + pub fn graph(&self) -> &ItemGraph { &self.graph } - /// Returns a mutable reference to the step graph. - pub fn graph_mut(&self) -> &StepGraph { + /// Returns a mutable reference to the item graph. + pub fn graph_mut(&self) -> &ItemGraph { &self.graph } @@ -67,9 +67,9 @@ impl Flow { E: 'static, { let flow_id = self.flow_id.clone(); - let graph_info = GraphInfo::from_graph(&self.graph, |step_boxed| { - let step_id = step_boxed.id().clone(); - StepSpecInfo { step_id } + let graph_info = GraphInfo::from_graph(&self.graph, |item_boxed| { + let item_id = item_boxed.id().clone(); + ItemSpecInfo { item_id } }); FlowSpecInfo::new(flow_id, graph_info) diff --git a/crate/rt_model/src/lib.rs b/crate/rt_model/src/lib.rs index ebc79f4cb..e01f71382 100644 --- a/crate/rt_model/src/lib.rs +++ b/crate/rt_model/src/lib.rs @@ -14,9 +14,9 @@ pub use peace_rt_model_native::*; pub use peace_rt_model_web::*; pub use crate::{ - flow::Flow, in_memory_text_output::InMemoryTextOutput, step_boxed::StepBoxed, - step_graph::StepGraph, step_graph_builder::StepGraphBuilder, step_rt::StepRt, - step_wrapper::StepWrapper, params_specs_serializer::ParamsSpecsSerializer, + flow::Flow, in_memory_text_output::InMemoryTextOutput, item_boxed::ItemBoxed, + item_graph::ItemGraph, item_graph_builder::ItemGraphBuilder, item_rt::ItemRt, + item_wrapper::ItemWrapper, params_specs_serializer::ParamsSpecsSerializer, params_specs_type_reg::ParamsSpecsTypeReg, states_serializer::StatesSerializer, states_type_reg::StatesTypeReg, }; @@ -25,11 +25,11 @@ pub mod outcomes; mod flow; mod in_memory_text_output; -mod step_boxed; -mod step_graph; -mod step_graph_builder; -mod step_rt; -mod step_wrapper; +mod item_boxed; +mod item_graph; +mod item_graph_builder; +mod item_rt; +mod item_wrapper; mod params_specs_serializer; mod params_specs_type_reg; mod states_serializer; diff --git a/crate/rt_model/src/outcomes.rs b/crate/rt_model/src/outcomes.rs index 8b8a00540..63d424cfb 100644 --- a/crate/rt_model/src/outcomes.rs +++ b/crate/rt_model/src/outcomes.rs @@ -4,17 +4,17 @@ //! outcomes to be redisplayed without re-executing commands. pub use self::{ - step_apply::StepApply, step_apply_boxed::StepApplyBoxed, step_apply_partial::StepApplyPartial, - step_apply_partial_boxed::StepApplyPartialBoxed, step_apply_partial_rt::StepApplyPartialRt, - step_apply_rt::StepApplyRt, + item_apply::ItemApply, item_apply_boxed::ItemApplyBoxed, item_apply_partial::ItemApplyPartial, + item_apply_partial_boxed::ItemApplyPartialBoxed, item_apply_partial_rt::ItemApplyPartialRt, + item_apply_rt::ItemApplyRt, }; -mod step_apply; -mod step_apply_boxed; -mod step_apply_partial; -mod step_apply_partial_boxed; -mod step_apply_partial_rt; -mod step_apply_rt; +mod item_apply; +mod item_apply_boxed; +mod item_apply_partial; +mod item_apply_partial_boxed; +mod item_apply_partial_rt; +mod item_apply_rt; macro_rules! box_data_type_newtype { ($ty_name:ident, $trait_path:path) => { diff --git a/crate/rt_model/src/outcomes/step_apply.rs b/crate/rt_model/src/outcomes/step_apply.rs index c6326b8ab..e2c7d9d67 100644 --- a/crate/rt_model/src/outcomes/step_apply.rs +++ b/crate/rt_model/src/outcomes/step_apply.rs @@ -4,14 +4,14 @@ use peace_cfg::ApplyCheck; use peace_resources::type_reg::untagged::{BoxDtDisplay, DataType}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use crate::outcomes::{StepApplyPartial, StepApplyRt}; +use crate::outcomes::{ItemApplyPartial, ItemApplyRt}; /// Information about a step during an `ApplyCmd` execution. /// -/// This is similar to [`StepApplyPartial`], with most fields being +/// This is similar to [`ItemApplyPartial`], with most fields being /// non-optional, and the added `state_applied` field. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct StepApply { +pub struct ItemApply { /// Current state stored on disk before the execution. pub state_current_stored: Option, /// Current state discovered during the execution. @@ -20,21 +20,21 @@ pub struct StepApply { pub state_target: State, /// Diff between current and goal states. pub state_diff: StateDiff, - /// Whether step execution was required. + /// Whether item execution was required. pub apply_check: ApplyCheck, /// The state that was applyd, `None` if execution was not required. pub state_applied: Option, } -impl TryFrom<(StepApplyPartial, Option)> - for StepApply +impl TryFrom<(ItemApplyPartial, Option)> + for ItemApply { - type Error = (StepApplyPartial, Option); + type Error = (ItemApplyPartial, Option); fn try_from( - (partial, state_applied): (StepApplyPartial, Option), + (partial, state_applied): (ItemApplyPartial, Option), ) -> Result { - let StepApplyPartial { + let ItemApplyPartial { state_current_stored, state_current, state_target, @@ -61,7 +61,7 @@ impl TryFrom<(StepApplyPartial, Option TryFrom<(StepApplyPartial, Option StepApplyRt for StepApply +impl ItemApplyRt for ItemApply where State: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static, StateDiff: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static, diff --git a/crate/rt_model/src/outcomes/step_apply_boxed.rs b/crate/rt_model/src/outcomes/step_apply_boxed.rs index 56e6b95a8..bad5ca247 100644 --- a/crate/rt_model/src/outcomes/step_apply_boxed.rs +++ b/crate/rt_model/src/outcomes/step_apply_boxed.rs @@ -1,18 +1,18 @@ -use crate::outcomes::{StepApply, StepApplyRt}; +use crate::outcomes::{ItemApply, ItemApplyRt}; -/// A boxed `StepApply`. +/// A boxed `ItemApply`. #[derive(Clone, serde::Serialize)] -pub struct StepApplyBoxed(pub(crate) Box); +pub struct ItemApplyBoxed(pub(crate) Box); -impl From> for StepApplyBoxed +impl From> for ItemApplyBoxed where - StepApply: StepApplyRt, + ItemApply: ItemApplyRt, { /// Returns a `StepApplyBoxed` which erases a `StepApply`'s type /// parameters. - fn from(step_apply: StepApply) -> Self { - Self(Box::new(step_apply)) + fn from(item_apply: ItemApply) -> Self { + Self(Box::new(item_apply)) } } -crate::outcomes::box_data_type_newtype!(StepApplyBoxed, StepApplyRt); +crate::outcomes::box_data_type_newtype!(ItemApplyBoxed, ItemApplyRt); diff --git a/crate/rt_model/src/outcomes/step_apply_partial.rs b/crate/rt_model/src/outcomes/step_apply_partial.rs index ec56c7d5a..a16bbb6e1 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial.rs @@ -4,20 +4,20 @@ use peace_cfg::ApplyCheck; use peace_resources::type_reg::untagged::{BoxDtDisplay, DataType}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use crate::outcomes::StepApplyPartialRt; +use crate::outcomes::ItemApplyPartialRt; /// Information about a step during an `ApplyCmd` execution. /// /// # Design Note /// -/// 1. `ApplyCmd` calls the following function for each step. +/// 1. `ApplyCmd` calls the following function for each item. /// -/// - [`Step::state_current`] -/// - [`Step::state_goal`] or [`Step::state_clean`] -/// - [`Step::state_diff`] +/// - [`Item::state_current`] +/// - [`Item::state_goal`] or [`Item::state_clean`] +/// - [`Item::state_diff`] /// - [`ApplyFns::check`] /// - [`ApplyFns::exec`] -/// - [`Step::state_current`] +/// - [`Item::state_current`] /// /// 2. Each function call *may* fail. /// 3. If we have an enum representing the state after each function call, we @@ -26,13 +26,13 @@ use crate::outcomes::StepApplyPartialRt; /// It is not likely to be error prone or too unergonomic to store each field as /// optional. /// -/// [`Step::state_current`]: peace_cfg::Step::state_current -/// [`Step::state_goal`]: peace_cfg::Step::state_goal -/// [`Step::state_diff`]: peace_cfg::Step::state_diff -/// [`ApplyFns::check`]: peace_cfg::Step::ApplyFns -/// [`ApplyFns::exec`]: peace_cfg::Step::ApplyFns +/// [`Item::state_current`]: peace_cfg::Item::state_current +/// [`Item::state_goal`]: peace_cfg::Item::state_goal +/// [`Item::state_diff`]: peace_cfg::Item::state_diff +/// [`ApplyFns::check`]: peace_cfg::Item::ApplyFns +/// [`ApplyFns::exec`]: peace_cfg::Item::ApplyFns #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct StepApplyPartial { +pub struct ItemApplyPartial { /// Current state stored on disk before the execution. pub state_current_stored: Option, /// Current state discovered during the execution. @@ -41,18 +41,18 @@ pub struct StepApplyPartial { pub state_target: Option, /// Diff between current and goal states. pub state_diff: Option, - /// Whether step execution is required. + /// Whether item execution is required. pub apply_check: Option, } -impl StepApplyPartial { - /// Returns a new `StepApplyPartial` with all fields set to `None`. +impl ItemApplyPartial { + /// Returns a new `ItemApplyPartial` with all fields set to `None`. pub fn new() -> Self { Self::default() } } -impl Default for StepApplyPartial { +impl Default for ItemApplyPartial { fn default() -> Self { Self { state_current_stored: None, @@ -64,7 +64,7 @@ impl Default for StepApplyPartial { } } -impl StepApplyPartialRt for StepApplyPartial +impl ItemApplyPartialRt for ItemApplyPartial where State: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static, StateDiff: Clone + Debug + Display + Serialize + DeserializeOwned + Send + Sync + 'static, diff --git a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs index 0d578aca3..72e17a971 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs @@ -1,18 +1,18 @@ -use crate::outcomes::{StepApplyPartial, StepApplyPartialRt}; +use crate::outcomes::{ItemApplyPartial, ItemApplyPartialRt}; -/// A boxed `StepApplyPartial`. +/// A boxed `ItemApplyPartial`. #[derive(Clone, serde::Serialize)] -pub struct StepApplyPartialBoxed(pub(crate) Box); +pub struct ItemApplyPartialBoxed(pub(crate) Box); -impl From> for StepApplyPartialBoxed +impl From> for ItemApplyPartialBoxed where - StepApplyPartial: StepApplyPartialRt, + ItemApplyPartial: ItemApplyPartialRt, { /// Returns a `StepApplyPartialBoxed` which erases an - /// `StepApplyPartial`'s type parameters. - fn from(step_apply: StepApplyPartial) -> Self { - Self(Box::new(step_apply)) + /// `ItemApplyPartial`'s type parameters. + fn from(item_apply: ItemApplyPartial) -> Self { + Self(Box::new(item_apply)) } } -crate::outcomes::box_data_type_newtype!(StepApplyPartialBoxed, StepApplyPartialRt); +crate::outcomes::box_data_type_newtype!(ItemApplyPartialBoxed, ItemApplyPartialRt); diff --git a/crate/rt_model/src/outcomes/step_apply_partial_rt.rs b/crate/rt_model/src/outcomes/step_apply_partial_rt.rs index 796a59b82..8567d7645 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial_rt.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial_rt.rs @@ -1,8 +1,8 @@ use peace_cfg::ApplyCheck; use peace_resources::type_reg::untagged::{BoxDtDisplay, DataType}; -/// Trait to allow inspecting a type-erased `StepApplyPartial`. -pub trait StepApplyPartialRt: DataType { +/// Trait to allow inspecting a type-erased `ItemApplyPartial`. +pub trait ItemApplyPartialRt: DataType { /// Returns `state_current_stored` as type-erased data. fn state_current_stored(&self) -> Option; @@ -25,9 +25,9 @@ pub trait StepApplyPartialRt: DataType { fn as_data_type_mut(&mut self) -> &mut dyn DataType; } -dyn_clone::clone_trait_object!(StepApplyPartialRt); +dyn_clone::clone_trait_object!(ItemApplyPartialRt); -impl StepApplyPartialRt for Box { +impl ItemApplyPartialRt for Box { fn state_current_stored(&self) -> Option { self.as_ref().state_current_stored() } @@ -57,7 +57,7 @@ impl StepApplyPartialRt for Box { } } -impl<'a> serde::Serialize for dyn StepApplyPartialRt + 'a { +impl<'a> serde::Serialize for dyn ItemApplyPartialRt + 'a { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crate/rt_model/src/outcomes/step_apply_rt.rs b/crate/rt_model/src/outcomes/step_apply_rt.rs index c4137bf6d..ec479b165 100644 --- a/crate/rt_model/src/outcomes/step_apply_rt.rs +++ b/crate/rt_model/src/outcomes/step_apply_rt.rs @@ -1,8 +1,8 @@ use peace_cfg::ApplyCheck; use peace_resources::type_reg::untagged::{BoxDtDisplay, DataType}; -/// Trait to allow inspecting a type-erased `StepApply`. -pub trait StepApplyRt: DataType { +/// Trait to allow inspecting a type-erased `ItemApply`. +pub trait ItemApplyRt: DataType { /// Returns `state_current_stored` as type-erased data. fn state_current_stored(&self) -> Option; @@ -28,9 +28,9 @@ pub trait StepApplyRt: DataType { fn as_data_type_mut(&mut self) -> &mut dyn DataType; } -dyn_clone::clone_trait_object!(StepApplyRt); +dyn_clone::clone_trait_object!(ItemApplyRt); -impl StepApplyRt for Box { +impl ItemApplyRt for Box { fn state_current_stored(&self) -> Option { self.as_ref().state_current_stored() } @@ -64,7 +64,7 @@ impl StepApplyRt for Box { } } -impl<'a> serde::Serialize for dyn StepApplyRt + 'a { +impl<'a> serde::Serialize for dyn ItemApplyRt + 'a { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, diff --git a/crate/rt_model/src/params_specs_serializer.rs b/crate/rt_model/src/params_specs_serializer.rs index 1a076269f..ce1c4ef2f 100644 --- a/crate/rt_model/src/params_specs_serializer.rs +++ b/crate/rt_model/src/params_specs_serializer.rs @@ -13,7 +13,7 @@ impl ParamsSpecsSerializer where E: std::error::Error + From + Send, { - /// Serializes the [`ParamsSpecs`] of all [`Step`]s to disk. + /// Serializes the [`ParamsSpecs`] of all [`Item`]s to disk. /// /// # Parameters: /// @@ -21,7 +21,7 @@ where /// * `params_specs`: `ParamsSpecs` to serialize. /// * `params_specs_file`: Path to save the serialized params_specs to. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item pub async fn serialize( storage: &Storage, params_specs: &ParamsSpecs, @@ -40,7 +40,7 @@ where Ok(()) } - /// Returns the [`ParamsSpecs`] of all [`Step`]s if it exists on disk. + /// Returns the [`ParamsSpecs`] of all [`Item`]s if it exists on disk. /// /// # Parameters: /// @@ -49,7 +49,7 @@ where /// each params spec. /// * `params_specs_file`: `ParamsSpecsFile` to deserialize. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item pub async fn deserialize_opt( profile: &Profile, flow_id: &FlowId, @@ -69,7 +69,7 @@ where .await } - /// Returns the [`ParamsSpecs`] of all [`Step`]s if it exists on disk. + /// Returns the [`ParamsSpecs`] of all [`Item`]s if it exists on disk. /// /// # Parameters: /// @@ -78,7 +78,7 @@ where /// each params spec. /// * `params_specs_file`: `ParamsSpecsFile` to deserialize. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item #[cfg(not(target_arch = "wasm32"))] async fn deserialize_internal( thread_name: String, @@ -138,7 +138,7 @@ where Ok(params_specs_opt) } - /// Returns the [`ParamsSpecs`] of all [`Step`]s if it exists on disk. + /// Returns the [`ParamsSpecs`] of all [`Item`]s if it exists on disk. /// /// # Parameters: /// @@ -147,7 +147,7 @@ where /// each params spec. /// * `params_specs_file`: `ParamsSpecsFile` to deserialize. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item #[cfg(target_arch = "wasm32")] async fn deserialize_internal( profile: &Profile, diff --git a/crate/rt_model/src/params_specs_type_reg.rs b/crate/rt_model/src/params_specs_type_reg.rs index b1702ee09..612e10fa3 100644 --- a/crate/rt_model/src/params_specs_type_reg.rs +++ b/crate/rt_model/src/params_specs_type_reg.rs @@ -1,10 +1,10 @@ use std::ops::{Deref, DerefMut}; -use peace_cfg::StepId; +use peace_cfg::ItemId; use peace_params::AnySpecRtBoxed; use peace_resources::type_reg::untagged::TypeReg; -/// Type registry for each step's [`Params`]'s Spec. +/// Type registry for each item's [`Params`]'s Spec. /// /// This is used to deserialize [`ParamsSpecsFile`]. /// @@ -13,10 +13,10 @@ use peace_resources::type_reg::untagged::TypeReg; /// /// [`AnySpecRtBoxed`]: peace_params::AnySpecRtBoxed /// [`BoxDtDisplay`]: peace_resources::type_reg::untagged::BoxDtDisplay -/// [`Params`]: peace_cfg::Step::Params +/// [`Params`]: peace_cfg::Item::Params /// [`StatesTypeReg`]: crate::StatesTypeReg #[derive(Debug, Default)] -pub struct ParamsSpecsTypeReg(TypeReg); +pub struct ParamsSpecsTypeReg(TypeReg); impl ParamsSpecsTypeReg { /// Returns a new `ParamsSpecsTypeReg`. @@ -26,7 +26,7 @@ impl ParamsSpecsTypeReg { } impl Deref for ParamsSpecsTypeReg { - type Target = TypeReg; + type Target = TypeReg; fn deref(&self) -> &Self::Target { &self.0 diff --git a/crate/rt_model/src/states_serializer.rs b/crate/rt_model/src/states_serializer.rs index e33b1086c..5ccc44f2f 100644 --- a/crate/rt_model/src/states_serializer.rs +++ b/crate/rt_model/src/states_serializer.rs @@ -1,6 +1,6 @@ use std::{marker::PhantomData, path::Path}; -use peace_cfg::{FlowId, StepId}; +use peace_cfg::{FlowId, ItemId}; use peace_resources::{ paths::{StatesCurrentFile, StatesGoalFile}, states::{ @@ -10,7 +10,7 @@ use peace_resources::{ type_reg::untagged::{BoxDtDisplay, TypeMapOpt, TypeReg}, }; -use crate::{Error, StepGraph, Storage}; +use crate::{Error, ItemGraph, Storage}; /// Reads and writes [`StatesCurrentStored`] and [`StatesGoalStored`] to and /// from storage. @@ -20,7 +20,7 @@ impl StatesSerializer where E: std::error::Error + From + Send + 'static, { - /// Returns the [`StatesCurrentStored`] of all [`Step`]s if it exists on + /// Returns the [`StatesCurrentStored`] of all [`Item`]s if it exists on /// disk. /// /// # Parameters: @@ -29,17 +29,17 @@ where /// * `states`: States to serialize. /// * `states_file_path`: Path to save the serialized states to. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item pub async fn serialize( storage: &Storage, - step_graph: &StepGraph, + item_graph: &ItemGraph, states: &States, states_file_path: &Path, ) -> Result<(), E> where TS: Send + Sync, { - let states_serde = step_graph.states_serde::(states); + let states_serde = item_graph.states_serde::(states); storage .serialized_write( #[cfg(not(target_arch = "wasm32"))] @@ -53,21 +53,21 @@ where Ok(()) } - /// Returns the [`StatesCurrentStored`] of all [`Step`]s if it exists on + /// Returns the [`StatesCurrentStored`] of all [`Item`]s if it exists on /// disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// step state. + /// item state. /// * `states_current_file`: `StatesCurrentFile` to deserialize. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item pub async fn deserialize_stored( flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_current_file: &StatesCurrentFile, ) -> Result { let states = Self::deserialize_internal::( @@ -83,20 +83,20 @@ where states.ok_or_else(|| E::from(Error::StatesCurrentDiscoverRequired)) } - /// Returns the [`StatesGoalStored`] of all [`Step`]s if it exists on disk. + /// Returns the [`StatesGoalStored`] of all [`Item`]s if it exists on disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// step state. + /// item state. /// * `states_goal_file`: `StatesGoalFile` to deserialize. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item pub async fn deserialize_goal( flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_goal_file: &StatesGoalFile, ) -> Result { let states = Self::deserialize_internal::( @@ -112,21 +112,21 @@ where states.ok_or_else(|| E::from(Error::StatesGoalDiscoverRequired)) } - /// Returns the [`StatesCurrentStored`] of all [`Step`]s if it exists on + /// Returns the [`StatesCurrentStored`] of all [`Item`]s if it exists on /// disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// step state. + /// item state. /// * `states_current_file`: `StatesCurrentFile` to deserialize. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item pub async fn deserialize_stored_opt( flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_current_file: &StatesCurrentFile, ) -> Result, E> { Self::deserialize_internal( @@ -140,13 +140,13 @@ where .await } - /// Returns the [`States`] of all [`Step`]s if it exists on disk. + /// Returns the [`States`] of all [`Item`]s if it exists on disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// step state. + /// item state. /// * `states_current_file`: `StatesCurrentFile` to deserialize. /// /// # Type Parameters @@ -154,7 +154,7 @@ where /// * `TS`: The states type state to use, such as [`ts::Current`] or /// [`ts::CurrentStored`]. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item /// [`ts::Current`]: peace_resources::states::ts::Current /// [`ts::CurrentStored`]: peace_resources::states::ts::CurrentStored #[cfg(not(target_arch = "wasm32"))] @@ -162,7 +162,7 @@ where thread_name: String, flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_file_path: &Path, ) -> Result>, E> where @@ -208,13 +208,13 @@ where Ok(states_opt) } - /// Returns the [`States`] of all [`Step`]s if it exists on disk. + /// Returns the [`States`] of all [`Item`]s if it exists on disk. /// /// # Parameters: /// /// * `storage`: `Storage` to read from. /// * `states_type_reg`: Type registry with functions to deserialize each - /// step state. + /// item state. /// * `states_current_file`: `StatesCurrentFile` to deserialize. /// /// # Type Parameters @@ -222,14 +222,14 @@ where /// * `TS`: The states type state to use, such as [`ts::Current`] or /// [`ts::CurrentStored`]. /// - /// [`Step`]: peace_cfg::Step + /// [`Item`]: peace_cfg::Item /// [`ts::Current`]: peace_resources::states::ts::Current /// [`ts::CurrentStored`]: peace_resources::states::ts::CurrentStored #[cfg(target_arch = "wasm32")] async fn deserialize_internal( flow_id: &FlowId, storage: &Storage, - states_type_reg: &TypeReg, + states_type_reg: &TypeReg, states_file_path: &Path, ) -> Result>, E> where diff --git a/crate/rt_model/src/states_type_reg.rs b/crate/rt_model/src/states_type_reg.rs index 72f4fba11..aeda73d79 100644 --- a/crate/rt_model/src/states_type_reg.rs +++ b/crate/rt_model/src/states_type_reg.rs @@ -1,23 +1,23 @@ use std::ops::{Deref, DerefMut}; -use peace_cfg::StepId; +use peace_cfg::ItemId; use peace_resources::type_reg::untagged::{BoxDtDisplay, TypeReg}; -/// Type registry for each step's `State`. +/// Type registry for each item's `State`. /// /// This is used to deserialize [`StatesCurrentFile`] and [`StatesGoalFile`]. /// -/// Note: [`StepParamsTypeReg`] uses [`BoxDt`], whereas this uses +/// Note: [`ItemParamsTypeReg`] uses [`BoxDt`], whereas this uses /// [`BoxDtDisplay`]. /// /// [`BoxDt`]: peace_resources::type_reg::untagged::BoxDt /// [`BoxDtDisplay`]: peace_resources::type_reg::untagged::BoxDtDisplay -/// [`StepParamsTypeReg`]: crate::StepParamsTypeReg -/// [`Params`]: peace_cfg::Step::Params +/// [`ItemParamsTypeReg`]: crate::ItemParamsTypeReg +/// [`Params`]: peace_cfg::Item::Params /// [`StatesGoalFile`]: peace_resources::paths::StatesGoalFile /// [`StatesCurrentFile`]: peace_resources::paths::StatesCurrentFile #[derive(Debug, Default)] -pub struct StatesTypeReg(TypeReg); +pub struct StatesTypeReg(TypeReg); impl StatesTypeReg { /// Returns new `StatesTypeReg`. @@ -27,7 +27,7 @@ impl StatesTypeReg { } impl Deref for StatesTypeReg { - type Target = TypeReg; + type Target = TypeReg; fn deref(&self) -> &Self::Target { &self.0 diff --git a/crate/rt_model/src/step_boxed.rs b/crate/rt_model/src/step_boxed.rs index 0351e5833..5c652512f 100644 --- a/crate/rt_model/src/step_boxed.rs +++ b/crate/rt_model/src/step_boxed.rs @@ -1,59 +1,59 @@ -//! Contains type-erased `Step` types and traits. +//! Contains type-erased `Item` types and traits. //! //! Types and traits in this module don't reference any associated types from -//! the `Step`, allowing them to be passed around as common types at compile +//! the `Item`, allowing them to be passed around as common types at compile //! time. //! //! For the logic that is aware of the type parameters, see the -//! [`step_wrapper`] module and [`StepWrapper`] type. +//! [`item_wrapper`] module and [`ItemWrapper`] type. //! -//! [`step_wrapper`]: crate::step_wrapper -//! [`StepWrapper`]: crate::StepWrapper +//! [`item_wrapper`]: crate::item_wrapper +//! [`ItemWrapper`]: crate::ItemWrapper use std::{ fmt::Debug, ops::{Deref, DerefMut}, }; -use peace_cfg::Step; +use peace_cfg::Item; use peace_data::fn_graph::{DataAccessDyn, TypeIds}; use peace_params::Params; -use crate::{StepRt, StepWrapper}; +use crate::{ItemRt, ItemWrapper}; -/// Holds a type-erased `StepWrapper` in a `Box`. +/// Holds a type-erased `ItemWrapper` in a `Box`. /// /// # Type Parameters /// /// * `E`: Application specific error type. /// /// Notably, `E` here should be the application's error type, which is not -/// necessarily the step's error type (unless you have only one step +/// necessarily the item's error type (unless you have only one item /// spec in the application). #[derive(Debug)] -pub struct StepBoxed(Box>); +pub struct ItemBoxed(Box>); -impl Clone for StepBoxed { +impl Clone for ItemBoxed { fn clone(&self) -> Self { Self(dyn_clone::clone_box(self.0.as_ref())) } } -impl Deref for StepBoxed { - type Target = dyn StepRt; +impl Deref for ItemBoxed { + type Target = dyn ItemRt; fn deref(&self) -> &Self::Target { &*self.0 } } -impl DerefMut for StepBoxed { +impl DerefMut for ItemBoxed { fn deref_mut(&mut self) -> &mut Self::Target { &mut *self.0 } } -impl PartialEq for StepBoxed +impl PartialEq for ItemBoxed where E: 'static, { @@ -62,29 +62,29 @@ where } } -impl Eq for StepBoxed where E: 'static {} +impl Eq for ItemBoxed where E: 'static {} -impl From for StepBoxed +impl From for ItemBoxed where - I: Clone + Debug + Step + Send + Sync + 'static, - ::Error: Send + Sync, + I: Clone + Debug + Item + Send + Sync + 'static, + ::Error: Send + Sync, E: Debug + Send + Sync + std::error::Error - + From<::Error> + + From<::Error> + From + 'static, - for<'params> ::Params<'params>: - TryFrom<<::Params<'params> as Params>::Partial>, + for<'params> ::Params<'params>: + TryFrom<<::Params<'params> as Params>::Partial>, for<'params> as Params>::Partial: From>, { - fn from(step: I) -> Self { - Self(Box::new(StepWrapper::from(step))) + fn from(item: I) -> Self { + Self(Box::new(ItemWrapper::from(item))) } } -impl DataAccessDyn for StepBoxed { +impl DataAccessDyn for ItemBoxed { fn borrows(&self) -> TypeIds { DataAccessDyn::borrows(self.0.as_ref()) } diff --git a/crate/rt_model/src/step_graph.rs b/crate/rt_model/src/step_graph.rs index ebefeaa67..3af8c64de 100644 --- a/crate/rt_model/src/step_graph.rs +++ b/crate/rt_model/src/step_graph.rs @@ -6,23 +6,23 @@ use std::{ use peace_data::fn_graph::FnGraph; use peace_resources::states::{States, StatesSerde}; -use crate::StepBoxed; +use crate::ItemBoxed; -/// Graph of all [`Step`]s, `FnGraph>` newtype. +/// Graph of all [`Item`]s, `FnGraph>` newtype. /// -/// [`Step`]: peace_cfg::Step +/// [`Item`]: peace_cfg::Item #[derive(Debug)] -pub struct StepGraph(FnGraph>); +pub struct ItemGraph(FnGraph>); // Manual implementation because derive requires `E` to be `Clone`, // which causes `graph.clone()` to call `FnGraph::clone`. -impl Clone for StepGraph { +impl Clone for ItemGraph { fn clone(&self) -> Self { Self(self.0.clone()) } } -impl PartialEq for StepGraph +impl PartialEq for ItemGraph where E: 'static, { @@ -31,56 +31,56 @@ where } } -impl Eq for StepGraph where E: 'static {} +impl Eq for ItemGraph where E: 'static {} -impl StepGraph { +impl ItemGraph { /// Returns the inner [`FnGraph`]. - pub fn into_inner(self) -> FnGraph> { + pub fn into_inner(self) -> FnGraph> { self.0 } /// Returns a user-friendly serializable states map. /// - /// This will contain an entry for all steps, in order of flow step + /// This will contain an entry for all items, in order of flow item /// insertion, whether or not a state exists in the provided `states` map. pub fn states_serde(&self, states: &States) -> StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, E: 'static, { - StatesSerde::from_iter(self.0.iter_insertion().map(|step| { - let step_id = step.id(); - (step_id.clone(), states.get_raw(step_id).cloned()) + StatesSerde::from_iter(self.0.iter_insertion().map(|item| { + let item_id = item.id(); + (item_id.clone(), states.get_raw(item_id).cloned()) })) } } -impl Deref for StepGraph { - type Target = FnGraph>; +impl Deref for ItemGraph { + type Target = FnGraph>; fn deref(&self) -> &Self::Target { &self.0 } } -impl DerefMut for StepGraph { +impl DerefMut for ItemGraph { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl From>> for StepGraph { - fn from(graph: FnGraph>) -> Self { +impl From>> for ItemGraph { + fn from(graph: FnGraph>) -> Self { Self(graph) } } -impl<'graph, ValueT, E> From<&'graph StepGraph> for StatesSerde +impl<'graph, ValueT, E> From<&'graph ItemGraph> for StatesSerde where ValueT: Clone + Debug + PartialEq + Eq, E: 'static, { - fn from(graph: &'graph StepGraph) -> Self { - StatesSerde::from_iter(graph.iter_insertion().map(|step| (step.id().clone(), None))) + fn from(graph: &'graph ItemGraph) -> Self { + StatesSerde::from_iter(graph.iter_insertion().map(|item| (item.id().clone(), None))) } } diff --git a/crate/rt_model/src/step_graph_builder.rs b/crate/rt_model/src/step_graph_builder.rs index f4ff8125b..74ef36487 100644 --- a/crate/rt_model/src/step_graph_builder.rs +++ b/crate/rt_model/src/step_graph_builder.rs @@ -2,52 +2,52 @@ use std::ops::{Deref, DerefMut}; use peace_data::fn_graph::FnGraphBuilder; -use crate::{StepBoxed, StepGraph}; +use crate::{ItemBoxed, ItemGraph}; -/// Builder for a [`StepGraph`], `FnGraphBuilder>` +/// Builder for a [`StepGraph`], `FnGraphBuilder>` /// newtype. #[derive(Debug)] -pub struct StepGraphBuilder(FnGraphBuilder>); +pub struct ItemGraphBuilder(FnGraphBuilder>); -impl StepGraphBuilder { - /// Returns a new `StepGraphBuilder`. +impl ItemGraphBuilder { + /// Returns a new `ItemGraphBuilder`. pub fn new() -> Self { Self::default() } /// Returns the inner [`FnGraphBuilder`]. - pub fn into_inner(self) -> FnGraphBuilder> { + pub fn into_inner(self) -> FnGraphBuilder> { self.0 } - /// Builds and returns the [`StepGraph`]. - pub fn build(self) -> StepGraph { - StepGraph::from(self.0.build()) + /// Builds and returns the [`ItemGraph`]. + pub fn build(self) -> ItemGraph { + ItemGraph::from(self.0.build()) } } -impl Default for StepGraphBuilder { +impl Default for ItemGraphBuilder { fn default() -> Self { Self(FnGraphBuilder::default()) } } -impl Deref for StepGraphBuilder { - type Target = FnGraphBuilder>; +impl Deref for ItemGraphBuilder { + type Target = FnGraphBuilder>; fn deref(&self) -> &Self::Target { &self.0 } } -impl DerefMut for StepGraphBuilder { +impl DerefMut for ItemGraphBuilder { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl From>> for StepGraphBuilder { - fn from(graph: FnGraphBuilder>) -> Self { +impl From>> for ItemGraphBuilder { + fn from(graph: FnGraphBuilder>) -> Self { Self(graph) } } diff --git a/crate/rt_model/src/step_rt.rs b/crate/rt_model/src/step_rt.rs index c8a39d0a9..54c11b809 100644 --- a/crate/rt_model/src/step_rt.rs +++ b/crate/rt_model/src/step_rt.rs @@ -1,7 +1,7 @@ use std::{any::Any, fmt::Debug}; use dyn_clone::DynClone; -use peace_cfg::{async_trait, FnCtx, StepId}; +use peace_cfg::{async_trait, FnCtx, ItemId}; use peace_data::fn_graph::{DataAccess, DataAccessDyn}; use peace_params::ParamsSpecs; use peace_resources::{ @@ -12,29 +12,29 @@ use peace_resources::{ }; use crate::{ - outcomes::{StepApplyBoxed, StepApplyPartialBoxed}, + outcomes::{ItemApplyBoxed, ItemApplyPartialBoxed}, ParamsSpecsTypeReg, StatesTypeReg, }; -/// Internal trait that erases the types from [`Step`] +/// Internal trait that erases the types from [`Item`] /// -/// This exists so that different implementations of [`Step`] can be held +/// This exists so that different implementations of [`Item`] can be held /// under the same boxed trait. /// -/// [`Step`]: peace_cfg::Step +/// [`Item`]: peace_cfg::Item #[async_trait(?Send)] -pub trait StepRt: +pub trait ItemRt: Any + Debug + DataAccess + DataAccessDyn + DynClone + Send + Sync + 'static { - /// Returns the ID of this step. + /// Returns the ID of this item. /// - /// See [`Step::id`]; + /// See [`Item::id`]; /// - /// [`Step::id`]: peace_cfg::Step::id - fn id(&self) -> &StepId; + /// [`Item::id`]: peace_cfg::Item::id + fn id(&self) -> &ItemId; - /// Returns whether this step is equal to the other. - fn eq(&self, other: &dyn StepRt) -> bool; + /// Returns whether this item is equal to the other. + fn eq(&self, other: &dyn ItemRt) -> bool; /// Returns `&self` as `&dyn Any`. /// @@ -42,7 +42,7 @@ pub trait StepRt: /// requirement. fn as_any(&self) -> &dyn Any; - /// Initializes data for the step's functions. + /// Initializes data for the item's functions. async fn setup(&self, resources: &mut Resources) -> Result<(), E> where E: Debug + std::error::Error; @@ -50,7 +50,7 @@ pub trait StepRt: /// Registers params and state types with the type registries for /// deserializing from disk. /// - /// This is necessary to deserialize `StepParamsFile`, + /// This is necessary to deserialize `ItemParamsFile`, /// `ParamsSpecsFile`, `StatesCurrentFile`, and `StatesGoalFile`. fn params_and_state_register( &self, @@ -61,14 +61,14 @@ pub trait StepRt: /// Returns if the given two states equal. /// /// This returns an error if the boxed states could not be downcasted to - /// this step's state, which indicates one of the following: + /// this item's state, which indicates one of the following: /// - /// * Peace contains a bug, and passed an incorrect box to this step. - /// * Step IDs were swapped, such that `StepA`'s state is passed to `StepB`. + /// * Peace contains a bug, and passed an incorrect box to this item. + /// * Item IDs were swapped, such that `ItemA`'s state is passed to `ItemB`. /// - /// This needs some rework on how step IDs are implemented -- as in, - /// whether we should use a string newtype for `StepId`s, or redesign - /// how `Step`s or related types are keyed. + /// This needs some rework on how item IDs are implemented -- as in, + /// whether we should use a string newtype for `ItemId`s, or redesign + /// how `Item`s or related types are keyed. /// /// Note: it is impossible to call this method if a `Step`'s state type has /// changed -- it would have failed on deserialization. @@ -76,9 +76,9 @@ pub trait StepRt: where E: Debug + std::error::Error; - /// Runs [`Step::state_clean`]. + /// Runs [`Item::state_clean`]. /// - /// [`Step::state_clean`]: peace_cfg::Step::state_clean + /// [`Item::state_clean`]: peace_cfg::Item::state_clean async fn state_clean( &self, params_specs: &ParamsSpecs, @@ -87,9 +87,9 @@ pub trait StepRt: where E: Debug + std::error::Error; - /// Runs [`Step::state_current`]`::`[`try_exec`]. + /// Runs [`Item::state_current`]`::`[`try_exec`]. /// - /// [`Step::state_current`]: peace_cfg::Step::state_current + /// [`Item::state_current`]: peace_cfg::Item::state_current /// [`try_exec`]: peace_cfg::TryFnSpec::try_exec async fn state_current_try_exec( &self, @@ -100,9 +100,9 @@ pub trait StepRt: where E: Debug + std::error::Error; - /// Runs [`Step::state_current`]`::`[`exec`]. + /// Runs [`Item::state_current`]`::`[`exec`]. /// - /// [`Step::state_current`]: peace_cfg::Step::state_current + /// [`Item::state_current`]: peace_cfg::Item::state_current /// [`exec`]: peace_cfg::TryFnSpec::exec async fn state_current_exec( &self, @@ -113,9 +113,9 @@ pub trait StepRt: where E: Debug + std::error::Error; - /// Runs [`Step::state_goal`]`::`[`try_exec`]. + /// Runs [`Item::state_goal`]`::`[`try_exec`]. /// - /// [`Step::state_goal`]: peace_cfg::Step::state_goal + /// [`Item::state_goal`]: peace_cfg::Item::state_goal /// [`try_exec`]: peace_cfg::TryFnSpec::try_exec async fn state_goal_try_exec( &self, @@ -126,9 +126,9 @@ pub trait StepRt: where E: Debug + std::error::Error; - /// Runs [`Step::state_goal`]`::`[`exec`]. + /// Runs [`Item::state_goal`]`::`[`exec`]. /// - /// [`Step::state_goal`]: peace_cfg::Step::state_goal + /// [`Item::state_goal`]: peace_cfg::Item::state_goal /// [`exec`]: peace_cfg::TryFnSpec::exec async fn state_goal_exec( &self, @@ -156,8 +156,8 @@ pub trait StepRt: &self, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result, E> where E: Debug + std::error::Error; @@ -166,21 +166,21 @@ pub trait StepRt: /// /// This runs the following functions in order: /// - /// * [`Step::state_current`] - /// * [`Step::state_goal`] - /// * [`Step::state_diff`] + /// * [`Item::state_current`] + /// * [`Item::state_goal`] + /// * [`Item::state_diff`] /// * [`ApplyFns::check`] /// - /// [`Step::state_current`]: peace_cfg::Step::state_current - /// [`Step::state_goal`]: peace_cfg::Step::state_goal - /// [`Step::state_diff`]: peace_cfg::Step::state_diff - /// [`ApplyFns::check`]: peace_cfg::Step::ApplyFns + /// [`Item::state_current`]: peace_cfg::Item::state_current + /// [`Item::state_goal`]: peace_cfg::Item::state_goal + /// [`Item::state_diff`]: peace_cfg::Item::state_diff + /// [`ApplyFns::check`]: peace_cfg::Item::ApplyFns async fn ensure_prepare( &self, params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - ) -> Result + ) -> Result where E: Debug + std::error::Error; @@ -188,25 +188,25 @@ pub trait StepRt: /// /// This runs the following functions in order: /// - /// * [`Step::state_current`] - /// * [`Step::state_clean`] - /// * [`Step::state_diff`] + /// * [`Item::state_current`] + /// * [`Item::state_clean`] + /// * [`Item::state_diff`] /// * [`ApplyFns::check`] /// - /// [`Step::state_current`]: peace_cfg::Step::state_current - /// [`Step::state_clean`]: peace_cfg::Step::state_clean - /// [`Step::state_diff`]: peace_cfg::Step::state_diff - /// [`ApplyFns::check`]: peace_cfg::Step::ApplyFns + /// [`Item::state_current`]: peace_cfg::Item::state_current + /// [`Item::state_clean`]: peace_cfg::Item::state_clean + /// [`Item::state_diff`]: peace_cfg::Item::state_diff + /// [`ApplyFns::check`]: peace_cfg::Item::ApplyFns async fn clean_prepare( &self, states_current: &StatesCurrent, params_specs: &ParamsSpecs, resources: &Resources, - ) -> Result + ) -> Result where E: Debug + std::error::Error; - /// Dry applies the step from its current state to its goal state. + /// Dry applies the item from its current state to its goal state. /// /// This runs the following function in order, passing in the information /// collected from [`ensure_prepare`] or [`clean_prepare`]: @@ -216,20 +216,20 @@ pub trait StepRt: /// # Parameters /// /// * `resources`: The resources in the current execution. - /// * `step_apply`: The information collected in `self.ensure_prepare`. + /// * `item_apply`: The information collected in `self.ensure_prepare`. /// - /// [`ApplyFns::exec_dry`]: peace_cfg::Step::ApplyFns + /// [`ApplyFns::exec_dry`]: peace_cfg::Item::ApplyFns async fn apply_exec_dry( &self, params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - step_apply: &mut StepApplyBoxed, + item_apply: &mut ItemApplyBoxed, ) -> Result<(), E> where E: Debug + std::error::Error; - /// Applies the step from its current state to its goal state. + /// Applies the item from its current state to its goal state. /// /// This runs the following function in order, passing in the information /// collected from [`ensure_prepare`] or [`clean_prepare`]: @@ -239,15 +239,15 @@ pub trait StepRt: /// # Parameters /// /// * `resources`: The resources in the current execution. - /// * `step_apply`: The information collected in `self.ensure_prepare`. + /// * `item_apply`: The information collected in `self.ensure_prepare`. /// - /// [`ApplyFns::exec`]: peace_cfg::Step::ApplyFns + /// [`ApplyFns::exec`]: peace_cfg::Item::ApplyFns async fn apply_exec( &self, params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - step_apply: &mut StepApplyBoxed, + item_apply: &mut ItemApplyBoxed, ) -> Result<(), E> where E: Debug + std::error::Error; diff --git a/crate/rt_model/src/step_wrapper.rs b/crate/rt_model/src/step_wrapper.rs index 9174a4aeb..5d617277d 100644 --- a/crate/rt_model/src/step_wrapper.rs +++ b/crate/rt_model/src/step_wrapper.rs @@ -5,7 +5,7 @@ use std::{ ops::{Deref, DerefMut}, }; -use peace_cfg::{async_trait, ApplyCheck, FnCtx, Step, StepId}; +use peace_cfg::{async_trait, ApplyCheck, FnCtx, Item, ItemId}; use peace_data::{ fn_graph::{DataAccess, DataAccessDyn, TypeIds}, marker::{ApplyDry, Clean, Current, Goal}, @@ -21,24 +21,24 @@ use peace_resources::{ use type_reg::untagged::BoxDataTypeDowncast; use crate::{ - outcomes::{StepApply, StepApplyBoxed, StepApplyPartial, StepApplyPartialBoxed}, - StepRt, ParamsSpecsTypeReg, StateDowncastError, StatesTypeReg, + outcomes::{ItemApply, ItemApplyBoxed, ItemApplyPartial, ItemApplyPartialBoxed}, + ItemRt, ParamsSpecsTypeReg, StateDowncastError, StatesTypeReg, }; -/// Wraps a type implementing [`Step`]. +/// Wraps a type implementing [`Item`]. /// /// # Type Parameters /// -/// * `I`: Step type to wrap. +/// * `I`: Item type to wrap. /// * `E`: Application specific error type. /// /// Notably, `E` here should be the application's error type, which is not -/// necessarily the step's error type (unless you have only one step +/// necessarily the item's error type (unless you have only one item /// spec in the application). #[allow(clippy::type_complexity)] -pub struct StepWrapper(I, PhantomData); +pub struct ItemWrapper(I, PhantomData); -impl Clone for StepWrapper +impl Clone for ItemWrapper where I: Clone, { @@ -47,26 +47,26 @@ where } } -impl PartialEq for StepWrapper { +impl PartialEq for ItemWrapper { fn eq(&self, _other: &Self) -> bool { true } } -impl Eq for StepWrapper {} +impl Eq for ItemWrapper {} -impl StepWrapper +impl ItemWrapper where - I: Debug + Step + Send + Sync, + I: Debug + Item + Send + Sync, E: Debug + Send + Sync + std::error::Error - + From<::Error> + + From<::Error> + From + 'static, - for<'params> ::Params<'params>: - TryFrom<<::Params<'params> as Params>::Partial>, + for<'params> ::Params<'params>: + TryFrom<<::Params<'params> as Params>::Partial>, for<'params> as Params>::Partial: From>, { async fn state_clean( @@ -76,15 +76,15 @@ where ) -> Result { let state_clean = { let params_partial = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Clean, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -107,15 +107,15 @@ where ) -> Result, E> { let state_current = { let params_partial = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Current, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -140,15 +140,15 @@ where ) -> Result { let state_current = { let params = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Current, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -170,15 +170,15 @@ where fn_ctx: FnCtx<'_>, ) -> Result, E> { let params_partial = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Goal, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -194,12 +194,12 @@ where Ok(state_goal) } - /// Returns the goal state for this step. + /// Returns the goal state for this item. /// /// `value_resolution_ctx` is passed in because: /// /// * When discovering the goal state for a flow, without altering any - /// steps, the goal state of a successor is dependent on the goal state of + /// items, the goal state of a successor is dependent on the goal state of /// a predecessor. /// * When discovering the goal state of a successor, after a predecessor /// has had state applied, the predecessor's goal state does not @@ -217,15 +217,15 @@ where fn_ctx: FnCtx<'_>, ) -> Result { let params = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( value_resolution_mode, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -243,12 +243,12 @@ where &self, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result, E> { - let step_id = ::id(self); - let state_base = states_a.get::(step_id); - let state_goal = states_b.get::(step_id); + let item_id = ::id(self); + let state_base = states_a.get::(item_id); + let state_goal = states_b.get::(item_id); if let Some((state_base, state_goal)) = state_base.zip(state_goal) { let state_diff: I::StateDiff = self @@ -277,29 +277,29 @@ where ) -> Result { let state_diff: I::StateDiff = { let params_partial = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; // Running `diff` for a single profile will be between the current and goal // states, and parameters are not really intended to be used for diffing. // - // However for `ShCmdStep`, the shell script for diffing's path is in + // However for `ShCmdItem`, the shell script for diffing's path is in // params, which *likely* would be provided as direct `Value`s instead of // mapped from predecessors' state(s). Iff the values are mapped from a // predecessor's state, then we would want it to be the goal state, as that // is closest to the correct value -- `ValueResolutionMode::ApplyDry` is used in - // `Step::apply_dry`, and `ValueResolutionMode::Apply` is used in - // `Step::apply`. + // `Item::apply_dry`, and `ValueResolutionMode::Apply` is used in + // `Item::apply`. // // Running `diff` for multiple profiles will likely be between two profiles' // current states. let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Goal, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -325,11 +325,11 @@ where value_resolution_mode: ValueResolutionMode, ) -> Result { let params_partial = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; // Normally an `apply_check` only compares the states / state diff. @@ -341,7 +341,7 @@ where // state will be fed into successors' goal state. let mut value_resolution_ctx = ValueResolutionCtx::new( value_resolution_mode, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -354,7 +354,7 @@ where .await .map_err(Into::::into) } else { - // > If we cannot resolve parameters, then this step, and its predecessor are + // > If we cannot resolve parameters, then this item, and its predecessor are // > cleaned up. // // The above is not necessarily true -- the user may have provided an incorrect @@ -373,15 +373,15 @@ where state_diff: &I::StateDiff, ) -> Result { let params = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::ApplyDry, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -409,15 +409,15 @@ where state_diff: &I::StateDiff, ) -> Result { let params = { - let step_id = self.id(); + let item_id = self.id(); let params_spec = params_specs - .get::>, _>(step_id) + .get::>, _>(item_id) .ok_or_else(|| crate::Error::ParamsSpecNotFound { - step_id: step_id.clone(), + item_id: item_id.clone(), })?; let mut value_resolution_ctx = ValueResolutionCtx::new( ValueResolutionMode::Current, - step_id.clone(), + item_id.clone(), tynm::type_name::>(), ); params_spec @@ -435,7 +435,7 @@ where } } -impl Debug for StepWrapper +impl Debug for ItemWrapper where I: Debug, { @@ -444,7 +444,7 @@ where } } -impl Deref for StepWrapper { +impl Deref for ItemWrapper { type Target = I; fn deref(&self) -> &Self::Target { @@ -452,26 +452,26 @@ impl Deref for StepWrapper { } } -impl DerefMut for StepWrapper { +impl DerefMut for ItemWrapper { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl From for StepWrapper +impl From for ItemWrapper where - I: Debug + Step + Send + Sync, - E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, + I: Debug + Item + Send + Sync, + E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, { - fn from(step: I) -> Self { - Self(step, PhantomData) + fn from(item: I) -> Self { + Self(item, PhantomData) } } -impl DataAccess for StepWrapper +impl DataAccess for ItemWrapper where - I: Debug + Step + Send + Sync, - E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, + I: Debug + Item + Send + Sync, + E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, { fn borrows() -> TypeIds { let mut type_ids = as DataAccess>::borrows(); @@ -485,10 +485,10 @@ where } } -impl DataAccessDyn for StepWrapper +impl DataAccessDyn for ItemWrapper where - I: Debug + Step + Send + Sync, - E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, + I: Debug + Item + Send + Sync, + E: Debug + Send + Sync + std::error::Error + From<::Error> + 'static, { fn borrows(&self) -> TypeIds { let mut type_ids = as DataAccess>::borrows(); @@ -503,29 +503,29 @@ where } #[async_trait(?Send)] -impl StepRt for StepWrapper +impl ItemRt for ItemWrapper where - I: Clone + Debug + Step + Send + Sync + 'static, + I: Clone + Debug + Item + Send + Sync + 'static, E: Debug + Send + Sync + std::error::Error - + From<::Error> + + From<::Error> + From + 'static, - for<'params> ::Params<'params>: - TryFrom<<::Params<'params> as Params>::Partial>, + for<'params> ::Params<'params>: + TryFrom<<::Params<'params> as Params>::Partial>, for<'params> as Params>::Partial: From>, { - fn id(&self) -> &StepId { - ::id(self) + fn id(&self) -> &ItemId { + ::id(self) } - fn eq(&self, other: &dyn StepRt) -> bool { + fn eq(&self, other: &dyn ItemRt) -> bool { if self.id() == other.id() { let other = other.as_any(); - if let Some(step_wrapper) = other.downcast_ref::() { - self == step_wrapper + if let Some(item_wrapper) = other.downcast_ref::() { + self == item_wrapper } else { false } @@ -550,7 +550,7 @@ where resources.insert(ApplyDry::(None)); // Run user defined setup. - ::setup(self, resources) + ::setup(self, resources) .await .map_err(Into::::into) } @@ -645,7 +645,7 @@ where fn_ctx: FnCtx<'_>, ) -> Result { self.state_goal_exec( - // Use the would-be state of predecessor to discover goal state of this step. + // Use the would-be state of predecessor to discover goal state of this item. // // TODO: this means we may need to overlay the goal state with the predecessor's // current state. @@ -666,8 +666,8 @@ where &self, params_specs: &ParamsSpecs, resources: &Resources, - states_a: &TypeMap, - states_b: &TypeMap, + states_a: &TypeMap, + states_b: &TypeMap, ) -> Result, E> { self.state_diff_exec(params_specs, resources, states_a, states_b) .await @@ -680,15 +680,15 @@ where params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - ) -> Result { - let mut step_apply_partial = StepApplyPartial::::new(); + ) -> Result { + let mut item_apply_partial = ItemApplyPartial::::new(); match self .state_current_exec(params_specs, resources, fn_ctx) .await { - Ok(state_current) => step_apply_partial.state_current = Some(state_current), - Err(error) => return Err((error, step_apply_partial.into())), + Ok(state_current) => item_apply_partial.state_current = Some(state_current), + Err(error) => return Err((error, item_apply_partial.into())), } #[cfg(feature = "output_progress")] fn_ctx.progress_sender().reset_to_pending(); @@ -702,8 +702,8 @@ where ) .await { - Ok(state_goal) => step_apply_partial.state_target = Some(state_goal), - Err(error) => return Err((error, step_apply_partial.into())), + Ok(state_goal) => item_apply_partial.state_target = Some(state_goal), + Err(error) => return Err((error, item_apply_partial.into())), } #[cfg(feature = "output_progress")] fn_ctx.progress_sender().reset_to_pending(); @@ -711,25 +711,25 @@ where .state_diff_exec_with( params_specs, resources, - step_apply_partial + item_apply_partial .state_current .as_ref() .expect("unreachable: This is set just above."), - step_apply_partial + item_apply_partial .state_target .as_ref() .expect("unreachable: This is set just above."), ) .await { - Ok(state_diff) => step_apply_partial.state_diff = Some(state_diff), - Err(error) => return Err((error, step_apply_partial.into())), + Ok(state_diff) => item_apply_partial.state_diff = Some(state_diff), + Err(error) => return Err((error, item_apply_partial.into())), } let (Some(state_current), Some(state_goal), Some(state_diff)) = ( - step_apply_partial.state_current.as_ref(), - step_apply_partial.state_target.as_ref(), - step_apply_partial.state_diff.as_ref(), + item_apply_partial.state_current.as_ref(), + item_apply_partial.state_target.as_ref(), + item_apply_partial.state_diff.as_ref(), ) else { unreachable!("These are set just above."); }; @@ -747,7 +747,7 @@ where .await; let state_applied = match apply_check { Ok(apply_check) => { - step_apply_partial.apply_check = Some(apply_check); + item_apply_partial.apply_check = Some(apply_check); // TODO: write test for this case match apply_check { @@ -755,13 +755,13 @@ where ApplyCheck::ExecRequired => None, #[cfg(feature = "output_progress")] ApplyCheck::ExecRequired { .. } => None, - ApplyCheck::ExecNotRequired => step_apply_partial.state_current.clone(), + ApplyCheck::ExecNotRequired => item_apply_partial.state_current.clone(), } } - Err(error) => return Err((error, step_apply_partial.into())), + Err(error) => return Err((error, item_apply_partial.into())), }; - Ok(StepApply::try_from((step_apply_partial, state_applied)) + Ok(ItemApply::try_from((item_apply_partial, state_applied)) .expect("unreachable: All the fields are set above.") .into()) } @@ -771,27 +771,27 @@ where params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - step_apply_boxed: &mut StepApplyBoxed, + item_apply_boxed: &mut ItemApplyBoxed, ) -> Result<(), E> { - let Some(step_apply) = step_apply_boxed + let Some(item_apply) = item_apply_boxed .as_data_type_mut() - .downcast_mut::>() + .downcast_mut::>() else { panic!( - "Failed to downcast `StepApplyBoxed` to `{concrete_type}`.\n\ + "Failed to downcast `ItemApplyBoxed` to `{concrete_type}`.\n\ This is a bug in the Peace framework.", - concrete_type = std::any::type_name::>() + concrete_type = std::any::type_name::>() ) }; - let StepApply { + let ItemApply { state_current_stored: _, state_current, state_target, state_diff, apply_check, state_applied, - } = step_apply; + } = item_apply; match apply_check { #[cfg(not(feature = "output_progress"))] @@ -835,50 +835,50 @@ where states_current: &StatesCurrent, params_specs: &ParamsSpecs, resources: &Resources, - ) -> Result { - let mut step_apply_partial = StepApplyPartial::::new(); + ) -> Result { + let mut item_apply_partial = ItemApplyPartial::::new(); if let Some(state_current) = states_current.get::(self.id()) { - step_apply_partial.state_current = Some(state_current.clone()); + item_apply_partial.state_current = Some(state_current.clone()); } else { - // Hack: Setting StepApplyPartial state_current to state_clean is a hack, - // which allows successor steps to read the state of a predecessor, when + // Hack: Setting ItemApplyPartial state_current to state_clean is a hack, + // which allows successor items to read the state of a predecessor, when // none can be discovered. // // This may not necessarily be a hack. match self.state_clean(params_specs, resources).await { - Ok(state_clean) => step_apply_partial.state_current = Some(state_clean), - Err(error) => return Err((error, step_apply_partial.into())), + Ok(state_clean) => item_apply_partial.state_current = Some(state_clean), + Err(error) => return Err((error, item_apply_partial.into())), } } match self.state_clean(params_specs, resources).await { - Ok(state_clean) => step_apply_partial.state_target = Some(state_clean), - Err(error) => return Err((error, step_apply_partial.into())), + Ok(state_clean) => item_apply_partial.state_target = Some(state_clean), + Err(error) => return Err((error, item_apply_partial.into())), } match self .state_diff_exec_with( params_specs, resources, - step_apply_partial + item_apply_partial .state_current .as_ref() .expect("unreachable: This is confirmed just above."), - step_apply_partial + item_apply_partial .state_target .as_ref() .expect("unreachable: This is set just above."), ) .await { - Ok(state_diff) => step_apply_partial.state_diff = Some(state_diff), - Err(error) => return Err((error, step_apply_partial.into())), + Ok(state_diff) => item_apply_partial.state_diff = Some(state_diff), + Err(error) => return Err((error, item_apply_partial.into())), } let (Some(state_current), Some(state_clean), Some(state_diff)) = ( - step_apply_partial.state_current.as_ref(), - step_apply_partial.state_target.as_ref(), - step_apply_partial.state_diff.as_ref(), + item_apply_partial.state_current.as_ref(), + item_apply_partial.state_target.as_ref(), + item_apply_partial.state_diff.as_ref(), ) else { unreachable!("These are set just above."); }; @@ -897,7 +897,7 @@ where let state_applied = match apply_check { Ok(apply_check) => { - step_apply_partial.apply_check = Some(apply_check); + item_apply_partial.apply_check = Some(apply_check); // TODO: write test for this case match apply_check { @@ -905,13 +905,13 @@ where ApplyCheck::ExecRequired => None, #[cfg(feature = "output_progress")] ApplyCheck::ExecRequired { .. } => None, - ApplyCheck::ExecNotRequired => step_apply_partial.state_current.clone(), + ApplyCheck::ExecNotRequired => item_apply_partial.state_current.clone(), } } - Err(error) => return Err((error, step_apply_partial.into())), + Err(error) => return Err((error, item_apply_partial.into())), }; - Ok(StepApply::try_from((step_apply_partial, state_applied)) + Ok(ItemApply::try_from((item_apply_partial, state_applied)) .expect("unreachable: All the fields are set above.") .into()) } @@ -921,27 +921,27 @@ where params_specs: &ParamsSpecs, resources: &Resources, fn_ctx: FnCtx<'_>, - step_apply_boxed: &mut StepApplyBoxed, + item_apply_boxed: &mut ItemApplyBoxed, ) -> Result<(), E> { - let Some(step_apply) = step_apply_boxed + let Some(item_apply) = item_apply_boxed .as_data_type_mut() - .downcast_mut::>() + .downcast_mut::>() else { panic!( - "Failed to downcast `StepApplyBoxed` to `{concrete_type}`.\n\ + "Failed to downcast `ItemApplyBoxed` to `{concrete_type}`.\n\ This is a bug in the Peace framework.", - concrete_type = std::any::type_name::>() + concrete_type = std::any::type_name::>() ) }; - let StepApply { + let ItemApply { state_current_stored: _, state_current, state_target, state_diff, apply_check, state_applied, - } = step_apply; + } = item_apply; match apply_check { #[cfg(not(feature = "output_progress"))] diff --git a/crate/rt_model_core/src/cmd_progress_tracker.rs b/crate/rt_model_core/src/cmd_progress_tracker.rs index b416ce3cd..09f78e6f6 100644 --- a/crate/rt_model_core/src/cmd_progress_tracker.rs +++ b/crate/rt_model_core/src/cmd_progress_tracker.rs @@ -1,8 +1,8 @@ use indexmap::IndexMap; use indicatif::MultiProgress; -use peace_core::{progress::ProgressTracker, StepId}; +use peace_core::{progress::ProgressTracker, ItemId}; -/// Tracks command execution progress for all steps. +/// Tracks command execution progress for all items. /// /// The Peace framework initializes the `multi_progress` and `progress_trackers` /// and manages updating the `ProgressBar` values. @@ -17,15 +17,15 @@ use peace_core::{progress::ProgressTracker, StepId}; pub struct CmdProgressTracker { /// `MultiProgress` that tracks the remaining progress bars. pub multi_progress: MultiProgress, - /// Tracks progress for each step. - pub progress_trackers: IndexMap, + /// Tracks progress for each item. + pub progress_trackers: IndexMap, } impl CmdProgressTracker { /// Returns a new `CmdProgressTracker`. pub fn new( multi_progress: MultiProgress, - progress_trackers: IndexMap, + progress_trackers: IndexMap, ) -> Self { Self { multi_progress, @@ -44,14 +44,14 @@ impl CmdProgressTracker { &mut self.multi_progress } - /// Returns the `ProgressTracker`s for each step. - pub fn progress_trackers(&self) -> &IndexMap { + /// Returns the `ProgressTracker`s for each item. + pub fn progress_trackers(&self) -> &IndexMap { &self.progress_trackers } - /// Returns a mutable reference to the `ProgressTracker`s for each step + /// Returns a mutable reference to the `ProgressTracker`s for each item /// spec. - pub fn progress_trackers_mut(&mut self) -> &mut IndexMap { + pub fn progress_trackers_mut(&mut self) -> &mut IndexMap { &mut self.progress_trackers } } diff --git a/crate/rt_model_core/src/error.rs b/crate/rt_model_core/src/error.rs index 34a2ade44..e78c7c974 100644 --- a/crate/rt_model_core/src/error.rs +++ b/crate/rt_model_core/src/error.rs @@ -1,7 +1,7 @@ use std::path::PathBuf; use peace_cmd_model::CmdExecutionError; -use peace_core::{FlowId, StepId, Profile}; +use peace_core::{FlowId, ItemId, Profile}; use peace_params::{ParamsResolveError, ParamsSpecs}; use peace_resources::paths::ParamsSpecsFile; @@ -82,10 +82,10 @@ pub enum Error { ParamsResolveError, ), - /// A `Params::Spec` was not present for a given step ID. + /// A `Params::Spec` was not present for a given item ID. /// /// If this happens, this is a bug in the Peace framework. - #[error("A `Params::Spec` was not present for step: {step_id}")] + #[error("A `Params::Spec` was not present for item: {item_id}")] #[cfg_attr( feature = "error_reporting", diagnostic( @@ -101,17 +101,17 @@ pub enum Error { ) )] ParamsSpecNotFound { - /// Step ID for which the params spec was not found. - step_id: StepId, + /// Item ID for which the params spec was not found. + item_id: ItemId, }, - /// Step params specs do not match with the steps in the flow. + /// Item params specs do not match with the items in the flow. /// /// # Symptoms /// - /// * Provided params specs for a step ID has no corresponding step ID in + /// * Provided params specs for a step ID has no corresponding item ID in /// the flow. - /// * Stored params specs for a step ID has no corresponding step ID in the + /// * Stored params specs for a step ID has no corresponding item ID in the /// flow. /// * ID of a step in the flow does not have a corresponding provided /// params spec. @@ -122,28 +122,28 @@ pub enum Error { /// /// These can happen when: /// - /// * An step is added. + /// * An item is added. /// /// - No corresponding provided params spec. /// - No corresponding stored params spec. /// - /// * An step ID is renamed. + /// * An item ID is renamed. /// /// - Provided params spec ID mismatch. /// - Stored params spec ID mismatch. /// - No corresponding provided params spec. /// - /// * An step is removed. + /// * An item is removed. /// /// - Provided params spec ID mismatch. /// - Stored params spec ID mismatch. - #[error("Step params specs do not match with the steps in the flow.")] + #[error("Item params specs do not match with the items in the flow.")] #[cfg_attr( feature = "error_reporting", diagnostic( code(peace_rt_model::params_specs_mismatch), help("{}", params_specs_mismatch_display( - step_ids_with_no_params_specs, + item_ids_with_no_params_specs, params_specs_provided_mismatches, params_specs_stored_mismatches.as_ref(), params_specs_not_usable, @@ -151,16 +151,16 @@ pub enum Error { ) )] ParamsSpecsMismatch { - /// Step IDs for which there are no provided or stored params spec. - step_ids_with_no_params_specs: Vec, - /// Provided params specs with no matching step ID in the flow. + /// Item IDs for which there are no provided or stored params spec. + item_ids_with_no_params_specs: Vec, + /// Provided params specs with no matching item ID in the flow. params_specs_provided_mismatches: ParamsSpecs, - /// Stored params specs with no matching step ID in the flow. + /// Stored params specs with no matching item ID in the flow. params_specs_stored_mismatches: Option, - /// Step IDs which had a mapping function previously provided in + /// Item IDs which had a mapping function previously provided in /// its params spec, but on a subsequent invocation nothing was /// provided. - params_specs_not_usable: Vec, + params_specs_not_usable: Vec, }, /// In a `MultiProfileSingleFlow` diff, neither profile had `Params::Specs` @@ -171,8 +171,8 @@ pub enum Error { diagnostic( code(peace_rt_model::params_specs_not_defined_for_diff), help( - "Make sure at least one of the flows has `.with_steps_params(..)`\n\ - defined for every step in the flow." + "Make sure at least one of the flows has `.with_items_params(..)`\n\ + defined for every item in the flow." ) ) )] @@ -213,10 +213,10 @@ pub enum Error { diagnostic( code(peace_rt_model::states_deserialize), help( - "Make sure that all commands using the `{flow_id}` flow, also use the same step graph.\n\ - This is because all Steps are used to deserialize state.\n\ + "Make sure that all commands using the `{flow_id}` flow, also use the same item graph.\n\ + This is because all Items are used to deserialize state.\n\ \n\ - If the step graph is different, it may make sense to use a different flow ID." + If the item graph is different, it may make sense to use a different flow ID." ) ) )] @@ -258,10 +258,10 @@ pub enum Error { diagnostic( code(peace_rt_model::params_specs_deserialize), help( - "Make sure that all commands using the `{flow_id}` flow, also use the same step graph.\n\ - This is because all Steps are used to deserialize state.\n\ + "Make sure that all commands using the `{flow_id}` flow, also use the same item graph.\n\ + This is because all Items are used to deserialize state.\n\ \n\ - If the step graph is different, it may make sense to use a different flow ID." + If the item graph is different, it may make sense to use a different flow ID." ) ) )] @@ -491,13 +491,13 @@ pub enum Error { )] FlowParamsDeserialize(#[source] serde_yaml::Error), - /// Step does not exist in storage. - #[error("Step does not exist in storage: `{}`.", path.display())] + /// Item does not exist in storage. + #[error("Item does not exist in storage: `{}`.", path.display())] #[cfg_attr( feature = "error_reporting", - diagnostic(code(peace_rt_model::step_not_exists)) + diagnostic(code(peace_rt_model::item_not_exists)) )] - StepNotExists { + ItemNotExists { /// Path to the file. path: PathBuf, }, @@ -534,21 +534,21 @@ pub enum Error { #[cfg(feature = "error_reporting")] fn params_specs_mismatch_display( - step_ids_with_no_params: &[StepId], + item_ids_with_no_params: &[ItemId], params_specs_provided_mismatches: &ParamsSpecs, params_specs_stored_mismatches: Option<&ParamsSpecs>, - params_specs_not_usable: &[StepId], + params_specs_not_usable: &[ItemId], ) -> String { - let mut steps = Vec::::new(); + let mut items = Vec::::new(); - if !step_ids_with_no_params.is_empty() { - steps.push(format!( - "The following steps do not have parameters provided:\n\ + if !item_ids_with_no_params.is_empty() { + items.push(format!( + "The following items do not have parameters provided:\n\ \n\ {}\n", - step_ids_with_no_params + item_ids_with_no_params .iter() - .map(|step_id| format!("* {step_id}")) + .map(|item_id| format!("* {item_id}")) .collect::>() .join("\n") )); @@ -557,11 +557,11 @@ fn params_specs_mismatch_display( if !params_specs_provided_mismatches.is_empty() { let params_specs_provided_mismatches_list = params_specs_provided_mismatches .keys() - .map(|step_id| format!("* {step_id}")) + .map(|item_id| format!("* {item_id}")) .collect::>() .join("\n"); - steps.push(format!( - "The following provided params specs do not correspond to any steps in the flow:\n\ + items.push(format!( + "The following provided params specs do not correspond to any items in the flow:\n\ \n\ {params_specs_provided_mismatches_list}\n", )) @@ -571,11 +571,11 @@ fn params_specs_mismatch_display( if !params_specs_stored_mismatches.is_empty() { let params_specs_stored_mismatches_list = params_specs_stored_mismatches .keys() - .map(|step_id| format!("* {step_id}")) + .map(|item_id| format!("* {item_id}")) .collect::>() .join("\n"); - steps.push(format!( - "The following stored params specs do not correspond to any steps in the flow:\n\ + items.push(format!( + "The following stored params specs do not correspond to any items in the flow:\n\ \n\ {params_specs_stored_mismatches_list}\n", )); @@ -583,8 +583,8 @@ fn params_specs_mismatch_display( } if !params_specs_not_usable.is_empty() { - steps.push(format!( - "The following steps either have not had a params spec provided previously,\n\ + items.push(format!( + "The following items either have not had a params spec provided previously,\n\ or had contained a mapping function, which cannot be loaded from disk.\n\ \n\ So the params spec needs to be provided to the command context for:\n\ @@ -592,11 +592,11 @@ fn params_specs_mismatch_display( {}\n", params_specs_not_usable .iter() - .map(|step_id| format!("* {step_id}")) + .map(|item_id| format!("* {item_id}")) .collect::>() .join("\n") )); } - steps.join("\n") + items.join("\n") } diff --git a/crate/rt_model_core/src/error/apply_cmd_error.rs b/crate/rt_model_core/src/error/apply_cmd_error.rs index 62489bcb4..a041451ef 100644 --- a/crate/rt_model_core/src/error/apply_cmd_error.rs +++ b/crate/rt_model_core/src/error/apply_cmd_error.rs @@ -1,15 +1,15 @@ use std::{fmt, fmt::Write}; -use crate::{StepsStateStoredStale, StateStoredAndDiscovered}; +use crate::{ItemsStateStoredStale, StateStoredAndDiscovered}; -/// Error applying changes to steps. +/// Error applying changes to items. #[cfg_attr(feature = "error_reporting", derive(miette::Diagnostic))] #[derive(Debug, thiserror::Error)] pub enum ApplyCmdError { /// Stored current states were not up to date with actual current states. #[error( "Stored current states were not up to date with actual current states.\n\n{stale_states}", - stale_states = stale_states_fmt(steps_state_stored_stale)?, + stale_states = stale_states_fmt(items_state_stored_stale)?, )] #[cfg_attr( feature = "error_reporting", @@ -24,15 +24,15 @@ pub enum ApplyCmdError { ) )] StatesCurrentOutOfSync { - /// Steps whose stored current state is out of sync with the discovered + /// Items whose stored current state is out of sync with the discovered /// state. - steps_state_stored_stale: StepsStateStoredStale, + items_state_stored_stale: ItemsStateStoredStale, }, /// Stored goal states were not up to date with actual goal states. #[error( "Stored goal states were not up to date with actual goal states.\n\n{stale_states}", - stale_states = stale_states_fmt(steps_state_stored_stale)?, + stale_states = stale_states_fmt(items_state_stored_stale)?, )] #[cfg_attr( feature = "error_reporting", @@ -47,20 +47,20 @@ pub enum ApplyCmdError { ) )] StatesGoalOutOfSync { - /// Steps whose stored goal state is out of sync with the discovered + /// Items whose stored goal state is out of sync with the discovered /// state. - steps_state_stored_stale: StepsStateStoredStale, + items_state_stored_stale: ItemsStateStoredStale, }, } fn stale_states_fmt( - steps_state_stored_stale: &StepsStateStoredStale, + items_state_stored_stale: &ItemsStateStoredStale, ) -> Result { - let mut buffer = String::with_capacity(steps_state_stored_stale.len() * 256); - steps_state_stored_stale + let mut buffer = String::with_capacity(items_state_stored_stale.len() * 256); + items_state_stored_stale .iter() - .try_for_each(|(step_id, state_stored_and_discovered)| { - writeln!(&mut buffer, "* {step_id}:\n")?; + .try_for_each(|(item_id, state_stored_and_discovered)| { + writeln!(&mut buffer, "* {item_id}:\n")?; match state_stored_and_discovered { StateStoredAndDiscovered::OnlyStoredExists { state_stored } => { diff --git a/crate/rt_model_core/src/error/state_downcast_error.rs b/crate/rt_model_core/src/error/state_downcast_error.rs index 6b9ad2be4..fa859e7ab 100644 --- a/crate/rt_model_core/src/error/state_downcast_error.rs +++ b/crate/rt_model_core/src/error/state_downcast_error.rs @@ -4,9 +4,9 @@ use type_reg::untagged::{BoxDtDisplay, DataType}; #[cfg_attr(feature = "error_reporting", derive(miette::Diagnostic))] #[derive(Debug, thiserror::Error)] pub enum StateDowncastError { - /// Both step states could not be downcasted. + /// Both item states could not be downcasted. #[error( - "Step states could not be downcasted to `{ty_name}`.\n\ + "Item states could not be downcasted to `{ty_name}`.\n\ Boxed type are:\n\ \n\ * `{boxed_ty_a:?}`.\n\ @@ -23,14 +23,14 @@ pub enum StateDowncastError { help( "\ This error happens when the boxed states could not be downcasted to - this step's state, which indicates one of the following:\n\ + this item's state, which indicates one of the following:\n\ \n\ - * Peace contains a bug, and passed an incorrect box to this step.\n\ - * Step IDs were swapped, such that `StepA`'s state is passed to `StepB`.\n\ + * Peace contains a bug, and passed an incorrect box to this item.\n\ + * Item IDs were swapped, such that `ItemA`'s state is passed to `ItemB`.\n\ \n\ - This needs some rework on how step IDs are implemented -- as in, - whether we should use a string newtype for `StepId`s, or redesign - how `Step`s or related types are keyed.\n\ + This needs some rework on how item IDs are implemented -- as in, + whether we should use a string newtype for `ItemId`s, or redesign + how `Item`s or related types are keyed.\n\ " ), ) @@ -43,9 +43,9 @@ pub enum StateDowncastError { /// Second state parameter. state_b: BoxDtDisplay, }, - /// First step state could not be downcasted. + /// First item state could not be downcasted. #[error( - "First step state could not be downcasted to `{ty_name}`.\n\ + "First item state could not be downcasted to `{ty_name}`.\n\ Boxed type is `{boxed_ty:?}`.", ty_name = ty_name, boxed_ty = state_a.type_name(), @@ -57,14 +57,14 @@ pub enum StateDowncastError { help( "\ This error happens when the boxed states could not be downcasted to - this step's state, which indicates one of the following:\n\ + this item's state, which indicates one of the following:\n\ \n\ - * Peace contains a bug, and passed an incorrect box to this step.\n\ - * Step IDs were swapped, such that `StepA`'s state is passed to `StepB`.\n\ + * Peace contains a bug, and passed an incorrect box to this item.\n\ + * Item IDs were swapped, such that `ItemA`'s state is passed to `ItemB`.\n\ \n\ - This needs some rework on how step IDs are implemented -- as in, - whether we should use a string newtype for `StepId`s, or redesign - how `Step`s or related types are keyed.\n\ + This needs some rework on how item IDs are implemented -- as in, + whether we should use a string newtype for `ItemId`s, or redesign + how `Item`s or related types are keyed.\n\ " ), ) @@ -75,9 +75,9 @@ pub enum StateDowncastError { /// First state parameter. state_a: BoxDtDisplay, }, - /// Second step state could not be downcasted. + /// Second item state could not be downcasted. #[error( - "Second step state could not be downcasted to `{ty_name}`.\n\ + "Second item state could not be downcasted to `{ty_name}`.\n\ Boxed type is `{boxed_ty:?}`.", ty_name = ty_name, boxed_ty = state_b.type_name(), @@ -89,14 +89,14 @@ pub enum StateDowncastError { help( "\ This error happens when the boxed states could not be downcasted to - this step's state, which indicates one of the following:\n\ + this item's state, which indicates one of the following:\n\ \n\ - * Peace contains a bug, and passed an incorrect box to this step.\n\ - * Step IDs were swapped, such that `StepA`'s state is passed to `StepB`.\n\ + * Peace contains a bug, and passed an incorrect box to this item.\n\ + * Item IDs were swapped, such that `ItemA`'s state is passed to `ItemB`.\n\ \n\ - This needs some rework on how step IDs are implemented -- as in, - whether we should use a string newtype for `StepId`s, or redesign - how `Step`s or related types are keyed.\n\ + This needs some rework on how item IDs are implemented -- as in, + whether we should use a string newtype for `ItemId`s, or redesign + how `Item`s or related types are keyed.\n\ " ), ) From ddafd6ef43f27e6e8bb96a86a0a8f3c94d6a664e Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Sun, 2 Jun 2024 13:49:38 +1200 Subject: [PATCH 6/9] Revert "Rename `an item` to `a step`." This reverts commit e4dc13970f5f1226bd1da1001f301ec30e8e23ab. --- crate/cfg/src/fn_ctx.rs | 2 +- crate/cfg/src/state.rs | 12 ++++---- crate/cfg/src/step.rs | 6 ++-- crate/cmd/src/ctx/cmd_ctx_builder.rs | 2 +- crate/cmd_model/src/cmd_outcome.rs | 2 +- crate/cmd_model/src/step_stream_outcome.rs | 2 +- crate/cmd_rt/src/cmd_block.rs | 2 +- .../cmd_rt/src/cmd_block/cmd_block_wrapper.rs | 6 ++-- .../cmd_rt/src/step_stream_outcome_mapper.rs | 2 +- crate/code_gen/src/cmd/impl_common_fns.rs | 2 +- crate/core/src/progress/progress_sender.rs | 2 +- crate/core/src/progress/progress_status.rs | 2 +- crate/core/src/progress/progress_tracker.rs | 2 +- crate/core/src/step_id.rs | 4 +-- crate/data/src/marker/apply_dry.rs | 4 +-- crate/data/src/marker/clean.rs | 4 +-- crate/data/src/marker/current.rs | 4 +-- crate/data/src/marker/goal.rs | 4 +-- crate/flow_model/src/step_info.rs | 2 +- crate/flow_model/src/step_spec_info.rs | 2 +- crate/fmt/src/presenter.rs | 4 +-- crate/params/src/lib.rs | 2 +- crate/params/src/params.rs | 2 +- crate/params/src/params_fieldless.rs | 2 +- crate/params/src/params_spec.rs | 2 +- crate/params/src/params_spec_fieldless.rs | 2 +- crate/params/src/value_spec.rs | 2 +- .../src/impl_field_wise_builder.rs | 2 +- crate/params_derive/src/lib.rs | 4 +-- crate/resources/src/states.rs | 2 +- crate/resources/src/states/states_current.rs | 2 +- .../src/states/states_current_stored.rs | 2 +- crate/resources/src/states/states_goal.rs | 2 +- crate/resources/src/step_rt_id.rs | 2 +- crate/rt_model/src/flow.rs | 2 +- crate/rt_model/src/outcomes/step_apply.rs | 2 +- .../rt_model/src/outcomes/step_apply_boxed.rs | 2 +- .../src/outcomes/step_apply_partial.rs | 2 +- .../src/outcomes/step_apply_partial_boxed.rs | 2 +- crate/rt_model/src/step_graph_builder.rs | 2 +- crate/rt_model/src/step_rt.rs | 2 +- crate/rt_model_core/src/error.rs | 12 ++++---- .../src/error/state_downcast_error.rs | 2 +- crate/rt_model_core/src/error/web_error.rs | 16 +++++------ .../src/state_stored_and_discovered.rs | 2 +- crate/rt_model_web/src/storage.rs | 28 +++++++++---------- doc/src/ideas.md | 12 ++++---- doc/src/technical_concepts.md | 2 +- .../flow_versioning/seamless_execution.md | 6 ++-- .../flow_versioning/upgrade_actions.md | 4 +-- .../output/execution_progress.md | 2 +- doc/src/technical_concepts/state.md | 14 +++++----- .../technical_concepts/state/logical_state.md | 6 ++-- doc/src/technical_concepts/step.md | 2 +- .../step/step_parameters.md | 2 +- .../step_parameters/params_specification.md | 2 +- doc/src/technical_concepts/step_graph.md | 2 +- steps/tar_x/src/tar_x_error.rs | 2 +- 58 files changed, 115 insertions(+), 115 deletions(-) diff --git a/crate/cfg/src/fn_ctx.rs b/crate/cfg/src/fn_ctx.rs index bfc1f958a..31289bd31 100644 --- a/crate/cfg/src/fn_ctx.rs +++ b/crate/cfg/src/fn_ctx.rs @@ -5,7 +5,7 @@ use peace_core::ItemId; #[cfg(feature = "output_progress")] use peace_core::progress::ProgressSender; -/// References to pass information between the Peace framework and a step. +/// References to pass information between the Peace framework and an item. #[derive(Clone, Copy, Debug)] pub struct FnCtx<'exec> { /// ID of the item this belongs to. diff --git a/crate/cfg/src/state.rs b/crate/cfg/src/state.rs index c45975847..839166162 100644 --- a/crate/cfg/src/state.rs +++ b/crate/cfg/src/state.rs @@ -18,11 +18,11 @@ use serde::{Deserialize, Serialize}; /// states. Otherwise, a type that represents the fully logical / fully physical /// state is sufficient. /// -/// In `peace`, [`State`] represents the values of a step, and has the +/// In `peace`, [`State`] represents the values of an item, and has the /// following usages: /// -/// * Showing users the state of a step. -/// * Allowing users to describe the state that a step should be. +/// * Showing users the state of an item. +/// * Allowing users to describe the state that an item should be. /// * Determining what needs to change between the current state and the goal /// state. /// @@ -64,7 +64,7 @@ use serde::{Deserialize, Serialize}; /// /// ### Fully Logical /// -/// If a step's state can be fully described before the item exists, and can be +/// If an item's state can be fully described before the item exists, and can be /// made to happen without interacting with an external service, then the state /// is fully logical. /// @@ -76,7 +76,7 @@ use serde::{Deserialize, Serialize}; /// /// ### Logical and Physical /// -/// If a step's goal state can be described before the item exists, but +/// If an item's goal state can be described before the item exists, but /// interacts with an external service which produces additional information to /// bring that goal state into existence, then the state has both logical and /// physical parts. @@ -89,7 +89,7 @@ use serde::{Deserialize, Serialize}; /// /// ### Fully Physical /// -/// If a step's goal state is simply, "automation has been executed after these +/// If an item's goal state is simply, "automation has been executed after these /// files have been modified", then the state has no logical component. /// /// For example, running a compilation command only if the compilation artifact diff --git a/crate/cfg/src/step.rs b/crate/cfg/src/step.rs index d4d6f03ef..0aaa59a39 100644 --- a/crate/cfg/src/step.rs +++ b/crate/cfg/src/step.rs @@ -10,7 +10,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::FnCtx; -/// Defines all of the data and logic to manage a step. +/// Defines all of the data and logic to manage an item. /// /// The item may be simple or complex, ranging from: /// @@ -158,8 +158,8 @@ pub trait Item: DynClone { /// /// # Design Note /// - /// This is an instance method as logic for a `Step` may be used for - /// multiple tasks. For example, a `Step` implemented to download a + /// This is an instance method as logic for an `Item` may be used for + /// multiple tasks. For example, an `Item` implemented to download a /// file may be instantiated with different files to download, and each /// instance of the `Item` should have its own ID. /// diff --git a/crate/cmd/src/ctx/cmd_ctx_builder.rs b/crate/cmd/src/ctx/cmd_ctx_builder.rs index 84169949d..d675efd64 100644 --- a/crate/cmd/src/ctx/cmd_ctx_builder.rs +++ b/crate/cmd/src/ctx/cmd_ctx_builder.rs @@ -267,7 +267,7 @@ where /// Merges provided item parameters with previously stored item /// parameters. /// -/// If a step's parameters are not provided, and nothing was previously +/// If an item's parameters are not provided, and nothing was previously /// stored, then an error is returned. fn params_specs_merge( flow: &Flow, diff --git a/crate/cmd_model/src/cmd_outcome.rs b/crate/cmd_model/src/cmd_outcome.rs index 2ee34cfc8..643e7353d 100644 --- a/crate/cmd_model/src/cmd_outcome.rs +++ b/crate/cmd_model/src/cmd_outcome.rs @@ -7,7 +7,7 @@ use crate::{CmdBlockDesc, ItemStreamOutcome}; /// Outcome of a [`CmdExecution`]. /// /// The variants indicate whether execution was successful, interrupted, or -/// errored when processing a step. +/// errored when processing an item. /// /// [`CmdExecution`]: https://docs.rs/peace_cmd_rt/latest/peace_cmd_rt/struct.CmdExecution.html #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/crate/cmd_model/src/step_stream_outcome.rs b/crate/cmd_model/src/step_stream_outcome.rs index 9f6afcd7d..86150b96c 100644 --- a/crate/cmd_model/src/step_stream_outcome.rs +++ b/crate/cmd_model/src/step_stream_outcome.rs @@ -17,7 +17,7 @@ pub struct ItemStreamOutcome { } impl ItemStreamOutcome { - /// Returns a `StepStreamOutcome` that is `Finished`. + /// Returns an `ItemStreamOutcome` that is `Finished`. pub fn finished_with(value: T, item_ids_processed: Vec) -> Self { Self { value, diff --git a/crate/cmd_rt/src/cmd_block.rs b/crate/cmd_rt/src/cmd_block.rs index 0f26f53fe..06abda006 100644 --- a/crate/cmd_rt/src/cmd_block.rs +++ b/crate/cmd_rt/src/cmd_block.rs @@ -163,7 +163,7 @@ pub trait CmdBlock: Debug { /// Producer function to process all items. /// /// This is infallible because errors are expected to be returned associated - /// with a step. This may change if there are errors that are related to + /// with an item. This may change if there are errors that are related to /// the block that are not associated with a specific item. /// /// # Implementors diff --git a/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs b/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs index 1bd33d5fd..12fb4483e 100644 --- a/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs +++ b/crate/cmd_rt/src/cmd_block/cmd_block_wrapper.rs @@ -34,7 +34,7 @@ pub struct CmdBlockWrapper ExecutionOutcome, /// Marker. @@ -54,7 +54,7 @@ where /// * `fn_partial_exec_handler`: How the `CmdExecution` should end, if /// execution ends with this `CmdBlock`. /// - /// This could be due to interruption, or a `CmdOutcome` with a step + /// This could be due to interruption, or a `CmdOutcome` with an item /// failure. pub fn new( cmd_block: CB, @@ -146,7 +146,7 @@ where // e.g. `StatesCurrentMut` should be mapped into `StatesEnsured` when some // items fail to be ensured. // - // Note, when discovering current and goal states for diffing, and a step + // Note, when discovering current and goal states for diffing, and an item // error occurs, mapping the partially accumulated `(StatesCurrentMut, // StatesGoalMut)` into `StateDiffs` may or may not be semantically // meaningful. diff --git a/crate/cmd_rt/src/step_stream_outcome_mapper.rs b/crate/cmd_rt/src/step_stream_outcome_mapper.rs index 3e7a55aa4..9c852f3ab 100644 --- a/crate/cmd_rt/src/step_stream_outcome_mapper.rs +++ b/crate/cmd_rt/src/step_stream_outcome_mapper.rs @@ -2,7 +2,7 @@ use fn_graph::StreamOutcome; use peace_cmd_model::ItemStreamOutcome; use peace_rt_model::Flow; -/// Maps a `StreamOutcome` to a `StepStreamOutcome`. +/// Maps a `StreamOutcome` to an `ItemStreamOutcome`. /// /// # Design Note /// diff --git a/crate/code_gen/src/cmd/impl_common_fns.rs b/crate/code_gen/src/cmd/impl_common_fns.rs index aaeceb90b..ad58c50fb 100644 --- a/crate/code_gen/src/cmd/impl_common_fns.rs +++ b/crate/code_gen/src/cmd/impl_common_fns.rs @@ -34,7 +34,7 @@ pub fn impl_common_fns(scope_struct: &ScopeStruct) -> proc_macro2::TokenStream { if scope.flow_count() == FlowCount::One { common_fns.extend(quote! { - /// Sets a step's parameters. + /// Sets an item's parameters. /// /// Note: this **must** be called for each item in the flow. pub fn with_item_params( diff --git a/crate/core/src/progress/progress_sender.rs b/crate/core/src/progress/progress_sender.rs index e2294745a..ba228306b 100644 --- a/crate/core/src/progress/progress_sender.rs +++ b/crate/core/src/progress/progress_sender.rs @@ -7,7 +7,7 @@ use crate::{ ItemId, }; -/// Submits progress for a step's `ApplyFns::exec` method. +/// Submits progress for an item's `ApplyFns::exec` method. #[derive(Clone, Copy, Debug)] pub struct ProgressSender<'exec> { /// ID of the item this belongs to. diff --git a/crate/core/src/progress/progress_status.rs b/crate/core/src/progress/progress_status.rs index 212bcef47..4ce1e8b77 100644 --- a/crate/core/src/progress/progress_status.rs +++ b/crate/core/src/progress/progress_status.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::progress::ProgressComplete; -/// Status of a step's execution progress. +/// Status of an item's execution progress. /// /// # Implementation Notes /// diff --git a/crate/core/src/progress/progress_tracker.rs b/crate/core/src/progress/progress_tracker.rs index a213d299e..409324d3c 100644 --- a/crate/core/src/progress/progress_tracker.rs +++ b/crate/core/src/progress/progress_tracker.rs @@ -5,7 +5,7 @@ use indicatif::ProgressBar; use crate::progress::{ProgressLimit, ProgressStatus}; -/// Tracks progress for a step's `ApplyFns::exec` method. +/// Tracks progress for an item's `ApplyFns::exec` method. #[derive(Debug)] pub struct ProgressTracker { /// Status of the item's execution progress. diff --git a/crate/core/src/step_id.rs b/crate/core/src/step_id.rs index ac82feb2b..5d7ed01f2 100644 --- a/crate/core/src/step_id.rs +++ b/crate/core/src/step_id.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use serde::{Deserialize, Serialize}; -/// Unique identifier for a [`Step`], `Cow<'static, str>` newtype. +/// Unique identifier for an [`Item`], `Cow<'static, str>` newtype. /// /// Must begin with a letter or underscore, and contain only letters, numbers, /// and underscores. @@ -28,7 +28,7 @@ use serde::{Deserialize, Serialize}; /// there needs to be a way to: /// /// * Read state using the old ID. -/// * Either clean up that state, or migrate that state into a Step with the +/// * Either clean up that state, or migrate that state into an Item with the /// new ID. /// /// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html diff --git a/crate/data/src/marker/apply_dry.rs b/crate/data/src/marker/apply_dry.rs index 5e3d1d1dc..484f895c1 100644 --- a/crate/data/src/marker/apply_dry.rs +++ b/crate/data/src/marker/apply_dry.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; /// Marker for apply-dry state. /// -/// This is used for referential param values, where a step param value is +/// This is used for referential param values, where an item param value is /// dependent on the state of a predecessor's state. /// -/// An `ApplyDry` is set to `Some` whenever a step is dry applied, +/// An `ApplyDry` is set to `Some` whenever an item is dry applied, /// enabling a subsequent successor's params to access that value when the /// successor's `apply_dry` function is run. /// diff --git a/crate/data/src/marker/clean.rs b/crate/data/src/marker/clean.rs index bf8c4defb..96e37f085 100644 --- a/crate/data/src/marker/clean.rs +++ b/crate/data/src/marker/clean.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; /// Marker for clean state. /// -/// This is used for referential param values, where a step param value is +/// This is used for referential param values, where an item param value is /// dependent on the state of a predecessor's state. /// -/// A `Clean` is set to `Some` whenever a step's clean state is +/// A `Clean` is set to `Some` whenever an item's clean state is /// needed, e.g. preparing for applying the clean state. enabling a subsequent /// successor's params to access that value when the successor's `state_clean` /// function is run. diff --git a/crate/data/src/marker/current.rs b/crate/data/src/marker/current.rs index 707df55fb..a10b8e3fb 100644 --- a/crate/data/src/marker/current.rs +++ b/crate/data/src/marker/current.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; /// Marker for current state. /// -/// This is used for referential param values, where a step param value is +/// This is used for referential param values, where an item param value is /// dependent on the state of a predecessor's state. /// -/// A `Current` is set to `Some` whenever a step's current state +/// A `Current` is set to `Some` whenever an item's current state /// is discovered. enabling a subsequent successor's params to access that value /// when the successor's **goal** state function is run. /// diff --git a/crate/data/src/marker/goal.rs b/crate/data/src/marker/goal.rs index 6ba975021..3a3872afe 100644 --- a/crate/data/src/marker/goal.rs +++ b/crate/data/src/marker/goal.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; /// Marker for goal state. /// -/// This is used for referential param values, where a step param value is +/// This is used for referential param values, where an item param value is /// dependent on the state of a predecessor's state. /// -/// A `Goal` is set to `Some` whenever a step's goal state +/// A `Goal` is set to `Some` whenever an item's goal state /// is discovered. enabling a subsequent successor's params to access that value /// when the successor's goal state function is run. /// diff --git a/crate/flow_model/src/step_info.rs b/crate/flow_model/src/step_info.rs index c58ffe246..29882e5dc 100644 --- a/crate/flow_model/src/step_info.rs +++ b/crate/flow_model/src/step_info.rs @@ -1,7 +1,7 @@ use peace_core::ItemId; use serde::{Deserialize, Serialize}; -/// Serializable representation of values used for / produced by a [`Step`]. +/// Serializable representation of values used for / produced by an [`Item`]. /// /// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] diff --git a/crate/flow_model/src/step_spec_info.rs b/crate/flow_model/src/step_spec_info.rs index 21cf029df..e5ff66e1a 100644 --- a/crate/flow_model/src/step_spec_info.rs +++ b/crate/flow_model/src/step_spec_info.rs @@ -1,7 +1,7 @@ use peace_core::ItemId; use serde::{Deserialize, Serialize}; -/// Serializable representation of how a [`Step`] is configured. +/// Serializable representation of how an [`Item`] is configured. /// /// [`Item`]: https://docs.rs/peace_cfg/latest/peace_cfg/trait.Item.html #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] diff --git a/crate/fmt/src/presenter.rs b/crate/fmt/src/presenter.rs index 1b761ba1d..131658bf3 100644 --- a/crate/fmt/src/presenter.rs +++ b/crate/fmt/src/presenter.rs @@ -50,14 +50,14 @@ pub trait Presenter<'output> { /// Error returned during a presentation failure. type Error: std::error::Error; - /// Presents text as a step id. + /// Presents text as an item id. /// /// # Purposes /// /// * An ID with no spaces, e.g. "my_item" async fn id(&mut self, id: &str) -> Result<(), Self::Error>; - /// Presents text as a step name. + /// Presents text as an item name. /// /// # Purposes /// diff --git a/crate/params/src/lib.rs b/crate/params/src/lib.rs index fce5e15d7..6b5873ee0 100644 --- a/crate/params/src/lib.rs +++ b/crate/params/src/lib.rs @@ -8,7 +8,7 @@ //! //! # Design //! -//! When a step is defined, implementors define the parameters type for +//! When an item is defined, implementors define the parameters type for //! that item. //! //! For Peace to derive additional functionality from that type, this crate: diff --git a/crate/params/src/params.rs b/crate/params/src/params.rs index eee553ae0..c00c8451a 100644 --- a/crate/params/src/params.rs +++ b/crate/params/src/params.rs @@ -4,7 +4,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::FieldWiseSpecRt; -/// Input parameters to a step. +/// Input parameters to an item. /// /// This trait is automatically implemented by `#[derive(Value)]`. pub trait Params: Clone + Debug + Serialize + DeserializeOwned + Send + Sync + 'static { diff --git a/crate/params/src/params_fieldless.rs b/crate/params/src/params_fieldless.rs index acbf26185..ae7b747cf 100644 --- a/crate/params/src/params_fieldless.rs +++ b/crate/params/src/params_fieldless.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use serde::{de::DeserializeOwned, Serialize}; -/// Field of a `Step::Params`. +/// Field of an `Item::Params`. /// /// This trait is automatically implemented by `#[derive(Value)]`. /// diff --git a/crate/params/src/params_spec.rs b/crate/params/src/params_spec.rs index d5daa5ef3..f8a9fdcd8 100644 --- a/crate/params/src/params_spec.rs +++ b/crate/params/src/params_spec.rs @@ -8,7 +8,7 @@ use crate::{ ParamsResolveError, ValueResolutionCtx, ValueSpecRt, }; -/// How to populate a field's value in a step's params. +/// How to populate a field's value in an item's params. /// /// The `MappingFn` variant's mapping function is `None` when deserialized, as /// it is impossible to determine the underlying `F` and `U` type parameters for diff --git a/crate/params/src/params_spec_fieldless.rs b/crate/params/src/params_spec_fieldless.rs index 7cde56617..f71a8b944 100644 --- a/crate/params/src/params_spec_fieldless.rs +++ b/crate/params/src/params_spec_fieldless.rs @@ -8,7 +8,7 @@ use crate::{ ValueResolutionCtx, ValueSpecRt, }; -/// How to populate a field's value in a step's params. +/// How to populate a field's value in an item's params. /// /// The `MappingFn` variant's mapping function is `None` when deserialized, as /// it is impossible to determine the underlying `F` and `U` type parameters for diff --git a/crate/params/src/value_spec.rs b/crate/params/src/value_spec.rs index 21e1f543e..86b042248 100644 --- a/crate/params/src/value_spec.rs +++ b/crate/params/src/value_spec.rs @@ -8,7 +8,7 @@ use crate::{ ValueSpecRt, }; -/// How to populate a field's value in a step's params. +/// How to populate a field's value in an item's params. /// /// The `MappingFn` variant's mapping function is `None` when deserialized, as /// it is impossible to determine the underlying `F` and `U` type parameters for diff --git a/crate/params_derive/src/impl_field_wise_builder.rs b/crate/params_derive/src/impl_field_wise_builder.rs index a0d10d638..52b7c1fcb 100644 --- a/crate/params_derive/src/impl_field_wise_builder.rs +++ b/crate/params_derive/src/impl_field_wise_builder.rs @@ -41,7 +41,7 @@ pub fn impl_field_wise_builder( |fields| fields_to_optional_value_spec(fields, peace_params_path), &[parse_quote! { #[doc="\ - Builder for specification of how to look up the values for a step's \n\ + Builder for specification of how to look up the values for an item's \n\ parameters.\ "] }], diff --git a/crate/params_derive/src/lib.rs b/crate/params_derive/src/lib.rs index bc827eafc..1d92ac01a 100644 --- a/crate/params_derive/src/lib.rs +++ b/crate/params_derive/src/lib.rs @@ -452,7 +452,7 @@ fn t_field_wise( |fields| fields_to_value_spec(fields, peace_params_path), &[ parse_quote! { - #[doc="Specification of how to look up values for a step's parameters."] + #[doc="Specification of how to look up values for an item's parameters."] }, // `Clone` and `Debug` are implemented manually, so that type parameters do not receive // the `Clone` and `Debug` bounds. @@ -522,7 +522,7 @@ fn t_field_wise_external( t_field_wise_name, &[ parse_quote! { - #[doc="Specification of how to look up values for a step's parameters."] + #[doc="Specification of how to look up values for an item's parameters."] }, parse_quote!(#[derive(serde::Serialize, serde::Deserialize)]), ], diff --git a/crate/resources/src/states.rs b/crate/resources/src/states.rs index 8a5f30f88..6a352dc8e 100644 --- a/crate/resources/src/states.rs +++ b/crate/resources/src/states.rs @@ -57,7 +57,7 @@ mod states_serde; /// outer layer for whether the item had an entry, and the inner layer for /// whether there was any `State` recorded. /// -/// 4. If we can guarantee the item ID is valid -- an ID of a step in the flow +/// 4. If we can guarantee the item ID is valid -- an ID of an item in the flow /// -- we could remove that outer `Option` layer. Currently we cannot make /// this guarantee, as: /// diff --git a/crate/resources/src/states/states_current.rs b/crate/resources/src/states/states_current.rs index 13281fa5f..57788c3ad 100644 --- a/crate/resources/src/states/states_current.rs +++ b/crate/resources/src/states/states_current.rs @@ -14,7 +14,7 @@ use crate::states::{ /// /// # Implementors /// -/// If a `Step`'s state discovery depends on the `State` of a previous +/// If an `Item`'s state discovery depends on the `State` of a previous /// `Item`, then you should insert the predecessor's state into /// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]: /// diff --git a/crate/resources/src/states/states_current_stored.rs b/crate/resources/src/states/states_current_stored.rs index 9ee60eff4..5b3b8f5a8 100644 --- a/crate/resources/src/states/states_current_stored.rs +++ b/crate/resources/src/states/states_current_stored.rs @@ -19,7 +19,7 @@ use crate::states::{ /// /// # Implementors /// -/// If a `Step`'s state discovery depends on the `State` of a previous +/// If an `Item`'s state discovery depends on the `State` of a previous /// `Item`, then you should insert the predecessor's state into /// [`Resources`], and reference that in the subsequent `TryFnSpec`'s [`Data`]: /// diff --git a/crate/resources/src/states/states_goal.rs b/crate/resources/src/states/states_goal.rs index 16e3698b9..e5f0ef8f3 100644 --- a/crate/resources/src/states/states_goal.rs +++ b/crate/resources/src/states/states_goal.rs @@ -12,7 +12,7 @@ use crate::states::{ /// /// # Implementors /// -/// If a `Step`'s goal state discovery depends on the goal `State` of +/// If an `Item`'s goal state discovery depends on the goal `State` of /// a previous `Item`, then you should insert the predecessor's goal /// state into [`Resources`], and reference that in the subsequent /// `TryFnSpec`'s [`Data`]: diff --git a/crate/resources/src/step_rt_id.rs b/crate/resources/src/step_rt_id.rs index 332a5dccf..c57a6d832 100644 --- a/crate/resources/src/step_rt_id.rs +++ b/crate/resources/src/step_rt_id.rs @@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut}; use peace_data::fn_graph::FnId; -/// Runtime identifier for a [`Step`]. [`FnId`] newtype. +/// Runtime identifier for an [`Item`]. [`FnId`] newtype. /// /// This is a cheap identifier to copy around, instead of cloning /// [`ItemId`]. diff --git a/crate/rt_model/src/flow.rs b/crate/rt_model/src/flow.rs index 993112a7e..9a804b64c 100644 --- a/crate/rt_model/src/flow.rs +++ b/crate/rt_model/src/flow.rs @@ -6,7 +6,7 @@ use crate::ItemGraph; /// A flow to manage items. /// -/// A Flow ID is strictly associated with a [`StepGraph`], as the graph +/// A Flow ID is strictly associated with an [`ItemGraph`], as the graph /// contains the definitions to read and write the items' [`State`]s. /// /// [`State`]: peace_cfg::Item::State diff --git a/crate/rt_model/src/outcomes/step_apply.rs b/crate/rt_model/src/outcomes/step_apply.rs index e2c7d9d67..47b117702 100644 --- a/crate/rt_model/src/outcomes/step_apply.rs +++ b/crate/rt_model/src/outcomes/step_apply.rs @@ -6,7 +6,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use crate::outcomes::{ItemApplyPartial, ItemApplyRt}; -/// Information about a step during an `ApplyCmd` execution. +/// Information about an item during an `ApplyCmd` execution. /// /// This is similar to [`ItemApplyPartial`], with most fields being /// non-optional, and the added `state_applied` field. diff --git a/crate/rt_model/src/outcomes/step_apply_boxed.rs b/crate/rt_model/src/outcomes/step_apply_boxed.rs index bad5ca247..b8bacc942 100644 --- a/crate/rt_model/src/outcomes/step_apply_boxed.rs +++ b/crate/rt_model/src/outcomes/step_apply_boxed.rs @@ -8,7 +8,7 @@ impl From> for ItemApplyBoxed where ItemApply: ItemApplyRt, { - /// Returns a `StepApplyBoxed` which erases a `StepApply`'s type + /// Returns an `ItemApplyBoxed` which erases an `ItemApply`'s type /// parameters. fn from(item_apply: ItemApply) -> Self { Self(Box::new(item_apply)) diff --git a/crate/rt_model/src/outcomes/step_apply_partial.rs b/crate/rt_model/src/outcomes/step_apply_partial.rs index a16bbb6e1..8747a5100 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial.rs @@ -6,7 +6,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use crate::outcomes::ItemApplyPartialRt; -/// Information about a step during an `ApplyCmd` execution. +/// Information about an item during an `ApplyCmd` execution. /// /// # Design Note /// diff --git a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs index 72e17a971..f2f35d588 100644 --- a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs +++ b/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs @@ -8,7 +8,7 @@ impl From> for ItemApplyPar where ItemApplyPartial: ItemApplyPartialRt, { - /// Returns a `StepApplyPartialBoxed` which erases an + /// Returns an `ItemApplyPartialBoxed` which erases an /// `ItemApplyPartial`'s type parameters. fn from(item_apply: ItemApplyPartial) -> Self { Self(Box::new(item_apply)) diff --git a/crate/rt_model/src/step_graph_builder.rs b/crate/rt_model/src/step_graph_builder.rs index 74ef36487..c579d86ae 100644 --- a/crate/rt_model/src/step_graph_builder.rs +++ b/crate/rt_model/src/step_graph_builder.rs @@ -4,7 +4,7 @@ use peace_data::fn_graph::FnGraphBuilder; use crate::{ItemBoxed, ItemGraph}; -/// Builder for a [`StepGraph`], `FnGraphBuilder>` +/// Builder for an [`ItemGraph`], `FnGraphBuilder>` /// newtype. #[derive(Debug)] pub struct ItemGraphBuilder(FnGraphBuilder>); diff --git a/crate/rt_model/src/step_rt.rs b/crate/rt_model/src/step_rt.rs index 54c11b809..561fe5532 100644 --- a/crate/rt_model/src/step_rt.rs +++ b/crate/rt_model/src/step_rt.rs @@ -70,7 +70,7 @@ pub trait ItemRt: /// whether we should use a string newtype for `ItemId`s, or redesign /// how `Item`s or related types are keyed. /// - /// Note: it is impossible to call this method if a `Step`'s state type has + /// Note: it is impossible to call this method if an `Item`'s state type has /// changed -- it would have failed on deserialization. fn state_eq(&self, state_a: &BoxDtDisplay, state_b: &BoxDtDisplay) -> Result where diff --git a/crate/rt_model_core/src/error.rs b/crate/rt_model_core/src/error.rs index e78c7c974..77173bdda 100644 --- a/crate/rt_model_core/src/error.rs +++ b/crate/rt_model_core/src/error.rs @@ -109,13 +109,13 @@ pub enum Error { /// /// # Symptoms /// - /// * Provided params specs for a step ID has no corresponding item ID in + /// * Provided params specs for an item ID has no corresponding item ID in /// the flow. - /// * Stored params specs for a step ID has no corresponding item ID in the + /// * Stored params specs for an item ID has no corresponding item ID in the /// flow. - /// * ID of a step in the flow does not have a corresponding provided + /// * ID of an item in the flow does not have a corresponding provided /// params spec. - /// * ID of a step in the flow does not have a corresponding stored params + /// * ID of an item in the flow does not have a corresponding stored params /// spec. /// /// # Causes @@ -502,8 +502,8 @@ pub enum Error { path: PathBuf, }, - /// Error downcasting a `BoxDtDisplay` into a step's concrete state type. - #[error("Error downcasting a `BoxDtDisplay` into a step's concrete state type.")] + /// Error downcasting a `BoxDtDisplay` into an item's concrete state type. + #[error("Error downcasting a `BoxDtDisplay` into an item's concrete state type.")] StateDowncastError( #[cfg_attr(feature = "error_reporting", diagnostic_source)] #[source] diff --git a/crate/rt_model_core/src/error/state_downcast_error.rs b/crate/rt_model_core/src/error/state_downcast_error.rs index fa859e7ab..2c8d58cd0 100644 --- a/crate/rt_model_core/src/error/state_downcast_error.rs +++ b/crate/rt_model_core/src/error/state_downcast_error.rs @@ -1,6 +1,6 @@ use type_reg::untagged::{BoxDtDisplay, DataType}; -/// Error downcasting a `BoxDtDisplay` into a step's concrete state type. +/// Error downcasting a `BoxDtDisplay` into an item's concrete state type. #[cfg_attr(feature = "error_reporting", derive(miette::Diagnostic))] #[derive(Debug, thiserror::Error)] pub enum StateDowncastError { diff --git a/crate/rt_model_core/src/error/web_error.rs b/crate/rt_model_core/src/error/web_error.rs index bb579305f..e20a01415 100644 --- a/crate/rt_model_core/src/error/web_error.rs +++ b/crate/rt_model_core/src/error/web_error.rs @@ -54,9 +54,9 @@ pub enum WebError { )] SessionStorageNone, - /// Failed to base64 decode a step from browser storage. + /// Failed to base64 decode an item from browser storage. #[error( - "Failed to base64 decode a step in browser storage: `{path}`. Value: `{value}` Error: `{error}`" + "Failed to base64 decode an item in browser storage: `{path}`. Value: `{value}` Error: `{error}`" )] #[cfg_attr( feature = "error_reporting", @@ -71,7 +71,7 @@ pub enum WebError { error: base64::DecodeError, }, - /// Failed to get a step from browser storage. + /// Failed to get an item from browser storage. /// /// This failure mode happens when the `get_item` call to the browser fails. /// @@ -85,7 +85,7 @@ pub enum WebError { /// /// This is because browsers are generally single threaded. The assumption /// would no longer be true if multiple threads are used, e.g. web workers. - #[error("Failed to get a step in browser storage: `{path}`. Error: `{error}`")] + #[error("Failed to get an item in browser storage: `{path}`. Error: `{error}`")] #[cfg_attr( feature = "error_reporting", diagnostic(code(peace_rt_model_web::storage_get_item)) @@ -96,7 +96,7 @@ pub enum WebError { /// Stringified JS error. error: String, }, - /// Failed to set a step in browser storage. + /// Failed to set an item in browser storage. /// /// Note: The original `JsValue` error is converted to a `String` to allow /// this type to be `Send`. @@ -108,7 +108,7 @@ pub enum WebError { /// /// This is because browsers are generally single threaded. The assumption /// would no longer be true if multiple threads are used, e.g. web workers. - #[error("Failed to set a step in browser storage: `{path}`: `{value}`. Error: `{error}`")] + #[error("Failed to set an item in browser storage: `{path}`: `{value}`. Error: `{error}`")] #[cfg_attr( feature = "error_reporting", diagnostic(code(peace_rt_model_web::storage_set_item)) @@ -121,13 +121,13 @@ pub enum WebError { /// Stringified JS error. error: String, }, - /// Failed to remove a step from browser storage. + /// Failed to remove an item from browser storage. /// /// This failure mode happens when the `get_item` call to the browser fails. /// /// Note: The original `JsValue` error is converted to a `String` to allow /// this type to be `Send`. - #[error("Failed to remove a step from browser storage: `{path}`. Error: `{error}`")] + #[error("Failed to remove an item from browser storage: `{path}`. Error: `{error}`")] #[cfg_attr( feature = "error_reporting", diagnostic(code(peace_rt_model_web::storage_remove_item)) diff --git a/crate/rt_model_core/src/state_stored_and_discovered.rs b/crate/rt_model_core/src/state_stored_and_discovered.rs index af92fdfa5..d2b539ff0 100644 --- a/crate/rt_model_core/src/state_stored_and_discovered.rs +++ b/crate/rt_model_core/src/state_stored_and_discovered.rs @@ -1,6 +1,6 @@ use type_reg::untagged::BoxDtDisplay; -/// Stored and/or discovered state for a step. +/// Stored and/or discovered state for an item. #[derive(Clone, Debug)] pub enum StateStoredAndDiscovered { /// Stored state exists, but the actual item state cannot be discovered. diff --git a/crate/rt_model_web/src/storage.rs b/crate/rt_model_web/src/storage.rs index 3b3af2f44..cba2efa95 100644 --- a/crate/rt_model_web/src/storage.rs +++ b/crate/rt_model_web/src/storage.rs @@ -74,18 +74,18 @@ impl Storage { Ok(storage) } - /// Returns whether a step exists in the web storage. + /// Returns whether an item exists in the web storage. pub fn contains_item(&self, path: &Path) -> Result { self.get_item_opt(path).map(|item| item.is_some()) } /// Gets an optional item in the web storage. /// - /// * Use [`get_item_opt`] if you would like to fetch a step that may not + /// * Use [`get_item_opt`] if you would like to fetch an item that may not /// exist. /// * Use [`get_items_opt`] if you would like to fetch multiple optional /// items. - /// * Use [`get_item`] if you would like to fetch a step that must exist. + /// * Use [`get_item`] if you would like to fetch an item that must exist. /// * Use [`get_items`] if you would like to fetch multiple items that must /// exist. /// @@ -103,11 +103,11 @@ impl Storage { /// Gets multiple items in the web storage. /// - /// * Use [`get_item_opt`] if you would like to fetch a step that may not + /// * Use [`get_item_opt`] if you would like to fetch an item that may not /// exist. /// * Use [`get_items_opt`] if you would like to fetch multiple optional /// items. - /// * Use [`get_item`] if you would like to fetch a step that must exist. + /// * Use [`get_item`] if you would like to fetch an item that must exist. /// * Use [`get_items`] if you would like to fetch multiple items that must /// exist. /// @@ -137,13 +137,13 @@ impl Storage { Ok(iter) } - /// Gets a step in the web storage. + /// Gets an item in the web storage. /// - /// * Use [`get_item_opt`] if you would like to fetch a step that may not + /// * Use [`get_item_opt`] if you would like to fetch an item that may not /// exist. /// * Use [`get_items_opt`] if you would like to fetch multiple optional /// items. - /// * Use [`get_item`] if you would like to fetch a step that must exist. + /// * Use [`get_item`] if you would like to fetch an item that must exist. /// * Use [`get_items`] if you would like to fetch multiple items that must /// exist. /// @@ -168,7 +168,7 @@ impl Storage { /// Gets a base64 encoded item in the web storage. /// - /// * Use [`get_item_b64_opt`] if you would like to fetch a step that may + /// * Use [`get_item_b64_opt`] if you would like to fetch an item that may /// not exist. /// /// [`get_items`]: Self::get_items @@ -192,7 +192,7 @@ impl Storage { /// Gets a base64 encoded item in the web storage. /// - /// * Use [`get_item_b64_opt`] if you would like to fetch a step that may + /// * Use [`get_item_b64_opt`] if you would like to fetch an item that may /// not exist. /// /// [`get_items`]: Self::get_items @@ -212,11 +212,11 @@ impl Storage { /// Gets multiple items in the web storage. /// - /// * Use [`get_item_opt`] if you would like to fetch a step that may not + /// * Use [`get_item_opt`] if you would like to fetch an item that may not /// exist. /// * Use [`get_items_opt`] if you would like to fetch multiple optional /// items. - /// * Use [`get_item`] if you would like to fetch a step that must exist. + /// * Use [`get_item`] if you would like to fetch an item that must exist. /// * Use [`get_items`] if you would like to fetch multiple items that must /// exist. /// @@ -251,7 +251,7 @@ impl Storage { Ok(iter) } - /// Sets a step in the web storage. + /// Sets an item in the web storage. /// /// See [`set_items`] if you would like to set multiple items. /// @@ -417,7 +417,7 @@ impl Storage { Ok(()) } - /// Deletes a step from the web storage. + /// Deletes an item from the web storage. pub fn remove_item(&self, path: &Path) -> Result<(), Error> { let storage = self.get()?; let key = path.to_string_lossy(); diff --git a/doc/src/ideas.md b/doc/src/ideas.md index 5c063b861..6bed333c0 100644 --- a/doc/src/ideas.md +++ b/doc/src/ideas.md @@ -81,7 +81,7 @@ This may be dependent on profile params – sort env based on env type, last 7. Cancel-safe state storage
-When a step ensure does multiple writes, there is a possibility of not all of those writes occur during execution: +When an item ensure does multiple writes, there is a possibility of not all of those writes occur during execution: * user interrupts the execution. * internet connection drops. @@ -104,9 +104,9 @@ Implementors may add/remove/modify items in flows. Peace needs to be designed such that these changes do not cause already-existent flows to not be loadable, i.e. when: -* `states_*.yaml` contains state for which a step no longer exists in the flow. -* `states_*.yaml` does not contain state for a step that is newly added to the flow. -* `states_*.yaml` contains state whose fields are different to a new version of a step. +* `states_*.yaml` contains state for which an item no longer exists in the flow. +* `states_*.yaml` does not contain state for an item that is newly added to the flow. +* `states_*.yaml` contains state whose fields are different to a new version of an item. This one can be addressed by having `State` be an enum, with versioned variants. @@ -283,7 +283,7 @@ Should we combine all 3 into `FnCtx`? It would make `FnCtx` type parameterized o 17. Style edges / items red when an error occurs.
-When we hit an error, can we go through parameters / states to determine whether the error is to do with a step itself, or a link between the item and its predecessor? +When we hit an error, can we go through parameters / states to determine whether the error is to do with an item itself, or a link between the item and its predecessor? Then style that link red. @@ -337,7 +337,7 @@ This trades 3. AWS SDK does not always include error detail -- S3 `head_object`. ([aws-sdk-rust#227]) 4. Progress output should enable-able for state current / goal discover / clean functions. 5. Flow params are annoying to register every time we add another item. Maybe split end user provided params from item params. -6. Blank item needs a lot of rework to be easier to implement a step. ([67], [#96]) +6. Blank item needs a lot of rework to be easier to implement an item. ([67], [#96]) 7. For `ApplyCmd`, collect `StateCurrent`, `StateGoal`, `StateDiff` in execution report. 8. AWS errors' `code` and `message` should be shown to the user. 9. Progress limit should not be returned in `ApplyFns::check`, but sent through `progress_sender.limit(ProgressLimit)`. This simplifies `check`, and allows state current/goal discovery to set the limits easily. diff --git a/doc/src/technical_concepts.md b/doc/src/technical_concepts.md index 02bdc1066..2a2cde228 100644 --- a/doc/src/technical_concepts.md +++ b/doc/src/technical_concepts.md @@ -5,7 +5,7 @@ The following sections cover essential concepts to develop automation using the 1. **[Resources]**: An any-map, whose values' read and write access are checked at runtime instead of compile time. 2. **[Function graph]**: Functions with logical and data-access-dependent concurrency. 3. **[Item]**: Specification that defines information and logic to manage an *arbitrary item*. -4. **[Item graph]**: Like a function graph, where each node is not just a function, but a step. +4. **[Item graph]**: Like a function graph, where each node is not just a function, but an item. [Function graph]: technical_concepts/function_graph.html [Item graph]: technical_concepts/item_graph.html diff --git a/doc/src/technical_concepts/flow_versioning/seamless_execution.md b/doc/src/technical_concepts/flow_versioning/seamless_execution.md index c51c6a0a0..3066364d4 100644 --- a/doc/src/technical_concepts/flow_versioning/seamless_execution.md +++ b/doc/src/technical_concepts/flow_versioning/seamless_execution.md @@ -90,14 +90,14 @@ An item upgrade may be one of: Notes: -* It may not be possible to migrate a step to a newer version without cleaning up its successors. +* It may not be possible to migrate an item to a newer version without cleaning up its successors. * It is possible if successors don't "live inside" the item, but only need their parameters changed. * it is not possible if successors live inside the item, and need to be deleted in order to modify the item. -Whether or not a successor needs to be cleaned up likely should be encoded into the `Edge` type, not part of the item upgrade parameters -- a step is unable to know if its successors live inside it or point to it. +Whether or not a successor needs to be cleaned up likely should be encoded into the `Edge` type, not part of the item upgrade parameters -- an item is unable to know if its successors live inside it or point to it. ```rust ,ignore -/// Indicates what is needed for an instance of a step to be upgraded. +/// Indicates what is needed for an instance of an item to be upgraded. enum ItemUpgradeReq { /// Item instance does not need to be upgraded, i.e. only state data type is changed. None, diff --git a/doc/src/technical_concepts/flow_versioning/upgrade_actions.md b/doc/src/technical_concepts/flow_versioning/upgrade_actions.md index 5c8858a0f..ef7224f59 100644 --- a/doc/src/technical_concepts/flow_versioning/upgrade_actions.md +++ b/doc/src/technical_concepts/flow_versioning/upgrade_actions.md @@ -12,12 +12,12 @@ The following table shows what is required for ensuring an environment to be in > Notes: > -> * "Data" refers to a step's `Params`, `State`, or `StateDiff`. +> * "Data" refers to an item's `Params`, `State`, or `StateDiff`. > * Apply is associated with params, state, and diff. > > `apply_clean` needs to know `state_clean` based on the parameters used to compute `state_goal` at the time of the previous `apply_goal`. > -> * "Predecessor *action*" means what upgrade action is needed for *this* item, given a predecessor has had *action* applied to it. In other words, the change for a step can imply an upgrade action for successors. +> * "Predecessor *action*" means what upgrade action is needed for *this* item, given a predecessor has had *action* applied to it. In other words, the change for an item can imply an upgrade action for successors. | Change | Upgrade action | |:------------------------------------------|:---------------------------------| diff --git a/doc/src/technical_concepts/output/execution_progress.md b/doc/src/technical_concepts/output/execution_progress.md index 55bae2c4c..f1c545d4d 100644 --- a/doc/src/technical_concepts/output/execution_progress.md +++ b/doc/src/technical_concepts/output/execution_progress.md @@ -3,7 +3,7 @@ Execution progress output is most useful as it happens. Execution progress output should fulfill the following concerns: * easy for a human to understand -* easy to be sent from a step implementation +* easy to be sent from an item implementation * pushed to output in real time * pulled from client in real time diff --git a/doc/src/technical_concepts/state.md b/doc/src/technical_concepts/state.md index 1ae5d64e8..280f515fb 100644 --- a/doc/src/technical_concepts/state.md +++ b/doc/src/technical_concepts/state.md @@ -1,9 +1,9 @@ # State -In `peace`, [`State`] represents the values of a step, and has the following usages: +In `peace`, [`State`] represents the values of an item, and has the following usages: -* Showing users the state of a step. -* Allowing users to describe the state that a step should be. +* Showing users the state of an item. +* Allowing users to describe the state that an item should be. * Determining what needs to change between the current state and the goal state. Therefore, `State` should be: @@ -41,27 +41,27 @@ State can be separated into two parts: ### Fully Logical -If a step's state can be fully described before the item exists, and can be made to happen without interacting with an external service, then the state is fully logical. +If an item's state can be fully described before the item exists, and can be made to happen without interacting with an external service, then the state is fully logical. For example, copying a file from one directory to another. The state of the file in the source directory and destination directories are fully discoverable, and there is no information generated during automation that is needed to determine if the states are equivalent. ### Logical and Physical -If a step's goal state can be described before the item exists, but interacts with an external service which produces additional information to bring that goal state into existence, then the state has both logical and physical parts. +If an item's goal state can be described before the item exists, but interacts with an external service which produces additional information to bring that goal state into existence, then the state has both logical and physical parts. For example, launching a server or virtual machine. The operating system, CPU capacity, and RAM are logical information, and can be determined ahead of time. However, the server ID and IP address are produced by the virtual machine service provider, which is physical state. ### Fully Physical -If a step's goal state is simply, "automation has been executed after these files have been modified", then the state has no logical component. +If an item's goal state is simply, "automation has been executed after these files have been modified", then the state has no logical component. For example, running a compilation command only if the compilation artifact doesn't exist, or the source files have changed since the last time the compilation has been executed. --- -The remaining pages in this section explain how to define the logical and physical state types when implementing a step. +The remaining pages in this section explain how to define the logical and physical state types when implementing an item. [`State`]: https://docs.rs/peace_cfg/latest/peace_cfg/state/struct.State.html diff --git a/doc/src/technical_concepts/state/logical_state.md b/doc/src/technical_concepts/state/logical_state.md index 07c6c29bd..404dc41a0 100644 --- a/doc/src/technical_concepts/state/logical_state.md +++ b/doc/src/technical_concepts/state/logical_state.md @@ -1,6 +1,6 @@ # Logical State -Logical state is the part of a step that is: +Logical state is the part of an item that is: * Implementor / user definable * Controllable by automation @@ -33,7 +33,7 @@ let state_diff = state_goal - state_current; ## Discovery Constraints -In a step's parameters, there must be the following categories of information: +In an item's parameters, there must be the following categories of information: * `src`: information of what the item should be, or where to look up that information. @@ -61,7 +61,7 @@ Both `src` and `dest` may reference resources that are ensured by predecessor it 1. `Item::state_goal` functions have to always cater for `src` not being available. - It incurs mental effort to always cater for `src` not being available – i.e. implementing a step would need knowledge beyond itself. + It incurs mental effort to always cater for `src` not being available – i.e. implementing an item would need knowledge beyond itself. 2. the `peace` framework defaults to not running `state_current_fn` for items that have a logical dependency on things that `Item::apply_check` returns `ExecRequired` diff --git a/doc/src/technical_concepts/step.md b/doc/src/technical_concepts/step.md index f503feec7..7f7e50c12 100644 --- a/doc/src/technical_concepts/step.md +++ b/doc/src/technical_concepts/step.md @@ -167,7 +167,7 @@ Cleans up the item from existence. Readers may notice the function breakdown is `git`-like. The following table compares the concepts: -| Concept | Peace | Git | +| Subject | Peace | Git | |:-----------------------|:-------------------------------------------------------|:-----------------------------------------------------------------------------------------| | Item | Any consumer defined item. | A directory of files. | | Project initialization | `init` command takes in parameters to manage the item. | Uses the current directory or passed in directory. | diff --git a/doc/src/technical_concepts/step/step_parameters.md b/doc/src/technical_concepts/step/step_parameters.md index d7a54f061..ec6941069 100644 --- a/doc/src/technical_concepts/step/step_parameters.md +++ b/doc/src/technical_concepts/step/step_parameters.md @@ -1,6 +1,6 @@ # Item Parameters -For a step to work with different values, the values must be passed in. These values are called item parameters. +For an item to work with different values, the values must be passed in. These values are called item parameters. ```dot process digraph { diff --git a/doc/src/technical_concepts/step/step_parameters/params_specification.md b/doc/src/technical_concepts/step/step_parameters/params_specification.md index c791b2a0b..f4f6b7610 100644 --- a/doc/src/technical_concepts/step/step_parameters/params_specification.md +++ b/doc/src/technical_concepts/step/step_parameters/params_specification.md @@ -1,6 +1,6 @@ # Params Specification -For a step to work with different values, the values must be passed in. +For an item to work with different values, the values must be passed in. Item implementors define these as part of the `Item` trait: diff --git a/doc/src/technical_concepts/step_graph.md b/doc/src/technical_concepts/step_graph.md index d1544b6e3..ca9d196e0 100644 --- a/doc/src/technical_concepts/step_graph.md +++ b/doc/src/technical_concepts/step_graph.md @@ -1,6 +1,6 @@ # Item Graph -An item graph is a [function graph], whose logic type is a [step]. +An item graph is a [function graph], whose logic type is an [item]. Instead of storing a single function in each node of the graph, each logic type is a collection of well-defined functions adhering to the [`Item`][`Item`] trait. diff --git a/steps/tar_x/src/tar_x_error.rs b/steps/tar_x/src/tar_x_error.rs index 6afa0f042..673f9f850 100644 --- a/steps/tar_x/src/tar_x_error.rs +++ b/steps/tar_x/src/tar_x_error.rs @@ -15,7 +15,7 @@ pub enum TarXError { #[cfg_attr( feature = "error_reporting", diagnostic(code(peace_item_tar_x::tar_file_not_exists)), - help("Make sure there is a step that downloads the tar file.") + help("Make sure there is an item that downloads the tar file.") )] TarFileNotExists { /// Path to the tar file to extract. From d8d34b8a4676028a1726557e2d15abfcd9d729ae Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Sun, 2 Jun 2024 13:49:41 +1200 Subject: [PATCH 7/9] Revert "Rename `item*` files to `step*`." This reverts commit 1b4ad9c014e71257faa02a1e2c2fc5fb97eca667. --- crate/cfg/src/{step.rs => item.rs} | 0 .../src/{step_stream_outcome.rs => item_stream_outcome.rs} | 0 ...tep_stream_outcome_mapper.rs => item_stream_outcome_mapper.rs} | 0 crate/core/src/{step_id.rs => item_id.rs} | 0 crate/flow_model/src/{step_info.rs => item_info.rs} | 0 crate/flow_model/src/{step_spec_info.rs => item_spec_info.rs} | 0 crate/resources/src/{step_rt_id.rs => item_rt_id.rs} | 0 crate/rt_model/src/{step_boxed.rs => item_boxed.rs} | 0 crate/rt_model/src/{step_graph.rs => item_graph.rs} | 0 .../rt_model/src/{step_graph_builder.rs => item_graph_builder.rs} | 0 crate/rt_model/src/{step_rt.rs => item_rt.rs} | 0 crate/rt_model/src/{step_wrapper.rs => item_wrapper.rs} | 0 crate/rt_model/src/outcomes/{step_apply.rs => item_apply.rs} | 0 .../src/outcomes/{step_apply_boxed.rs => item_apply_boxed.rs} | 0 .../src/outcomes/{step_apply_partial.rs => item_apply_partial.rs} | 0 .../{step_apply_partial_boxed.rs => item_apply_partial_boxed.rs} | 0 .../{step_apply_partial_rt.rs => item_apply_partial_rt.rs} | 0 .../rt_model/src/outcomes/{step_apply_rt.rs => item_apply_rt.rs} | 0 .../{steps_state_stored_stale.rs => items_state_stored_stale.rs} | 0 doc/src/technical_concepts/{step.md => item.md} | 0 doc/src/technical_concepts/{step_graph.md => item_graph.md} | 0 .../step/{step_parameters.md => item_parameters.md} | 0 examples/envman/src/{steps.rs => items.rs} | 0 examples/envman/src/model/{step_ids.rs => item_ids.rs} | 0 .../{iam_policy_step.rs => iam_policy_item.rs} | 0 .../peace_aws_iam_role/{iam_role_step.rs => iam_role_item.rs} | 0 .../{instance_profile_step.rs => instance_profile_item.rs} | 0 .../peace_aws_s3_bucket/{s3_bucket_step.rs => s3_bucket_item.rs} | 0 .../peace_aws_s3_object/{s3_object_step.rs => s3_object_item.rs} | 0 steps/blank/src/{blank_step.rs => blank_item.rs} | 0 .../src/{file_download_step.rs => file_download_item.rs} | 0 steps/sh_cmd/src/{sh_cmd_step.rs => sh_cmd_item.rs} | 0 steps/tar_x/src/{tar_x_step.rs => tar_x_item.rs} | 0 workspace_tests/src/cfg/{step_id.rs => item_id.rs} | 0 .../src/cfg/{step_id_invalid_fmt.rs => item_id_invalid_fmt.rs} | 0 .../cmd_model/{step_stream_outcome.rs => item_stream_outcome.rs} | 0 workspace_tests/src/flow_model/{step_info.rs => item_info.rs} | 0 .../src/flow_model/{step_spec_info.rs => item_spec_info.rs} | 0 workspace_tests/src/{steps.rs => items.rs} | 0 workspace_tests/src/{mock_step.rs => mock_item.rs} | 0 workspace_tests/src/rt_model/{step_boxed.rs => item_boxed.rs} | 0 workspace_tests/src/rt_model/{step_graph.rs => item_graph.rs} | 0 .../src/rt_model/{step_graph_builder.rs => item_graph_builder.rs} | 0 workspace_tests/src/rt_model/{step_wrapper.rs => item_wrapper.rs} | 0 .../src/rt_model/outcomes/{step_apply.rs => item_apply.rs} | 0 .../outcomes/{step_apply_boxed.rs => item_apply_boxed.rs} | 0 .../outcomes/{step_apply_partial.rs => item_apply_partial.rs} | 0 .../{step_apply_partial_boxed.rs => item_apply_partial_boxed.rs} | 0 .../{step_apply_partial_rt.rs => item_apply_partial_rt.rs} | 0 .../src/rt_model/outcomes/{step_apply_rt.rs => item_apply_rt.rs} | 0 workspace_tests/src/steps/{sh_cmd_step.rs => sh_cmd_item.rs} | 0 workspace_tests/src/steps/{tar_x_step.rs => tar_x_item.rs} | 0 workspace_tests/src/{vec_copy_step.rs => vec_copy_item.rs} | 0 53 files changed, 0 insertions(+), 0 deletions(-) rename crate/cfg/src/{step.rs => item.rs} (100%) rename crate/cmd_model/src/{step_stream_outcome.rs => item_stream_outcome.rs} (100%) rename crate/cmd_rt/src/{step_stream_outcome_mapper.rs => item_stream_outcome_mapper.rs} (100%) rename crate/core/src/{step_id.rs => item_id.rs} (100%) rename crate/flow_model/src/{step_info.rs => item_info.rs} (100%) rename crate/flow_model/src/{step_spec_info.rs => item_spec_info.rs} (100%) rename crate/resources/src/{step_rt_id.rs => item_rt_id.rs} (100%) rename crate/rt_model/src/{step_boxed.rs => item_boxed.rs} (100%) rename crate/rt_model/src/{step_graph.rs => item_graph.rs} (100%) rename crate/rt_model/src/{step_graph_builder.rs => item_graph_builder.rs} (100%) rename crate/rt_model/src/{step_rt.rs => item_rt.rs} (100%) rename crate/rt_model/src/{step_wrapper.rs => item_wrapper.rs} (100%) rename crate/rt_model/src/outcomes/{step_apply.rs => item_apply.rs} (100%) rename crate/rt_model/src/outcomes/{step_apply_boxed.rs => item_apply_boxed.rs} (100%) rename crate/rt_model/src/outcomes/{step_apply_partial.rs => item_apply_partial.rs} (100%) rename crate/rt_model/src/outcomes/{step_apply_partial_boxed.rs => item_apply_partial_boxed.rs} (100%) rename crate/rt_model/src/outcomes/{step_apply_partial_rt.rs => item_apply_partial_rt.rs} (100%) rename crate/rt_model/src/outcomes/{step_apply_rt.rs => item_apply_rt.rs} (100%) rename crate/rt_model_core/src/{steps_state_stored_stale.rs => items_state_stored_stale.rs} (100%) rename doc/src/technical_concepts/{step.md => item.md} (100%) rename doc/src/technical_concepts/{step_graph.md => item_graph.md} (100%) rename doc/src/technical_concepts/step/{step_parameters.md => item_parameters.md} (100%) rename examples/envman/src/{steps.rs => items.rs} (100%) rename examples/envman/src/model/{step_ids.rs => item_ids.rs} (100%) rename examples/envman/src/steps/peace_aws_iam_policy/{iam_policy_step.rs => iam_policy_item.rs} (100%) rename examples/envman/src/steps/peace_aws_iam_role/{iam_role_step.rs => iam_role_item.rs} (100%) rename examples/envman/src/steps/peace_aws_instance_profile/{instance_profile_step.rs => instance_profile_item.rs} (100%) rename examples/envman/src/steps/peace_aws_s3_bucket/{s3_bucket_step.rs => s3_bucket_item.rs} (100%) rename examples/envman/src/steps/peace_aws_s3_object/{s3_object_step.rs => s3_object_item.rs} (100%) rename steps/blank/src/{blank_step.rs => blank_item.rs} (100%) rename steps/file_download/src/{file_download_step.rs => file_download_item.rs} (100%) rename steps/sh_cmd/src/{sh_cmd_step.rs => sh_cmd_item.rs} (100%) rename steps/tar_x/src/{tar_x_step.rs => tar_x_item.rs} (100%) rename workspace_tests/src/cfg/{step_id.rs => item_id.rs} (100%) rename workspace_tests/src/cfg/{step_id_invalid_fmt.rs => item_id_invalid_fmt.rs} (100%) rename workspace_tests/src/cmd_model/{step_stream_outcome.rs => item_stream_outcome.rs} (100%) rename workspace_tests/src/flow_model/{step_info.rs => item_info.rs} (100%) rename workspace_tests/src/flow_model/{step_spec_info.rs => item_spec_info.rs} (100%) rename workspace_tests/src/{steps.rs => items.rs} (100%) rename workspace_tests/src/{mock_step.rs => mock_item.rs} (100%) rename workspace_tests/src/rt_model/{step_boxed.rs => item_boxed.rs} (100%) rename workspace_tests/src/rt_model/{step_graph.rs => item_graph.rs} (100%) rename workspace_tests/src/rt_model/{step_graph_builder.rs => item_graph_builder.rs} (100%) rename workspace_tests/src/rt_model/{step_wrapper.rs => item_wrapper.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{step_apply.rs => item_apply.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{step_apply_boxed.rs => item_apply_boxed.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{step_apply_partial.rs => item_apply_partial.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{step_apply_partial_boxed.rs => item_apply_partial_boxed.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{step_apply_partial_rt.rs => item_apply_partial_rt.rs} (100%) rename workspace_tests/src/rt_model/outcomes/{step_apply_rt.rs => item_apply_rt.rs} (100%) rename workspace_tests/src/steps/{sh_cmd_step.rs => sh_cmd_item.rs} (100%) rename workspace_tests/src/steps/{tar_x_step.rs => tar_x_item.rs} (100%) rename workspace_tests/src/{vec_copy_step.rs => vec_copy_item.rs} (100%) diff --git a/crate/cfg/src/step.rs b/crate/cfg/src/item.rs similarity index 100% rename from crate/cfg/src/step.rs rename to crate/cfg/src/item.rs diff --git a/crate/cmd_model/src/step_stream_outcome.rs b/crate/cmd_model/src/item_stream_outcome.rs similarity index 100% rename from crate/cmd_model/src/step_stream_outcome.rs rename to crate/cmd_model/src/item_stream_outcome.rs diff --git a/crate/cmd_rt/src/step_stream_outcome_mapper.rs b/crate/cmd_rt/src/item_stream_outcome_mapper.rs similarity index 100% rename from crate/cmd_rt/src/step_stream_outcome_mapper.rs rename to crate/cmd_rt/src/item_stream_outcome_mapper.rs diff --git a/crate/core/src/step_id.rs b/crate/core/src/item_id.rs similarity index 100% rename from crate/core/src/step_id.rs rename to crate/core/src/item_id.rs diff --git a/crate/flow_model/src/step_info.rs b/crate/flow_model/src/item_info.rs similarity index 100% rename from crate/flow_model/src/step_info.rs rename to crate/flow_model/src/item_info.rs diff --git a/crate/flow_model/src/step_spec_info.rs b/crate/flow_model/src/item_spec_info.rs similarity index 100% rename from crate/flow_model/src/step_spec_info.rs rename to crate/flow_model/src/item_spec_info.rs diff --git a/crate/resources/src/step_rt_id.rs b/crate/resources/src/item_rt_id.rs similarity index 100% rename from crate/resources/src/step_rt_id.rs rename to crate/resources/src/item_rt_id.rs diff --git a/crate/rt_model/src/step_boxed.rs b/crate/rt_model/src/item_boxed.rs similarity index 100% rename from crate/rt_model/src/step_boxed.rs rename to crate/rt_model/src/item_boxed.rs diff --git a/crate/rt_model/src/step_graph.rs b/crate/rt_model/src/item_graph.rs similarity index 100% rename from crate/rt_model/src/step_graph.rs rename to crate/rt_model/src/item_graph.rs diff --git a/crate/rt_model/src/step_graph_builder.rs b/crate/rt_model/src/item_graph_builder.rs similarity index 100% rename from crate/rt_model/src/step_graph_builder.rs rename to crate/rt_model/src/item_graph_builder.rs diff --git a/crate/rt_model/src/step_rt.rs b/crate/rt_model/src/item_rt.rs similarity index 100% rename from crate/rt_model/src/step_rt.rs rename to crate/rt_model/src/item_rt.rs diff --git a/crate/rt_model/src/step_wrapper.rs b/crate/rt_model/src/item_wrapper.rs similarity index 100% rename from crate/rt_model/src/step_wrapper.rs rename to crate/rt_model/src/item_wrapper.rs diff --git a/crate/rt_model/src/outcomes/step_apply.rs b/crate/rt_model/src/outcomes/item_apply.rs similarity index 100% rename from crate/rt_model/src/outcomes/step_apply.rs rename to crate/rt_model/src/outcomes/item_apply.rs diff --git a/crate/rt_model/src/outcomes/step_apply_boxed.rs b/crate/rt_model/src/outcomes/item_apply_boxed.rs similarity index 100% rename from crate/rt_model/src/outcomes/step_apply_boxed.rs rename to crate/rt_model/src/outcomes/item_apply_boxed.rs diff --git a/crate/rt_model/src/outcomes/step_apply_partial.rs b/crate/rt_model/src/outcomes/item_apply_partial.rs similarity index 100% rename from crate/rt_model/src/outcomes/step_apply_partial.rs rename to crate/rt_model/src/outcomes/item_apply_partial.rs diff --git a/crate/rt_model/src/outcomes/step_apply_partial_boxed.rs b/crate/rt_model/src/outcomes/item_apply_partial_boxed.rs similarity index 100% rename from crate/rt_model/src/outcomes/step_apply_partial_boxed.rs rename to crate/rt_model/src/outcomes/item_apply_partial_boxed.rs diff --git a/crate/rt_model/src/outcomes/step_apply_partial_rt.rs b/crate/rt_model/src/outcomes/item_apply_partial_rt.rs similarity index 100% rename from crate/rt_model/src/outcomes/step_apply_partial_rt.rs rename to crate/rt_model/src/outcomes/item_apply_partial_rt.rs diff --git a/crate/rt_model/src/outcomes/step_apply_rt.rs b/crate/rt_model/src/outcomes/item_apply_rt.rs similarity index 100% rename from crate/rt_model/src/outcomes/step_apply_rt.rs rename to crate/rt_model/src/outcomes/item_apply_rt.rs diff --git a/crate/rt_model_core/src/steps_state_stored_stale.rs b/crate/rt_model_core/src/items_state_stored_stale.rs similarity index 100% rename from crate/rt_model_core/src/steps_state_stored_stale.rs rename to crate/rt_model_core/src/items_state_stored_stale.rs diff --git a/doc/src/technical_concepts/step.md b/doc/src/technical_concepts/item.md similarity index 100% rename from doc/src/technical_concepts/step.md rename to doc/src/technical_concepts/item.md diff --git a/doc/src/technical_concepts/step_graph.md b/doc/src/technical_concepts/item_graph.md similarity index 100% rename from doc/src/technical_concepts/step_graph.md rename to doc/src/technical_concepts/item_graph.md diff --git a/doc/src/technical_concepts/step/step_parameters.md b/doc/src/technical_concepts/step/item_parameters.md similarity index 100% rename from doc/src/technical_concepts/step/step_parameters.md rename to doc/src/technical_concepts/step/item_parameters.md diff --git a/examples/envman/src/steps.rs b/examples/envman/src/items.rs similarity index 100% rename from examples/envman/src/steps.rs rename to examples/envman/src/items.rs diff --git a/examples/envman/src/model/step_ids.rs b/examples/envman/src/model/item_ids.rs similarity index 100% rename from examples/envman/src/model/step_ids.rs rename to examples/envman/src/model/item_ids.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_step.rs b/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_step.rs rename to examples/envman/src/steps/peace_aws_iam_policy/iam_policy_item.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_step.rs b/examples/envman/src/steps/peace_aws_iam_role/iam_role_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_step.rs rename to examples/envman/src/steps/peace_aws_iam_role/iam_role_item.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_step.rs b/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_step.rs rename to examples/envman/src/steps/peace_aws_instance_profile/instance_profile_item.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_step.rs b/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_step.rs rename to examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_item.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_step.rs b/examples/envman/src/steps/peace_aws_s3_object/s3_object_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_step.rs rename to examples/envman/src/steps/peace_aws_s3_object/s3_object_item.rs diff --git a/steps/blank/src/blank_step.rs b/steps/blank/src/blank_item.rs similarity index 100% rename from steps/blank/src/blank_step.rs rename to steps/blank/src/blank_item.rs diff --git a/steps/file_download/src/file_download_step.rs b/steps/file_download/src/file_download_item.rs similarity index 100% rename from steps/file_download/src/file_download_step.rs rename to steps/file_download/src/file_download_item.rs diff --git a/steps/sh_cmd/src/sh_cmd_step.rs b/steps/sh_cmd/src/sh_cmd_item.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_step.rs rename to steps/sh_cmd/src/sh_cmd_item.rs diff --git a/steps/tar_x/src/tar_x_step.rs b/steps/tar_x/src/tar_x_item.rs similarity index 100% rename from steps/tar_x/src/tar_x_step.rs rename to steps/tar_x/src/tar_x_item.rs diff --git a/workspace_tests/src/cfg/step_id.rs b/workspace_tests/src/cfg/item_id.rs similarity index 100% rename from workspace_tests/src/cfg/step_id.rs rename to workspace_tests/src/cfg/item_id.rs diff --git a/workspace_tests/src/cfg/step_id_invalid_fmt.rs b/workspace_tests/src/cfg/item_id_invalid_fmt.rs similarity index 100% rename from workspace_tests/src/cfg/step_id_invalid_fmt.rs rename to workspace_tests/src/cfg/item_id_invalid_fmt.rs diff --git a/workspace_tests/src/cmd_model/step_stream_outcome.rs b/workspace_tests/src/cmd_model/item_stream_outcome.rs similarity index 100% rename from workspace_tests/src/cmd_model/step_stream_outcome.rs rename to workspace_tests/src/cmd_model/item_stream_outcome.rs diff --git a/workspace_tests/src/flow_model/step_info.rs b/workspace_tests/src/flow_model/item_info.rs similarity index 100% rename from workspace_tests/src/flow_model/step_info.rs rename to workspace_tests/src/flow_model/item_info.rs diff --git a/workspace_tests/src/flow_model/step_spec_info.rs b/workspace_tests/src/flow_model/item_spec_info.rs similarity index 100% rename from workspace_tests/src/flow_model/step_spec_info.rs rename to workspace_tests/src/flow_model/item_spec_info.rs diff --git a/workspace_tests/src/steps.rs b/workspace_tests/src/items.rs similarity index 100% rename from workspace_tests/src/steps.rs rename to workspace_tests/src/items.rs diff --git a/workspace_tests/src/mock_step.rs b/workspace_tests/src/mock_item.rs similarity index 100% rename from workspace_tests/src/mock_step.rs rename to workspace_tests/src/mock_item.rs diff --git a/workspace_tests/src/rt_model/step_boxed.rs b/workspace_tests/src/rt_model/item_boxed.rs similarity index 100% rename from workspace_tests/src/rt_model/step_boxed.rs rename to workspace_tests/src/rt_model/item_boxed.rs diff --git a/workspace_tests/src/rt_model/step_graph.rs b/workspace_tests/src/rt_model/item_graph.rs similarity index 100% rename from workspace_tests/src/rt_model/step_graph.rs rename to workspace_tests/src/rt_model/item_graph.rs diff --git a/workspace_tests/src/rt_model/step_graph_builder.rs b/workspace_tests/src/rt_model/item_graph_builder.rs similarity index 100% rename from workspace_tests/src/rt_model/step_graph_builder.rs rename to workspace_tests/src/rt_model/item_graph_builder.rs diff --git a/workspace_tests/src/rt_model/step_wrapper.rs b/workspace_tests/src/rt_model/item_wrapper.rs similarity index 100% rename from workspace_tests/src/rt_model/step_wrapper.rs rename to workspace_tests/src/rt_model/item_wrapper.rs diff --git a/workspace_tests/src/rt_model/outcomes/step_apply.rs b/workspace_tests/src/rt_model/outcomes/item_apply.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/step_apply.rs rename to workspace_tests/src/rt_model/outcomes/item_apply.rs diff --git a/workspace_tests/src/rt_model/outcomes/step_apply_boxed.rs b/workspace_tests/src/rt_model/outcomes/item_apply_boxed.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/step_apply_boxed.rs rename to workspace_tests/src/rt_model/outcomes/item_apply_boxed.rs diff --git a/workspace_tests/src/rt_model/outcomes/step_apply_partial.rs b/workspace_tests/src/rt_model/outcomes/item_apply_partial.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/step_apply_partial.rs rename to workspace_tests/src/rt_model/outcomes/item_apply_partial.rs diff --git a/workspace_tests/src/rt_model/outcomes/step_apply_partial_boxed.rs b/workspace_tests/src/rt_model/outcomes/item_apply_partial_boxed.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/step_apply_partial_boxed.rs rename to workspace_tests/src/rt_model/outcomes/item_apply_partial_boxed.rs diff --git a/workspace_tests/src/rt_model/outcomes/step_apply_partial_rt.rs b/workspace_tests/src/rt_model/outcomes/item_apply_partial_rt.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/step_apply_partial_rt.rs rename to workspace_tests/src/rt_model/outcomes/item_apply_partial_rt.rs diff --git a/workspace_tests/src/rt_model/outcomes/step_apply_rt.rs b/workspace_tests/src/rt_model/outcomes/item_apply_rt.rs similarity index 100% rename from workspace_tests/src/rt_model/outcomes/step_apply_rt.rs rename to workspace_tests/src/rt_model/outcomes/item_apply_rt.rs diff --git a/workspace_tests/src/steps/sh_cmd_step.rs b/workspace_tests/src/steps/sh_cmd_item.rs similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step.rs rename to workspace_tests/src/steps/sh_cmd_item.rs diff --git a/workspace_tests/src/steps/tar_x_step.rs b/workspace_tests/src/steps/tar_x_item.rs similarity index 100% rename from workspace_tests/src/steps/tar_x_step.rs rename to workspace_tests/src/steps/tar_x_item.rs diff --git a/workspace_tests/src/vec_copy_step.rs b/workspace_tests/src/vec_copy_item.rs similarity index 100% rename from workspace_tests/src/vec_copy_step.rs rename to workspace_tests/src/vec_copy_item.rs From d8f1390f066a61d1ba290f604ddd2930493cbb4d Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Sun, 2 Jun 2024 13:49:42 +1200 Subject: [PATCH 8/9] Revert "Rename `item*` directories to `step*`." This reverts commit 59ae9d264e1d04c9c922b502653d58209fe32f79. --- .../{step => item}/item_parameters.md | 0 .../item_parameters}/mapping_functions.md | 0 .../item_parameters}/params_framework_support.md | 0 .../item_parameters}/params_specification.md | 0 .../item_parameters}/value_specification.md | 0 .../{step_graph => item_graph}/clean.md | 0 .../{step_graph => item_graph}/initialization.md | 0 .../{step_graph => item_graph}/state_ensure.md | 0 .../{step_graph => item_graph}/state_inspection.md | 0 .../src/{steps => items}/peace_aws_iam_policy.rs | 0 .../peace_aws_iam_policy/iam_policy_apply_fns.rs | 0 .../peace_aws_iam_policy/iam_policy_data.rs | 0 .../peace_aws_iam_policy/iam_policy_error.rs | 0 .../peace_aws_iam_policy/iam_policy_item.rs | 0 .../peace_aws_iam_policy/iam_policy_params.rs | 0 .../peace_aws_iam_policy/iam_policy_state.rs | 0 .../iam_policy_state_current_fn.rs | 0 .../peace_aws_iam_policy/iam_policy_state_diff.rs | 0 .../iam_policy_state_diff_fn.rs | 0 .../iam_policy_state_goal_fn.rs | 0 .../{steps => items}/peace_aws_iam_policy/model.rs | 0 .../model/policy_id_arn_version.rs | 0 .../src/{steps => items}/peace_aws_iam_role.rs | 0 .../ec2_assume_role_policy_document.json | 0 .../peace_aws_iam_role/iam_role_apply_fns.rs | 0 .../peace_aws_iam_role/iam_role_data.rs | 0 .../peace_aws_iam_role/iam_role_error.rs | 0 .../peace_aws_iam_role/iam_role_item.rs | 0 .../peace_aws_iam_role/iam_role_params.rs | 0 .../peace_aws_iam_role/iam_role_state.rs | 0 .../peace_aws_iam_role/iam_role_state_current_fn.rs | 0 .../peace_aws_iam_role/iam_role_state_diff.rs | 0 .../peace_aws_iam_role/iam_role_state_diff_fn.rs | 0 .../peace_aws_iam_role/iam_role_state_goal_fn.rs | 0 .../{steps => items}/peace_aws_iam_role/model.rs | 0 .../model/managed_policy_attachment.rs | 0 .../peace_aws_iam_role/model/role_id_and_arn.rs | 0 .../{steps => items}/peace_aws_instance_profile.rs | 0 .../instance_profile_apply_fns.rs | 0 .../instance_profile_data.rs | 0 .../instance_profile_error.rs | 0 .../instance_profile_item.rs | 0 .../instance_profile_params.rs | 0 .../instance_profile_state.rs | 0 .../instance_profile_state_current_fn.rs | 0 .../instance_profile_state_diff.rs | 0 .../instance_profile_state_diff_fn.rs | 0 .../instance_profile_state_goal_fn.rs | 0 .../peace_aws_instance_profile/model.rs | 0 .../model/instance_profile_id_and_arn.rs | 0 .../src/{steps => items}/peace_aws_s3_bucket.rs | 0 .../peace_aws_s3_bucket/s3_bucket_apply_fns.rs | 0 .../peace_aws_s3_bucket/s3_bucket_data.rs | 0 .../peace_aws_s3_bucket/s3_bucket_error.rs | 0 .../peace_aws_s3_bucket/s3_bucket_item.rs | 0 .../peace_aws_s3_bucket/s3_bucket_params.rs | 0 .../peace_aws_s3_bucket/s3_bucket_state.rs | 0 .../s3_bucket_state_current_fn.rs | 0 .../peace_aws_s3_bucket/s3_bucket_state_diff.rs | 0 .../peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs | 0 .../peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs | 0 .../src/{steps => items}/peace_aws_s3_object.rs | 0 .../peace_aws_s3_object/s3_object_apply_fns.rs | 0 .../peace_aws_s3_object/s3_object_data.rs | 0 .../peace_aws_s3_object/s3_object_error.rs | 0 .../peace_aws_s3_object/s3_object_item.rs | 0 .../peace_aws_s3_object/s3_object_params.rs | 0 .../peace_aws_s3_object/s3_object_state.rs | 0 .../s3_object_state_current_fn.rs | 0 .../peace_aws_s3_object/s3_object_state_diff.rs | 0 .../peace_aws_s3_object/s3_object_state_diff_fn.rs | 0 .../peace_aws_s3_object/s3_object_state_goal_fn.rs | 0 {steps => items}/Cargo.toml | 0 {steps => items}/blank/Cargo.toml | 0 {steps => items}/blank/src/blank_apply_fns.rs | 0 {steps => items}/blank/src/blank_data.rs | 0 {steps => items}/blank/src/blank_dest.rs | 0 {steps => items}/blank/src/blank_error.rs | 0 {steps => items}/blank/src/blank_item.rs | 0 {steps => items}/blank/src/blank_params.rs | 0 {steps => items}/blank/src/blank_src.rs | 0 {steps => items}/blank/src/blank_state.rs | 0 {steps => items}/blank/src/blank_state_diff.rs | 0 {steps => items}/blank/src/lib.rs | 0 {steps => items}/file_download/Cargo.toml | 0 {steps => items}/file_download/src/e_tag.rs | 0 .../file_download/src/file_download_apply_fns.rs | 0 .../file_download/src/file_download_data.rs | 0 .../file_download/src/file_download_error.rs | 0 .../file_download/src/file_download_item.rs | 0 .../file_download/src/file_download_params.rs | 0 .../file_download/src/file_download_state.rs | 0 .../src/file_download_state_current_fn.rs | 0 .../file_download/src/file_download_state_diff.rs | 0 .../src/file_download_state_diff_fn.rs | 0 .../src/file_download_state_goal_fn.rs | 0 {steps => items}/file_download/src/lib.rs | 0 {steps => items}/file_download/src/storage_form.rs | 0 {steps => items}/sh_cmd/Cargo.toml | 0 {steps => items}/sh_cmd/src/cmd_variant.rs | 0 {steps => items}/sh_cmd/src/lib.rs | 0 {steps => items}/sh_cmd/src/sh_cmd.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_apply_fns.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_data.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_error.rs | 0 .../sh_cmd/src/sh_cmd_execution_record.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_executor.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_item.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_params.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_state.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_state_diff.rs | 0 {steps => items}/sh_cmd/src/sh_cmd_state_diff_fn.rs | 0 {steps => items}/src/lib.rs | 0 {steps => items}/tar_x/Cargo.toml | 0 {steps => items}/tar_x/src/file_metadata.rs | 0 {steps => items}/tar_x/src/file_metadatas.rs | 0 {steps => items}/tar_x/src/lib.rs | 0 {steps => items}/tar_x/src/native.rs | 0 {steps => items}/tar_x/src/native/dest_dir_entry.rs | 0 {steps => items}/tar_x/src/native/dir_unfold.rs | 0 {steps => items}/tar_x/src/tar_x_apply_fns.rs | 0 {steps => items}/tar_x/src/tar_x_data.rs | 0 {steps => items}/tar_x/src/tar_x_error.rs | 0 {steps => items}/tar_x/src/tar_x_item.rs | 0 {steps => items}/tar_x/src/tar_x_params.rs | 0 .../tar_x/src/tar_x_state_current_fn.rs | 0 {steps => items}/tar_x/src/tar_x_state_diff.rs | 0 {steps => items}/tar_x/src/tar_x_state_diff_fn.rs | 0 {steps => items}/tar_x/src/tar_x_state_goal_fn.rs | 0 workspace_tests/src/{steps => items}/sh_cmd_item.rs | 0 .../unix/test_file_creation_apply_check.sh | 0 .../unix/test_file_creation_apply_exec.sh | 0 .../unix/test_file_creation_state_clean.sh | 0 .../unix/test_file_creation_state_current.sh | 0 .../unix/test_file_creation_state_diff.sh | 0 .../unix/test_file_creation_state_goal.sh | 0 .../windows/test_file_creation_apply_check.ps1 | 0 .../windows/test_file_creation_apply_exec.ps1 | 0 .../windows/test_file_creation_state_clean.ps1 | 0 .../windows/test_file_creation_state_current.ps1 | 0 .../windows/test_file_creation_state_diff.ps1 | 0 .../windows/test_file_creation_state_goal.ps1 | 0 workspace_tests/src/{steps => items}/tar_x_item.rs | 0 .../tar_x_step => items/tar_x_item}/tar_x1.tar | Bin .../tar_x_step => items/tar_x_item}/tar_x2.tar | Bin 145 files changed, 0 insertions(+), 0 deletions(-) rename doc/src/technical_concepts/{step => item}/item_parameters.md (100%) rename doc/src/technical_concepts/{step/step_parameters => item/item_parameters}/mapping_functions.md (100%) rename doc/src/technical_concepts/{step/step_parameters => item/item_parameters}/params_framework_support.md (100%) rename doc/src/technical_concepts/{step/step_parameters => item/item_parameters}/params_specification.md (100%) rename doc/src/technical_concepts/{step/step_parameters => item/item_parameters}/value_specification.md (100%) rename doc/src/technical_concepts/{step_graph => item_graph}/clean.md (100%) rename doc/src/technical_concepts/{step_graph => item_graph}/initialization.md (100%) rename doc/src/technical_concepts/{step_graph => item_graph}/state_ensure.md (100%) rename doc/src/technical_concepts/{step_graph => item_graph}/state_inspection.md (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_apply_fns.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_data.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_error.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_item.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_params.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_state.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_state_current_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_state_diff.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_state_diff_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/iam_policy_state_goal_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/model.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_policy/model/policy_id_arn_version.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/ec2_assume_role_policy_document.json (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_apply_fns.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_data.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_error.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_item.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_params.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_state.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_state_current_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_state_diff.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_state_diff_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/iam_role_state_goal_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/model.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/model/managed_policy_attachment.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_iam_role/model/role_id_and_arn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_apply_fns.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_data.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_error.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_item.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_params.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_state.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_state_current_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_state_diff.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_state_diff_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/instance_profile_state_goal_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/model.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_apply_fns.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_data.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_error.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_item.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_params.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_state.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_state_diff.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_apply_fns.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_data.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_error.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_item.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_params.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_state.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_state_current_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_state_diff.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_state_diff_fn.rs (100%) rename examples/envman/src/{steps => items}/peace_aws_s3_object/s3_object_state_goal_fn.rs (100%) rename {steps => items}/Cargo.toml (100%) rename {steps => items}/blank/Cargo.toml (100%) rename {steps => items}/blank/src/blank_apply_fns.rs (100%) rename {steps => items}/blank/src/blank_data.rs (100%) rename {steps => items}/blank/src/blank_dest.rs (100%) rename {steps => items}/blank/src/blank_error.rs (100%) rename {steps => items}/blank/src/blank_item.rs (100%) rename {steps => items}/blank/src/blank_params.rs (100%) rename {steps => items}/blank/src/blank_src.rs (100%) rename {steps => items}/blank/src/blank_state.rs (100%) rename {steps => items}/blank/src/blank_state_diff.rs (100%) rename {steps => items}/blank/src/lib.rs (100%) rename {steps => items}/file_download/Cargo.toml (100%) rename {steps => items}/file_download/src/e_tag.rs (100%) rename {steps => items}/file_download/src/file_download_apply_fns.rs (100%) rename {steps => items}/file_download/src/file_download_data.rs (100%) rename {steps => items}/file_download/src/file_download_error.rs (100%) rename {steps => items}/file_download/src/file_download_item.rs (100%) rename {steps => items}/file_download/src/file_download_params.rs (100%) rename {steps => items}/file_download/src/file_download_state.rs (100%) rename {steps => items}/file_download/src/file_download_state_current_fn.rs (100%) rename {steps => items}/file_download/src/file_download_state_diff.rs (100%) rename {steps => items}/file_download/src/file_download_state_diff_fn.rs (100%) rename {steps => items}/file_download/src/file_download_state_goal_fn.rs (100%) rename {steps => items}/file_download/src/lib.rs (100%) rename {steps => items}/file_download/src/storage_form.rs (100%) rename {steps => items}/sh_cmd/Cargo.toml (100%) rename {steps => items}/sh_cmd/src/cmd_variant.rs (100%) rename {steps => items}/sh_cmd/src/lib.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_apply_fns.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_data.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_error.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_execution_record.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_executor.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_item.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_params.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_state.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_state_diff.rs (100%) rename {steps => items}/sh_cmd/src/sh_cmd_state_diff_fn.rs (100%) rename {steps => items}/src/lib.rs (100%) rename {steps => items}/tar_x/Cargo.toml (100%) rename {steps => items}/tar_x/src/file_metadata.rs (100%) rename {steps => items}/tar_x/src/file_metadatas.rs (100%) rename {steps => items}/tar_x/src/lib.rs (100%) rename {steps => items}/tar_x/src/native.rs (100%) rename {steps => items}/tar_x/src/native/dest_dir_entry.rs (100%) rename {steps => items}/tar_x/src/native/dir_unfold.rs (100%) rename {steps => items}/tar_x/src/tar_x_apply_fns.rs (100%) rename {steps => items}/tar_x/src/tar_x_data.rs (100%) rename {steps => items}/tar_x/src/tar_x_error.rs (100%) rename {steps => items}/tar_x/src/tar_x_item.rs (100%) rename {steps => items}/tar_x/src/tar_x_params.rs (100%) rename {steps => items}/tar_x/src/tar_x_state_current_fn.rs (100%) rename {steps => items}/tar_x/src/tar_x_state_diff.rs (100%) rename {steps => items}/tar_x/src/tar_x_state_diff_fn.rs (100%) rename {steps => items}/tar_x/src/tar_x_state_goal_fn.rs (100%) rename workspace_tests/src/{steps => items}/sh_cmd_item.rs (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/unix/test_file_creation_apply_check.sh (100%) mode change 100644 => 100755 rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/unix/test_file_creation_apply_exec.sh (100%) mode change 100644 => 100755 rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/unix/test_file_creation_state_clean.sh (100%) mode change 100644 => 100755 rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/unix/test_file_creation_state_current.sh (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/unix/test_file_creation_state_diff.sh (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/unix/test_file_creation_state_goal.sh (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/windows/test_file_creation_apply_check.ps1 (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/windows/test_file_creation_apply_exec.ps1 (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/windows/test_file_creation_state_clean.ps1 (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/windows/test_file_creation_state_current.ps1 (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/windows/test_file_creation_state_diff.ps1 (100%) rename workspace_tests/src/{steps/sh_cmd_step => items/sh_cmd_item}/windows/test_file_creation_state_goal.ps1 (100%) rename workspace_tests/src/{steps => items}/tar_x_item.rs (100%) rename workspace_tests/src/{steps/tar_x_step => items/tar_x_item}/tar_x1.tar (100%) rename workspace_tests/src/{steps/tar_x_step => items/tar_x_item}/tar_x2.tar (100%) diff --git a/doc/src/technical_concepts/step/item_parameters.md b/doc/src/technical_concepts/item/item_parameters.md similarity index 100% rename from doc/src/technical_concepts/step/item_parameters.md rename to doc/src/technical_concepts/item/item_parameters.md diff --git a/doc/src/technical_concepts/step/step_parameters/mapping_functions.md b/doc/src/technical_concepts/item/item_parameters/mapping_functions.md similarity index 100% rename from doc/src/technical_concepts/step/step_parameters/mapping_functions.md rename to doc/src/technical_concepts/item/item_parameters/mapping_functions.md diff --git a/doc/src/technical_concepts/step/step_parameters/params_framework_support.md b/doc/src/technical_concepts/item/item_parameters/params_framework_support.md similarity index 100% rename from doc/src/technical_concepts/step/step_parameters/params_framework_support.md rename to doc/src/technical_concepts/item/item_parameters/params_framework_support.md diff --git a/doc/src/technical_concepts/step/step_parameters/params_specification.md b/doc/src/technical_concepts/item/item_parameters/params_specification.md similarity index 100% rename from doc/src/technical_concepts/step/step_parameters/params_specification.md rename to doc/src/technical_concepts/item/item_parameters/params_specification.md diff --git a/doc/src/technical_concepts/step/step_parameters/value_specification.md b/doc/src/technical_concepts/item/item_parameters/value_specification.md similarity index 100% rename from doc/src/technical_concepts/step/step_parameters/value_specification.md rename to doc/src/technical_concepts/item/item_parameters/value_specification.md diff --git a/doc/src/technical_concepts/step_graph/clean.md b/doc/src/technical_concepts/item_graph/clean.md similarity index 100% rename from doc/src/technical_concepts/step_graph/clean.md rename to doc/src/technical_concepts/item_graph/clean.md diff --git a/doc/src/technical_concepts/step_graph/initialization.md b/doc/src/technical_concepts/item_graph/initialization.md similarity index 100% rename from doc/src/technical_concepts/step_graph/initialization.md rename to doc/src/technical_concepts/item_graph/initialization.md diff --git a/doc/src/technical_concepts/step_graph/state_ensure.md b/doc/src/technical_concepts/item_graph/state_ensure.md similarity index 100% rename from doc/src/technical_concepts/step_graph/state_ensure.md rename to doc/src/technical_concepts/item_graph/state_ensure.md diff --git a/doc/src/technical_concepts/step_graph/state_inspection.md b/doc/src/technical_concepts/item_graph/state_inspection.md similarity index 100% rename from doc/src/technical_concepts/step_graph/state_inspection.md rename to doc/src/technical_concepts/item_graph/state_inspection.md diff --git a/examples/envman/src/steps/peace_aws_iam_policy.rs b/examples/envman/src/items/peace_aws_iam_policy.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy.rs rename to examples/envman/src/items/peace_aws_iam_policy.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_apply_fns.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_apply_fns.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_apply_fns.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_apply_fns.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_data.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_data.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_data.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_data.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_error.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_error.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_error.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_error.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_item.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_item.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_item.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_params.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_params.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_params.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_params.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_state.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_current_fn.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_current_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_current_fn.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_current_fn.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_diff.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_diff.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_diff.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_diff.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_diff_fn.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_diff_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_diff_fn.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_diff_fn.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_goal_fn.rs b/examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_goal_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/iam_policy_state_goal_fn.rs rename to examples/envman/src/items/peace_aws_iam_policy/iam_policy_state_goal_fn.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/model.rs b/examples/envman/src/items/peace_aws_iam_policy/model.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/model.rs rename to examples/envman/src/items/peace_aws_iam_policy/model.rs diff --git a/examples/envman/src/steps/peace_aws_iam_policy/model/policy_id_arn_version.rs b/examples/envman/src/items/peace_aws_iam_policy/model/policy_id_arn_version.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_policy/model/policy_id_arn_version.rs rename to examples/envman/src/items/peace_aws_iam_policy/model/policy_id_arn_version.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role.rs b/examples/envman/src/items/peace_aws_iam_role.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role.rs rename to examples/envman/src/items/peace_aws_iam_role.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/ec2_assume_role_policy_document.json b/examples/envman/src/items/peace_aws_iam_role/ec2_assume_role_policy_document.json similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/ec2_assume_role_policy_document.json rename to examples/envman/src/items/peace_aws_iam_role/ec2_assume_role_policy_document.json diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_apply_fns.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_apply_fns.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_apply_fns.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_apply_fns.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_data.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_data.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_data.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_data.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_error.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_error.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_error.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_error.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_item.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_item.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_item.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_params.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_params.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_params.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_params.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_state.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_state.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_state.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_state.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_state_current_fn.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_state_current_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_state_current_fn.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_state_current_fn.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_state_diff.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_state_diff.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_state_diff.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_state_diff.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_state_diff_fn.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_state_diff_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_state_diff_fn.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_state_diff_fn.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/iam_role_state_goal_fn.rs b/examples/envman/src/items/peace_aws_iam_role/iam_role_state_goal_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/iam_role_state_goal_fn.rs rename to examples/envman/src/items/peace_aws_iam_role/iam_role_state_goal_fn.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/model.rs b/examples/envman/src/items/peace_aws_iam_role/model.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/model.rs rename to examples/envman/src/items/peace_aws_iam_role/model.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/model/managed_policy_attachment.rs b/examples/envman/src/items/peace_aws_iam_role/model/managed_policy_attachment.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/model/managed_policy_attachment.rs rename to examples/envman/src/items/peace_aws_iam_role/model/managed_policy_attachment.rs diff --git a/examples/envman/src/steps/peace_aws_iam_role/model/role_id_and_arn.rs b/examples/envman/src/items/peace_aws_iam_role/model/role_id_and_arn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_iam_role/model/role_id_and_arn.rs rename to examples/envman/src/items/peace_aws_iam_role/model/role_id_and_arn.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile.rs b/examples/envman/src/items/peace_aws_instance_profile.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile.rs rename to examples/envman/src/items/peace_aws_instance_profile.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_apply_fns.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_apply_fns.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_apply_fns.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_apply_fns.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_data.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_data.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_data.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_data.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_error.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_error.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_error.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_error.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_item.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_item.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_item.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_params.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_params.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_params.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_params.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_state.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_current_fn.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_current_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_current_fn.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_current_fn.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_diff.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_diff.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_diff.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_diff.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_diff_fn.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_diff_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_diff_fn.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_diff_fn.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_goal_fn.rs b/examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_goal_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/instance_profile_state_goal_fn.rs rename to examples/envman/src/items/peace_aws_instance_profile/instance_profile_state_goal_fn.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/model.rs b/examples/envman/src/items/peace_aws_instance_profile/model.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/model.rs rename to examples/envman/src/items/peace_aws_instance_profile/model.rs diff --git a/examples/envman/src/steps/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs b/examples/envman/src/items/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs rename to examples/envman/src/items/peace_aws_instance_profile/model/instance_profile_id_and_arn.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket.rs b/examples/envman/src/items/peace_aws_s3_bucket.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket.rs rename to examples/envman/src/items/peace_aws_s3_bucket.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_apply_fns.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_apply_fns.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_apply_fns.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_apply_fns.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_data.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_data.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_data.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_data.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_error.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_error.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_error.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_error.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_item.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_item.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_item.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_params.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_params.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_params.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_params.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_current_fn.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_diff.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_diff.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_diff.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_diff.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_diff_fn.rs diff --git a/examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs b/examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs rename to examples/envman/src/items/peace_aws_s3_bucket/s3_bucket_state_goal_fn.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object.rs b/examples/envman/src/items/peace_aws_s3_object.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object.rs rename to examples/envman/src/items/peace_aws_s3_object.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_apply_fns.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_apply_fns.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_apply_fns.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_apply_fns.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_data.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_data.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_data.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_data.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_error.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_error.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_error.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_error.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_item.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_item.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_item.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_item.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_params.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_params.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_params.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_params.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_state.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_state.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_state.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_state.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_state_current_fn.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_state_current_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_state_current_fn.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_state_current_fn.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_state_diff.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_state_diff.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_state_diff.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_state_diff.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_state_diff_fn.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_state_diff_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_state_diff_fn.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_state_diff_fn.rs diff --git a/examples/envman/src/steps/peace_aws_s3_object/s3_object_state_goal_fn.rs b/examples/envman/src/items/peace_aws_s3_object/s3_object_state_goal_fn.rs similarity index 100% rename from examples/envman/src/steps/peace_aws_s3_object/s3_object_state_goal_fn.rs rename to examples/envman/src/items/peace_aws_s3_object/s3_object_state_goal_fn.rs diff --git a/steps/Cargo.toml b/items/Cargo.toml similarity index 100% rename from steps/Cargo.toml rename to items/Cargo.toml diff --git a/steps/blank/Cargo.toml b/items/blank/Cargo.toml similarity index 100% rename from steps/blank/Cargo.toml rename to items/blank/Cargo.toml diff --git a/steps/blank/src/blank_apply_fns.rs b/items/blank/src/blank_apply_fns.rs similarity index 100% rename from steps/blank/src/blank_apply_fns.rs rename to items/blank/src/blank_apply_fns.rs diff --git a/steps/blank/src/blank_data.rs b/items/blank/src/blank_data.rs similarity index 100% rename from steps/blank/src/blank_data.rs rename to items/blank/src/blank_data.rs diff --git a/steps/blank/src/blank_dest.rs b/items/blank/src/blank_dest.rs similarity index 100% rename from steps/blank/src/blank_dest.rs rename to items/blank/src/blank_dest.rs diff --git a/steps/blank/src/blank_error.rs b/items/blank/src/blank_error.rs similarity index 100% rename from steps/blank/src/blank_error.rs rename to items/blank/src/blank_error.rs diff --git a/steps/blank/src/blank_item.rs b/items/blank/src/blank_item.rs similarity index 100% rename from steps/blank/src/blank_item.rs rename to items/blank/src/blank_item.rs diff --git a/steps/blank/src/blank_params.rs b/items/blank/src/blank_params.rs similarity index 100% rename from steps/blank/src/blank_params.rs rename to items/blank/src/blank_params.rs diff --git a/steps/blank/src/blank_src.rs b/items/blank/src/blank_src.rs similarity index 100% rename from steps/blank/src/blank_src.rs rename to items/blank/src/blank_src.rs diff --git a/steps/blank/src/blank_state.rs b/items/blank/src/blank_state.rs similarity index 100% rename from steps/blank/src/blank_state.rs rename to items/blank/src/blank_state.rs diff --git a/steps/blank/src/blank_state_diff.rs b/items/blank/src/blank_state_diff.rs similarity index 100% rename from steps/blank/src/blank_state_diff.rs rename to items/blank/src/blank_state_diff.rs diff --git a/steps/blank/src/lib.rs b/items/blank/src/lib.rs similarity index 100% rename from steps/blank/src/lib.rs rename to items/blank/src/lib.rs diff --git a/steps/file_download/Cargo.toml b/items/file_download/Cargo.toml similarity index 100% rename from steps/file_download/Cargo.toml rename to items/file_download/Cargo.toml diff --git a/steps/file_download/src/e_tag.rs b/items/file_download/src/e_tag.rs similarity index 100% rename from steps/file_download/src/e_tag.rs rename to items/file_download/src/e_tag.rs diff --git a/steps/file_download/src/file_download_apply_fns.rs b/items/file_download/src/file_download_apply_fns.rs similarity index 100% rename from steps/file_download/src/file_download_apply_fns.rs rename to items/file_download/src/file_download_apply_fns.rs diff --git a/steps/file_download/src/file_download_data.rs b/items/file_download/src/file_download_data.rs similarity index 100% rename from steps/file_download/src/file_download_data.rs rename to items/file_download/src/file_download_data.rs diff --git a/steps/file_download/src/file_download_error.rs b/items/file_download/src/file_download_error.rs similarity index 100% rename from steps/file_download/src/file_download_error.rs rename to items/file_download/src/file_download_error.rs diff --git a/steps/file_download/src/file_download_item.rs b/items/file_download/src/file_download_item.rs similarity index 100% rename from steps/file_download/src/file_download_item.rs rename to items/file_download/src/file_download_item.rs diff --git a/steps/file_download/src/file_download_params.rs b/items/file_download/src/file_download_params.rs similarity index 100% rename from steps/file_download/src/file_download_params.rs rename to items/file_download/src/file_download_params.rs diff --git a/steps/file_download/src/file_download_state.rs b/items/file_download/src/file_download_state.rs similarity index 100% rename from steps/file_download/src/file_download_state.rs rename to items/file_download/src/file_download_state.rs diff --git a/steps/file_download/src/file_download_state_current_fn.rs b/items/file_download/src/file_download_state_current_fn.rs similarity index 100% rename from steps/file_download/src/file_download_state_current_fn.rs rename to items/file_download/src/file_download_state_current_fn.rs diff --git a/steps/file_download/src/file_download_state_diff.rs b/items/file_download/src/file_download_state_diff.rs similarity index 100% rename from steps/file_download/src/file_download_state_diff.rs rename to items/file_download/src/file_download_state_diff.rs diff --git a/steps/file_download/src/file_download_state_diff_fn.rs b/items/file_download/src/file_download_state_diff_fn.rs similarity index 100% rename from steps/file_download/src/file_download_state_diff_fn.rs rename to items/file_download/src/file_download_state_diff_fn.rs diff --git a/steps/file_download/src/file_download_state_goal_fn.rs b/items/file_download/src/file_download_state_goal_fn.rs similarity index 100% rename from steps/file_download/src/file_download_state_goal_fn.rs rename to items/file_download/src/file_download_state_goal_fn.rs diff --git a/steps/file_download/src/lib.rs b/items/file_download/src/lib.rs similarity index 100% rename from steps/file_download/src/lib.rs rename to items/file_download/src/lib.rs diff --git a/steps/file_download/src/storage_form.rs b/items/file_download/src/storage_form.rs similarity index 100% rename from steps/file_download/src/storage_form.rs rename to items/file_download/src/storage_form.rs diff --git a/steps/sh_cmd/Cargo.toml b/items/sh_cmd/Cargo.toml similarity index 100% rename from steps/sh_cmd/Cargo.toml rename to items/sh_cmd/Cargo.toml diff --git a/steps/sh_cmd/src/cmd_variant.rs b/items/sh_cmd/src/cmd_variant.rs similarity index 100% rename from steps/sh_cmd/src/cmd_variant.rs rename to items/sh_cmd/src/cmd_variant.rs diff --git a/steps/sh_cmd/src/lib.rs b/items/sh_cmd/src/lib.rs similarity index 100% rename from steps/sh_cmd/src/lib.rs rename to items/sh_cmd/src/lib.rs diff --git a/steps/sh_cmd/src/sh_cmd.rs b/items/sh_cmd/src/sh_cmd.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd.rs rename to items/sh_cmd/src/sh_cmd.rs diff --git a/steps/sh_cmd/src/sh_cmd_apply_fns.rs b/items/sh_cmd/src/sh_cmd_apply_fns.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_apply_fns.rs rename to items/sh_cmd/src/sh_cmd_apply_fns.rs diff --git a/steps/sh_cmd/src/sh_cmd_data.rs b/items/sh_cmd/src/sh_cmd_data.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_data.rs rename to items/sh_cmd/src/sh_cmd_data.rs diff --git a/steps/sh_cmd/src/sh_cmd_error.rs b/items/sh_cmd/src/sh_cmd_error.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_error.rs rename to items/sh_cmd/src/sh_cmd_error.rs diff --git a/steps/sh_cmd/src/sh_cmd_execution_record.rs b/items/sh_cmd/src/sh_cmd_execution_record.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_execution_record.rs rename to items/sh_cmd/src/sh_cmd_execution_record.rs diff --git a/steps/sh_cmd/src/sh_cmd_executor.rs b/items/sh_cmd/src/sh_cmd_executor.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_executor.rs rename to items/sh_cmd/src/sh_cmd_executor.rs diff --git a/steps/sh_cmd/src/sh_cmd_item.rs b/items/sh_cmd/src/sh_cmd_item.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_item.rs rename to items/sh_cmd/src/sh_cmd_item.rs diff --git a/steps/sh_cmd/src/sh_cmd_params.rs b/items/sh_cmd/src/sh_cmd_params.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_params.rs rename to items/sh_cmd/src/sh_cmd_params.rs diff --git a/steps/sh_cmd/src/sh_cmd_state.rs b/items/sh_cmd/src/sh_cmd_state.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_state.rs rename to items/sh_cmd/src/sh_cmd_state.rs diff --git a/steps/sh_cmd/src/sh_cmd_state_diff.rs b/items/sh_cmd/src/sh_cmd_state_diff.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_state_diff.rs rename to items/sh_cmd/src/sh_cmd_state_diff.rs diff --git a/steps/sh_cmd/src/sh_cmd_state_diff_fn.rs b/items/sh_cmd/src/sh_cmd_state_diff_fn.rs similarity index 100% rename from steps/sh_cmd/src/sh_cmd_state_diff_fn.rs rename to items/sh_cmd/src/sh_cmd_state_diff_fn.rs diff --git a/steps/src/lib.rs b/items/src/lib.rs similarity index 100% rename from steps/src/lib.rs rename to items/src/lib.rs diff --git a/steps/tar_x/Cargo.toml b/items/tar_x/Cargo.toml similarity index 100% rename from steps/tar_x/Cargo.toml rename to items/tar_x/Cargo.toml diff --git a/steps/tar_x/src/file_metadata.rs b/items/tar_x/src/file_metadata.rs similarity index 100% rename from steps/tar_x/src/file_metadata.rs rename to items/tar_x/src/file_metadata.rs diff --git a/steps/tar_x/src/file_metadatas.rs b/items/tar_x/src/file_metadatas.rs similarity index 100% rename from steps/tar_x/src/file_metadatas.rs rename to items/tar_x/src/file_metadatas.rs diff --git a/steps/tar_x/src/lib.rs b/items/tar_x/src/lib.rs similarity index 100% rename from steps/tar_x/src/lib.rs rename to items/tar_x/src/lib.rs diff --git a/steps/tar_x/src/native.rs b/items/tar_x/src/native.rs similarity index 100% rename from steps/tar_x/src/native.rs rename to items/tar_x/src/native.rs diff --git a/steps/tar_x/src/native/dest_dir_entry.rs b/items/tar_x/src/native/dest_dir_entry.rs similarity index 100% rename from steps/tar_x/src/native/dest_dir_entry.rs rename to items/tar_x/src/native/dest_dir_entry.rs diff --git a/steps/tar_x/src/native/dir_unfold.rs b/items/tar_x/src/native/dir_unfold.rs similarity index 100% rename from steps/tar_x/src/native/dir_unfold.rs rename to items/tar_x/src/native/dir_unfold.rs diff --git a/steps/tar_x/src/tar_x_apply_fns.rs b/items/tar_x/src/tar_x_apply_fns.rs similarity index 100% rename from steps/tar_x/src/tar_x_apply_fns.rs rename to items/tar_x/src/tar_x_apply_fns.rs diff --git a/steps/tar_x/src/tar_x_data.rs b/items/tar_x/src/tar_x_data.rs similarity index 100% rename from steps/tar_x/src/tar_x_data.rs rename to items/tar_x/src/tar_x_data.rs diff --git a/steps/tar_x/src/tar_x_error.rs b/items/tar_x/src/tar_x_error.rs similarity index 100% rename from steps/tar_x/src/tar_x_error.rs rename to items/tar_x/src/tar_x_error.rs diff --git a/steps/tar_x/src/tar_x_item.rs b/items/tar_x/src/tar_x_item.rs similarity index 100% rename from steps/tar_x/src/tar_x_item.rs rename to items/tar_x/src/tar_x_item.rs diff --git a/steps/tar_x/src/tar_x_params.rs b/items/tar_x/src/tar_x_params.rs similarity index 100% rename from steps/tar_x/src/tar_x_params.rs rename to items/tar_x/src/tar_x_params.rs diff --git a/steps/tar_x/src/tar_x_state_current_fn.rs b/items/tar_x/src/tar_x_state_current_fn.rs similarity index 100% rename from steps/tar_x/src/tar_x_state_current_fn.rs rename to items/tar_x/src/tar_x_state_current_fn.rs diff --git a/steps/tar_x/src/tar_x_state_diff.rs b/items/tar_x/src/tar_x_state_diff.rs similarity index 100% rename from steps/tar_x/src/tar_x_state_diff.rs rename to items/tar_x/src/tar_x_state_diff.rs diff --git a/steps/tar_x/src/tar_x_state_diff_fn.rs b/items/tar_x/src/tar_x_state_diff_fn.rs similarity index 100% rename from steps/tar_x/src/tar_x_state_diff_fn.rs rename to items/tar_x/src/tar_x_state_diff_fn.rs diff --git a/steps/tar_x/src/tar_x_state_goal_fn.rs b/items/tar_x/src/tar_x_state_goal_fn.rs similarity index 100% rename from steps/tar_x/src/tar_x_state_goal_fn.rs rename to items/tar_x/src/tar_x_state_goal_fn.rs diff --git a/workspace_tests/src/steps/sh_cmd_item.rs b/workspace_tests/src/items/sh_cmd_item.rs similarity index 100% rename from workspace_tests/src/steps/sh_cmd_item.rs rename to workspace_tests/src/items/sh_cmd_item.rs diff --git a/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_apply_check.sh b/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_apply_check.sh old mode 100644 new mode 100755 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_apply_check.sh rename to workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_apply_check.sh diff --git a/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_apply_exec.sh b/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_apply_exec.sh old mode 100644 new mode 100755 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_apply_exec.sh rename to workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_apply_exec.sh diff --git a/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_clean.sh b/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_clean.sh old mode 100644 new mode 100755 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_clean.sh rename to workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_clean.sh diff --git a/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_current.sh b/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_current.sh similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_current.sh rename to workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_current.sh diff --git a/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_diff.sh b/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_diff.sh similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_diff.sh rename to workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_diff.sh diff --git a/workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_goal.sh b/workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_goal.sh similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/unix/test_file_creation_state_goal.sh rename to workspace_tests/src/items/sh_cmd_item/unix/test_file_creation_state_goal.sh diff --git a/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_apply_check.ps1 b/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_apply_check.ps1 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_apply_check.ps1 rename to workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_apply_check.ps1 diff --git a/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_apply_exec.ps1 b/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_apply_exec.ps1 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_apply_exec.ps1 rename to workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_apply_exec.ps1 diff --git a/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_clean.ps1 b/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_clean.ps1 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_clean.ps1 rename to workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_clean.ps1 diff --git a/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_current.ps1 b/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_current.ps1 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_current.ps1 rename to workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_current.ps1 diff --git a/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_diff.ps1 b/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_diff.ps1 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_diff.ps1 rename to workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_diff.ps1 diff --git a/workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_goal.ps1 b/workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_goal.ps1 similarity index 100% rename from workspace_tests/src/steps/sh_cmd_step/windows/test_file_creation_state_goal.ps1 rename to workspace_tests/src/items/sh_cmd_item/windows/test_file_creation_state_goal.ps1 diff --git a/workspace_tests/src/steps/tar_x_item.rs b/workspace_tests/src/items/tar_x_item.rs similarity index 100% rename from workspace_tests/src/steps/tar_x_item.rs rename to workspace_tests/src/items/tar_x_item.rs diff --git a/workspace_tests/src/steps/tar_x_step/tar_x1.tar b/workspace_tests/src/items/tar_x_item/tar_x1.tar similarity index 100% rename from workspace_tests/src/steps/tar_x_step/tar_x1.tar rename to workspace_tests/src/items/tar_x_item/tar_x1.tar diff --git a/workspace_tests/src/steps/tar_x_step/tar_x2.tar b/workspace_tests/src/items/tar_x_item/tar_x2.tar similarity index 100% rename from workspace_tests/src/steps/tar_x_step/tar_x2.tar rename to workspace_tests/src/items/tar_x_item/tar_x2.tar From 5256d1a99b593f00daba1d7add632675b84da5f0 Mon Sep 17 00:00:00 2001 From: Azriel Hoh Date: Sun, 2 Jun 2024 13:52:59 +1200 Subject: [PATCH 9/9] Minor documentation changes. --- crate/cmd/src/scopes/multi_profile_no_flow.rs | 4 ++-- crate/cmd/src/scopes/single_profile_no_flow.rs | 4 ++-- crate/rt_model_core/src/error/web_error.rs | 3 ++- doc/src/technical_concepts/item.md | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/crate/cmd/src/scopes/multi_profile_no_flow.rs b/crate/cmd/src/scopes/multi_profile_no_flow.rs index 64a4e035c..caa538e2f 100644 --- a/crate/cmd/src/scopes/multi_profile_no_flow.rs +++ b/crate/cmd/src/scopes/multi_profile_no_flow.rs @@ -15,7 +15,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::ctx::CmdCtxTypes; -/// A command that works with multiple profiles, without any items. +/// A command that works with multiple profiles, not scoped to a flow. /// /// ```bash /// path/to/repo/.peace/envman @@ -94,7 +94,7 @@ where >, } -/// A command that works with multiple profiles, without any items. +/// A command that works with multiple profiles, not scoped to a flow. /// /// ```bash /// path/to/repo/.peace/envman diff --git a/crate/cmd/src/scopes/single_profile_no_flow.rs b/crate/cmd/src/scopes/single_profile_no_flow.rs index 7ad07a042..30eec15f5 100644 --- a/crate/cmd/src/scopes/single_profile_no_flow.rs +++ b/crate/cmd/src/scopes/single_profile_no_flow.rs @@ -15,7 +15,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::ctx::CmdCtxTypes; -/// A command that works with a single profile, without any items. +/// A command that works with a single profile, not scoped to a flow. /// /// ```bash /// path/to/repo/.peace/envman @@ -84,7 +84,7 @@ where >, } -/// A command that works with a single profile, without any items. +/// A command that works with a single profile, not scoped to a flow. /// /// ```bash /// path/to/repo/.peace/envman diff --git a/crate/rt_model_core/src/error/web_error.rs b/crate/rt_model_core/src/error/web_error.rs index e20a01415..39fe29325 100644 --- a/crate/rt_model_core/src/error/web_error.rs +++ b/crate/rt_model_core/src/error/web_error.rs @@ -123,7 +123,8 @@ pub enum WebError { }, /// Failed to remove an item from browser storage. /// - /// This failure mode happens when the `get_item` call to the browser fails. + /// This failure mode happens when the `remove_item` call to the browser + /// fails. /// /// Note: The original `JsValue` error is converted to a `String` to allow /// this type to be `Send`. diff --git a/doc/src/technical_concepts/item.md b/doc/src/technical_concepts/item.md index 7f7e50c12..f503feec7 100644 --- a/doc/src/technical_concepts/item.md +++ b/doc/src/technical_concepts/item.md @@ -167,7 +167,7 @@ Cleans up the item from existence. Readers may notice the function breakdown is `git`-like. The following table compares the concepts: -| Subject | Peace | Git | +| Concept | Peace | Git | |:-----------------------|:-------------------------------------------------------|:-----------------------------------------------------------------------------------------| | Item | Any consumer defined item. | A directory of files. | | Project initialization | `init` command takes in parameters to manage the item. | Uses the current directory or passed in directory. |