From 8ee5a69013bfbc65673f66e661b4cb1d40e15f55 Mon Sep 17 00:00:00 2001 From: obaraelijah <elijahobara357@gmail.com> Date: Sun, 28 Jul 2024 12:57:12 +0300 Subject: [PATCH] chore: Remove scripting --- src/misc.rs | 19 ++----------------- src/server.rs | 14 +++++--------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/misc.rs b/src/misc.rs index 8db155a..b7f0b90 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -72,7 +72,6 @@ pub async fn misc_interact( misc_op: MiscOps, state: &mut StateRef, state_store: StateStoreRef, - scripting_bridge: Arc<ScriptingBridge>, ) -> ReturnValue { match misc_op { MiscOps::Pong() => ReturnValue::StringRes(Value::from_static(b"PONG")), @@ -123,21 +122,7 @@ pub async fn misc_interact( .join("\r\n"); ReturnValue::StringRes(info.into()) } - MiscOps::Script(program) => { - let prog_str = String::from_utf8_lossy(&program).to_string(); - let res = scripting_bridge - .handle_script_cmd(Program::String(prog_str)) - .await; - ReturnValue::Ident(res) - } - MiscOps::EmbeddedScript(fn_name, fn_args) => { - // We need to send the program over the scripting bridge - // and wait for the result - let fn_name = String::from_utf8_lossy(&fn_name).to_string(); - let res = scripting_bridge - .handle_script_cmd(Program::Function(fn_name, fn_args)) - .await; - ReturnValue::Ident(res) - } + MiscOps::Script(_) => todo!(), + MiscOps::EmbeddedScript(_, _) => todo!(), } } diff --git a/src/server.rs b/src/server.rs index c242a48..f359c58 100644 --- a/src/server.rs +++ b/src/server.rs @@ -2,7 +2,7 @@ use crate::database::save_state; use crate::misc::misc_interact; use crate::ops::{op_interact, Ops}; /// Server launch file. Starts the services to make redis-proto work. -use crate::{asyncresp::RespParser, scripting::ScriptingBridge}; +use crate::asyncresp::RespParser; use crate::{logger::LOGGER, types::StateRef}; use crate::{ ops::translate, @@ -38,7 +38,6 @@ pub async fn process_command( state: &mut StateRef, state_store: StateStoreRef, dump_file: Dumpfile, - scripting_bridge: Arc<ScriptingBridge>, redis_value: RedisValueRef, ) -> RedisValueRef { match translate(redis_value, state_store.clone()) { @@ -47,7 +46,7 @@ pub async fn process_command( // Step 1: Execute the operation the operation (from translate above) let res: ReturnValue = match op { Ops::Misc(op) => { - misc_interact(op, state, state_store.clone(), scripting_bridge.clone()).await + misc_interact(op, state, state_store.clone()), } _ => op_interact(op, state.clone()).await, }; @@ -71,7 +70,6 @@ async fn process( socket: TcpStream, state_store: StateStoreRef, dump_file: Dumpfile, - scripting_bridge: Arc<ScriptingBridge>, ) { tokio::spawn(async move { let mut state = state_store.get_default(); @@ -85,8 +83,7 @@ async fn process( &mut state, state_store.clone(), dump_file.clone(), - scripting_bridge.clone(), - redis_value.unwrap(), + redis_value.unwrap(), ) .await; // let res = match translate(redis_value.unwrap()) { @@ -99,7 +96,7 @@ async fn process( // op, // &mut state, // state_store.clone(), - // scripting_bridge.clone(), + // // ) // .await // } @@ -126,7 +123,6 @@ pub async fn socket_listener( state_store: StateStoreRef, dump_file: Dumpfile, config: Config, - scripting_bridge: Arc<ScriptingBridge>, ) { // First, get the address determined and parsed. let addr_str = format!("{}:{}", "127.0.0.1", config.port); @@ -167,7 +163,7 @@ pub async fn socket_listener( socket, state_store.clone(), dump_file.clone(), - scripting_bridge.clone(), + ) .await; }