From b2c45bf5c16391917caccd703ac85b80c5c77cca Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 24 Oct 2025 14:47:20 +0800 Subject: Re-export subcrate `action_system` to `just_enough_vcs` --- crates/vcs_actions/src/actions/local_actions.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'crates/vcs_actions/src/actions') diff --git a/crates/vcs_actions/src/actions/local_actions.rs b/crates/vcs_actions/src/actions/local_actions.rs index b11a934..55d014e 100644 --- a/crates/vcs_actions/src/actions/local_actions.rs +++ b/crates/vcs_actions/src/actions/local_actions.rs @@ -1,4 +1,6 @@ -use action_system::{action::ActionContext, action_gen}; +use std::net::SocketAddr; + +use action_system::{action::ActionContext, macros::action_gen}; use log::info; use tcp_connection::error::TcpTargetError; @@ -23,3 +25,11 @@ pub async fn hello_world_action(ctx: ActionContext, _n: ()) -> Result<(), TcpTar Ok(()) } + +#[action_gen] +pub async fn set_upstream_vault_action( + ctx: ActionContext, + upstream: SocketAddr, +) -> Result<(), TcpTargetError> { + Ok(()) +} -- cgit From ac71a819dd45090a2ee1054208fd027f05a8c36c Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 24 Oct 2025 18:24:04 +0800 Subject: Fix some spelling issues. --- crates/vcs_actions/src/actions/local_actions.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'crates/vcs_actions/src/actions') diff --git a/crates/vcs_actions/src/actions/local_actions.rs b/crates/vcs_actions/src/actions/local_actions.rs index 55d014e..c19b8f0 100644 --- a/crates/vcs_actions/src/actions/local_actions.rs +++ b/crates/vcs_actions/src/actions/local_actions.rs @@ -29,7 +29,24 @@ pub async fn hello_world_action(ctx: ActionContext, _n: ()) -> Result<(), TcpTar #[action_gen] pub async fn set_upstream_vault_action( ctx: ActionContext, - upstream: SocketAddr, + _upstream: SocketAddr, ) -> Result<(), TcpTargetError> { + // Ensure the instance is available + let Some(instance) = ctx.instance() else { + return Err(TcpTargetError::NotFound( + "Connection Instance Lost.".to_string(), + )); + }; + + if ctx.is_local() { + // Invoke on local + // Send the message to the server + let _ = instance.lock().await.write_text("Hello World!").await; + } else if ctx.is_remote() { + // Read the message from the client + let read = instance.lock().await.read_text().await?; + info!("{}", read) + } + Ok(()) } -- cgit From e5238eebd2bc9cfbb508d7b69b3b84708bf184f7 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 27 Oct 2025 15:23:28 +0800 Subject: Add some debug logs --- crates/vcs_actions/src/actions/local_actions.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/vcs_actions/src/actions') diff --git a/crates/vcs_actions/src/actions/local_actions.rs b/crates/vcs_actions/src/actions/local_actions.rs index c19b8f0..c2d9f4f 100644 --- a/crates/vcs_actions/src/actions/local_actions.rs +++ b/crates/vcs_actions/src/actions/local_actions.rs @@ -14,11 +14,10 @@ pub async fn hello_world_action(ctx: ActionContext, _n: ()) -> Result<(), TcpTar }; if ctx.is_local() { - // Invoke on local - // Send the message to the server - let _ = instance.lock().await.write_text("Hello World!").await; + // Local execution - communication is handled by on_proc_begin + info!("Hello World action executed locally"); } else if ctx.is_remote() { - // Read the message from the client + // Remote execution - read the message from the client let read = instance.lock().await.read_text().await?; info!("{}", read) } @@ -43,9 +42,9 @@ pub async fn set_upstream_vault_action( // Send the message to the server let _ = instance.lock().await.write_text("Hello World!").await; } else if ctx.is_remote() { - // Read the message from the client + // Remote execution - read the message from the client let read = instance.lock().await.read_text().await?; - info!("{}", read) + info!("Received: {}", read) } Ok(()) -- cgit From 2954fc5ce35126e4cf9ebfc64043c0e52a990e01 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 27 Oct 2025 17:38:28 +0800 Subject: update: ActionContext 1. Rename `local` to `proc_on_local` 2. Add `is_remote_action` --- crates/vcs_actions/src/actions/local_actions.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/vcs_actions/src/actions') diff --git a/crates/vcs_actions/src/actions/local_actions.rs b/crates/vcs_actions/src/actions/local_actions.rs index c2d9f4f..e2788ff 100644 --- a/crates/vcs_actions/src/actions/local_actions.rs +++ b/crates/vcs_actions/src/actions/local_actions.rs @@ -13,10 +13,10 @@ pub async fn hello_world_action(ctx: ActionContext, _n: ()) -> Result<(), TcpTar )); }; - if ctx.is_local() { + if ctx.is_proc_on_local() { // Local execution - communication is handled by on_proc_begin info!("Hello World action executed locally"); - } else if ctx.is_remote() { + } else if ctx.is_proc_on_remote() { // Remote execution - read the message from the client let read = instance.lock().await.read_text().await?; info!("{}", read) @@ -37,11 +37,11 @@ pub async fn set_upstream_vault_action( )); }; - if ctx.is_local() { + if ctx.is_proc_on_local() { // Invoke on local // Send the message to the server let _ = instance.lock().await.write_text("Hello World!").await; - } else if ctx.is_remote() { + } else if ctx.is_proc_on_remote() { // Remote execution - read the message from the client let read = instance.lock().await.read_text().await?; info!("Received: {}", read) -- cgit From 5212da62bb6d7b3e0eb8d9b2801cc8d1d7ef4ece Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 27 Oct 2025 17:50:05 +0800 Subject: update: Remove `hello_world_action` --- crates/vcs_actions/src/actions/local_actions.rs | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'crates/vcs_actions/src/actions') diff --git a/crates/vcs_actions/src/actions/local_actions.rs b/crates/vcs_actions/src/actions/local_actions.rs index e2788ff..f705692 100644 --- a/crates/vcs_actions/src/actions/local_actions.rs +++ b/crates/vcs_actions/src/actions/local_actions.rs @@ -4,27 +4,6 @@ use action_system::{action::ActionContext, macros::action_gen}; use log::info; use tcp_connection::error::TcpTargetError; -#[action_gen] -pub async fn hello_world_action(ctx: ActionContext, _n: ()) -> Result<(), TcpTargetError> { - // Ensure the instance is available - let Some(instance) = ctx.instance() else { - return Err(TcpTargetError::NotFound( - "Connection Instance Lost.".to_string(), - )); - }; - - if ctx.is_proc_on_local() { - // Local execution - communication is handled by on_proc_begin - info!("Hello World action executed locally"); - } else if ctx.is_proc_on_remote() { - // Remote execution - read the message from the client - let read = instance.lock().await.read_text().await?; - info!("{}", read) - } - - Ok(()) -} - #[action_gen] pub async fn set_upstream_vault_action( ctx: ActionContext, -- cgit