From 27f6414ad1ff451feb0044af62f37dc2a6255ffa Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 5 Feb 2026 22:35:05 +0800 Subject: Remove examples and legacy code, update .gitignore - Delete examples directory and its example action system - Rename actions/ to legacy_actions/ and data/ to legacy_data/ - Update Cargo.toml license file reference - Move setup scripts to scripts/dev/ directory - Add todo.txt patterns to .gitignore --- actions/src/registry/client_registry.rs | 128 -------------------------------- actions/src/registry/server_registry.rs | 43 ----------- 2 files changed, 171 deletions(-) delete mode 100644 actions/src/registry/client_registry.rs delete mode 100644 actions/src/registry/server_registry.rs (limited to 'actions/src/registry') diff --git a/actions/src/registry/client_registry.rs b/actions/src/registry/client_registry.rs deleted file mode 100644 index db69889..0000000 --- a/actions/src/registry/client_registry.rs +++ /dev/null @@ -1,128 +0,0 @@ -use std::sync::Arc; - -use action_system::{action::ActionContext, action_pool::ActionPool}; -use cfg_file::config::ConfigFile; -use tcp_connection::error::TcpTargetError; -use vcs_data::data::{ - local::{LocalWorkspace, workspace_config::LocalConfig}, - user::UserDirectory, -}; - -use crate::{ - connection::protocol::RemoteActionInvoke, - remote_actions::{ - content_manage::track_file::register_track_file_action, - edit_right_manage::change_virtual_file_edit_right::register_change_virtual_file_edit_right_action, - mapping_manage::{ - edit_mapping::register_edit_mapping_action, - merge_share_mapping::register_merge_share_mapping_action, - share_mapping::register_share_mapping_action, - }, - sheet_manage::{ - drop_sheet::register_drop_sheet_action, make_sheet::register_make_sheet_action, - }, - workspace_manage::{ - set_upstream_vault::register_set_upstream_vault_action, - update_to_latest_info::register_update_to_latest_info_action, - }, - }, -}; - -fn register_actions(pool: &mut ActionPool) { - // Pool register here - - // Local Actions - register_set_upstream_vault_action(pool); - register_update_to_latest_info_action(pool); - - // Sheet Actions - register_make_sheet_action(pool); - register_drop_sheet_action(pool); - register_edit_mapping_action(pool); - - // Share / Merge Share Actions - register_share_mapping_action(pool); - register_merge_share_mapping_action(pool); - - // Track Action - register_track_file_action(pool); - - // User Actions - register_change_virtual_file_edit_right_action(pool); -} - -pub fn client_action_pool() -> ActionPool { - // Create pool - let mut pool = ActionPool::new(); - - // Register actions - register_actions(&mut pool); - - // Add process events - pool.set_on_proc_begin(|ctx, args| Box::pin(on_proc_begin(ctx, args))); - - // Return - pool -} - -async fn on_proc_begin( - ctx: &mut ActionContext, - _args: &(dyn std::any::Any + Send + Sync), -) -> Result<(), TcpTargetError> { - // Is ctx remote - let is_remote = ctx.is_remote_action(); - - // Action name and arguments - let action_name = ctx.action_name().to_string(); - let action_args_json = ctx.action_args_json().clone(); - - // Insert LocalWorkspace Arc - let Ok(local_config) = LocalConfig::read().await else { - return Err(TcpTargetError::NotFound( - "The current directory does not have a local workspace".to_string(), - )); - }; - let local_workspace = match LocalWorkspace::init_current_dir(local_config) { - Some(workspace) => workspace, - None => { - return Err(TcpTargetError::NotFound( - "Failed to initialize local workspace.".to_string(), - )); - } - }; - let local_workspace_arc = Arc::new(local_workspace); - ctx.insert_arc_data(local_workspace_arc); - - // Insert UserDirectory Arc - let Some(user_directory) = UserDirectory::current_cfg_dir() else { - return Err(TcpTargetError::NotFound( - "The user directory does not exist.".to_string(), - )); - }; - - let user_directory_arc = Arc::new(user_directory); - ctx.insert_arc_data(user_directory_arc); - - // Get instance - let Some(instance) = ctx.instance() else { - return Err(TcpTargetError::Unsupported( - "Missing ConnectionInstance in current context, this ActionPool does not support this call" - .to_string())); - }; - - // If it's remote, invoke action at server - if is_remote { - // Build protocol message - let msg = RemoteActionInvoke { - action_name, - action_args_json, - }; - - // Send - let mut instance = instance.lock().await; - instance.write_msgpack(&msg).await?; - } - - // Return OK, wait for client to execute Action locally - Ok(()) -} diff --git a/actions/src/registry/server_registry.rs b/actions/src/registry/server_registry.rs deleted file mode 100644 index aee867c..0000000 --- a/actions/src/registry/server_registry.rs +++ /dev/null @@ -1,43 +0,0 @@ -use action_system::action_pool::ActionPool; - -use crate::remote_actions::{ - content_manage::track_file::register_track_file_action, - edit_right_manage::change_virtual_file_edit_right::register_change_virtual_file_edit_right_action, - mapping_manage::{ - edit_mapping::register_edit_mapping_action, - merge_share_mapping::register_merge_share_mapping_action, - share_mapping::register_share_mapping_action, - }, - sheet_manage::{ - drop_sheet::register_drop_sheet_action, make_sheet::register_make_sheet_action, - }, - workspace_manage::{ - set_upstream_vault::register_set_upstream_vault_action, - update_to_latest_info::register_update_to_latest_info_action, - }, -}; - -pub fn server_action_pool() -> ActionPool { - let mut pool = ActionPool::new(); - - // Local Actions - register_set_upstream_vault_action(&mut pool); - register_update_to_latest_info_action(&mut pool); - - // Sheet Actions - register_make_sheet_action(&mut pool); - register_drop_sheet_action(&mut pool); - register_edit_mapping_action(&mut pool); - - // Share / Merge Share Actions - register_share_mapping_action(&mut pool); - register_merge_share_mapping_action(&mut pool); - - // Track Action - register_track_file_action(&mut pool); - - // User Actions - register_change_virtual_file_edit_right_action(&mut pool); - - pool -} -- cgit