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` --- Cargo.lock | 1 + Cargo.toml | 2 ++ crates/system_action/src/lib.rs | 5 +++-- crates/vcs_actions/src/actions/local_actions.rs | 12 +++++++++++- crates/vcs_actions/src/registry/client_registry.rs | 5 +++-- examples/src/bin/example_action_system.rs | 2 +- src/lib.rs | 10 ++++++++-- 7 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7911b5..daf478d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -555,6 +555,7 @@ dependencies = [ name = "just_enough_vcs" version = "0.0.0" dependencies = [ + "action_system", "cfg_file", "string_proc", "tcp_connection", diff --git a/Cargo.toml b/Cargo.toml index 881fbbe..fa5292c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,5 +60,7 @@ cfg_file = { path = "crates/utils/cfg_file" } tcp_connection = { path = "crates/utils/tcp_connection" } string_proc = { path = "crates/utils/string_proc" } +action_system = { path = "crates/system_action" } + vcs_data = { path = "crates/vcs_data" } vcs_actions = { path = "crates/vcs_actions" } diff --git a/crates/system_action/src/lib.rs b/crates/system_action/src/lib.rs index 07be1bb..12ae999 100644 --- a/crates/system_action/src/lib.rs +++ b/crates/system_action/src/lib.rs @@ -1,5 +1,6 @@ -pub use action_system_macros::*; -pub extern crate action_system_macros as macros; +pub mod macros { + pub use action_system_macros::*; +} pub mod action; pub mod action_pool; 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(()) +} diff --git a/crates/vcs_actions/src/registry/client_registry.rs b/crates/vcs_actions/src/registry/client_registry.rs index 5939bed..484c4f4 100644 --- a/crates/vcs_actions/src/registry/client_registry.rs +++ b/crates/vcs_actions/src/registry/client_registry.rs @@ -2,12 +2,13 @@ use action_system::{action::ActionContext, action_pool::ActionPool}; use tcp_connection::error::TcpTargetError; use crate::{ - actions::local_actions::register_hello_world_action, connection::protocol::RemoteActionInvoke, + actions::local_actions::register_set_upstream_vault_action, + connection::protocol::RemoteActionInvoke, }; fn register_actions(pool: &mut ActionPool) { // Pool register here - register_hello_world_action(pool); + register_set_upstream_vault_action(pool); } pub fn client_action_pool() -> ActionPool { diff --git a/examples/src/bin/example_action_system.rs b/examples/src/bin/example_action_system.rs index c873a2e..776c982 100644 --- a/examples/src/bin/example_action_system.rs +++ b/examples/src/bin/example_action_system.rs @@ -1,4 +1,4 @@ -use action_system::{action::ActionContext, action_gen, action_pool::ActionPool}; +use action_system::{action::ActionContext, action_pool::ActionPool, macros::action_gen}; use tcp_connection::error::TcpTargetError; #[tokio::main] diff --git a/src/lib.rs b/src/lib.rs index 29855e3..4771dcd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,13 +1,19 @@ // Feature `vcs` #[cfg(feature = "vcs")] pub mod vcs { - extern crate vcs_data; + pub extern crate vcs_data; pub use vcs_data::*; - extern crate vcs_actions; + pub extern crate vcs_actions; pub use vcs_actions::*; } +pub mod system { + pub mod action_system { + pub use action_system::*; + } +} + pub mod utils { // Feature `tcp_connection` #[cfg(feature = "tcp_connection")] -- cgit