summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/vcs_actions/src/actions/local_actions.rs19
-rw-r--r--crates/vcs_actions/src/registry/server_registry.rs4
-rw-r--r--crates/vcs_data/src/data/local.rs2
3 files changed, 21 insertions, 4 deletions
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(())
}
diff --git a/crates/vcs_actions/src/registry/server_registry.rs b/crates/vcs_actions/src/registry/server_registry.rs
index b449b68..3ecc103 100644
--- a/crates/vcs_actions/src/registry/server_registry.rs
+++ b/crates/vcs_actions/src/registry/server_registry.rs
@@ -1,9 +1,9 @@
use action_system::action_pool::ActionPool;
-use crate::actions::local_actions::register_hello_world_action;
+use crate::actions::local_actions::register_set_upstream_vault_action;
pub fn server_action_pool() -> ActionPool {
let mut pool = ActionPool::new();
- register_hello_world_action(&mut pool);
+ register_set_upstream_vault_action(&mut pool);
pool
}
diff --git a/crates/vcs_data/src/data/local.rs b/crates/vcs_data/src/data/local.rs
index 1c99832..c93bd2b 100644
--- a/crates/vcs_data/src/data/local.rs
+++ b/crates/vcs_data/src/data/local.rs
@@ -93,7 +93,7 @@ Without these credentials, the server will reject all access requests.
}
/// Setup local workspace in current directory
- pub async fn setup_local_workspacecurrent_dir() -> Result<(), std::io::Error> {
+ pub async fn setup_local_workspace_current_dir() -> Result<(), std::io::Error> {
Self::setup_local_workspace(current_dir()?).await?;
Ok(())
}