diff --git a/glide-core/benches/rotating_buffer_benchmark.rs b/glide-core/benches/rotating_buffer_benchmark.rs index 581a278453..224d1b702b 100644 --- a/glide-core/benches/rotating_buffer_benchmark.rs +++ b/glide-core/benches/rotating_buffer_benchmark.rs @@ -6,8 +6,8 @@ use std::io::Write; use bytes::BufMut; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use glide_core::{ - redis_request::{command, redis_request}, - redis_request::{Command, RedisRequest, RequestType}, + command_request::{command, command_request}, + command_request::{Command, CommandRequest, RequestType}, rotating_buffer::RotatingBuffer, }; use integer_encoding::VarInt; @@ -118,7 +118,7 @@ fn write_length(buffer: &mut Vec, length: u32) { u32::encode_var(length, &mut buffer[new_len - required_space..]); } -fn message_buffer(request: RedisRequest) -> Vec { +fn message_buffer(request: CommandRequest) -> Vec { let message_length = request.compute_size() as usize; let mut buffer = Vec::with_capacity(message_length); write_length(&mut buffer, message_length as u32); @@ -164,8 +164,8 @@ fn split_data() -> Vec> { vec![vec, vec1, vec2] } -fn create_request(args: Vec, args_pointer: bool) -> RedisRequest { - let mut request = RedisRequest::new(); +fn create_request(args: Vec, args_pointer: bool) -> CommandRequest { + let mut request = CommandRequest::new(); request.callback_idx = 1; let mut command = Command::new(); command.request_type = RequestType::CustomCommand.into(); @@ -178,15 +178,15 @@ fn create_request(args: Vec, args_pointer: bool) -> RedisRequest { args_array.args = args; command.args = Some(command::Args::ArgsArray(args_array)); } - request.command = Some(redis_request::Command::SingleCommand(command)); + request.command = Some(command_request::Command::SingleCommand(command)); request } -fn short_request() -> RedisRequest { +fn short_request() -> CommandRequest { create_request(vec!["GET".into(), "goo".into(), "bar".into()], false) } -fn medium_request() -> RedisRequest { +fn medium_request() -> CommandRequest { create_request( vec![ "GET".into(), @@ -197,7 +197,7 @@ fn medium_request() -> RedisRequest { ) } -fn long_request(args_pointer: bool) -> RedisRequest { +fn long_request(args_pointer: bool) -> CommandRequest { create_request( vec![ "GET".into(), @@ -215,7 +215,7 @@ macro_rules! run_bench { $test_name($c, "rotating_buffer", |test_data: &Vec>| { for data in test_data { $rotating_buffer.current_buffer().put(&data[..]); - $rotating_buffer.get_requests::().unwrap(); + $rotating_buffer.get_requests::().unwrap(); } $rotating_buffer.current_buffer().clear() }); diff --git a/glide-core/build.rs b/glide-core/build.rs index a20b5dadea..cd838c9a53 100644 --- a/glide-core/build.rs +++ b/glide-core/build.rs @@ -11,7 +11,7 @@ fn build_protobuf() { protobuf_codegen::Codegen::new() .cargo_out_dir("protobuf") .include("src") - .input("src/protobuf/redis_request.proto") + .input("src/protobuf/command_request.proto") .input("src/protobuf/response.proto") .input("src/protobuf/connection_request.proto") .customize(customization_options) diff --git a/glide-core/src/protobuf/redis_request.proto b/glide-core/src/protobuf/command_request.proto similarity index 99% rename from glide-core/src/protobuf/redis_request.proto rename to glide-core/src/protobuf/command_request.proto index 3648469f3f..dfa8231988 100644 --- a/glide-core/src/protobuf/redis_request.proto +++ b/glide-core/src/protobuf/command_request.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package redis_request; +package command_request; enum SimpleRoutes { AllNodes=0; @@ -286,7 +286,7 @@ message ClusterScan { optional string object_type = 4; } -message RedisRequest { +message CommandRequest { uint32 callback_idx = 1; oneof command { diff --git a/glide-core/src/request_type.rs b/glide-core/src/request_type.rs index 960bcbb8ff..cd511f73a2 100644 --- a/glide-core/src/request_type.rs +++ b/glide-core/src/request_type.rs @@ -4,7 +4,7 @@ use redis::{cmd, Cmd}; #[cfg(feature = "socket-layer")] -use crate::redis_request::RequestType as ProtobufRequestType; +use crate::command_request::RequestType as ProtobufRequestType; #[repr(C)] #[derive(Debug)] diff --git a/glide-core/src/rotating_buffer.rs b/glide-core/src/rotating_buffer.rs index cbd32313ed..b87f666605 100644 --- a/glide-core/src/rotating_buffer.rs +++ b/glide-core/src/rotating_buffer.rs @@ -65,8 +65,8 @@ impl RotatingBuffer { #[cfg(test)] mod tests { use super::*; - use crate::redis_request::{command, redis_request}; - use crate::redis_request::{Command, RedisRequest, RequestType}; + use crate::command_request::{command, command_request}; + use crate::command_request::{Command, CommandRequest, RequestType}; use bytes::BufMut; use rand::{distributions::Alphanumeric, Rng}; use rstest::rstest; @@ -83,8 +83,8 @@ mod tests { args: Vec, request_type: RequestType, args_pointer: bool, - ) -> RedisRequest { - let mut request = RedisRequest::new(); + ) -> CommandRequest { + let mut request = CommandRequest::new(); request.callback_idx = callback_index; let mut command = Command::new(); command.request_type = request_type.into(); @@ -97,7 +97,7 @@ mod tests { args_array.args.clone_from(&args); command.args = Some(command::Args::ArgsArray(args_array)); } - request.command = Some(redis_request::Command::SingleCommand(command)); + request.command = Some(command_request::Command::SingleCommand(command)); request } @@ -141,14 +141,14 @@ mod tests { } fn assert_request( - request: &RedisRequest, + request: &CommandRequest, expected_type: RequestType, expected_index: u32, expected_args: Vec, args_pointer: bool, ) { assert_eq!(request.callback_idx, expected_index); - let Some(redis_request::Command::SingleCommand(ref command)) = request.command else { + let Some(command_request::Command::SingleCommand(ref command)) = request.command else { panic!("expected single command"); }; assert_eq!(command.request_type, expected_type.into()); @@ -312,7 +312,7 @@ mod tests { let required_varint_length = u32::required_space(KEY_LENGTH as u32); assert!(required_varint_length > 1); // so we could split the write of the varint buffer.extend_from_slice(&request_bytes[..NUM_OF_LENGTH_BYTES]); - let requests = rotating_buffer.get_requests::().unwrap(); + let requests = rotating_buffer.get_requests::().unwrap(); assert_eq!(requests.len(), 0); let buffer = rotating_buffer.current_buffer(); buffer.extend_from_slice(&request_bytes[NUM_OF_LENGTH_BYTES..]); diff --git a/glide-core/src/socket_listener.rs b/glide-core/src/socket_listener.rs index bce4c8bf6c..a648e45bd9 100644 --- a/glide-core/src/socket_listener.rs +++ b/glide-core/src/socket_listener.rs @@ -3,12 +3,12 @@ */ use super::rotating_buffer::RotatingBuffer; use crate::client::Client; -use crate::cluster_scan_container::get_cluster_scan_cursor; +use crate::command_request::{ + command, command_request, Command, CommandRequest, Routes, ScriptInvocation, SlotTypes, + Transaction, +}; use crate::connection_request::ConnectionRequest; use crate::errors::{error_message, error_type, RequestErrorType}; -use crate::redis_request::{ - command, redis_request, ClusterScan, Command, RedisRequest, Routes, SlotTypes, Transaction, -}; use crate::response; use crate::response::Response; use crate::retry_strategies::get_fixed_interval_backoff; @@ -416,7 +416,7 @@ fn get_route( route: Option>, cmd: Option<&Cmd>, ) -> ClientUsageResult> { - use crate::redis_request::routes::Value; + use crate::command_request::routes::Value; let Some(route) = route.and_then(|route| route.value) else { return Ok(None); }; @@ -432,17 +432,16 @@ fn get_route( ClientUsageError::Internal(format!("Received unexpected simple route type {id}")) })?; match simple_route { - crate::redis_request::SimpleRoutes::AllNodes => Ok(Some(RoutingInfo::MultiNode(( - MultipleNodeRoutingInfo::AllNodes, - get_response_policy(cmd), - )))), - crate::redis_request::SimpleRoutes::AllPrimaries => { + crate::command_request::SimpleRoutes::AllNodes => Ok(Some(RoutingInfo::MultiNode( + (MultipleNodeRoutingInfo::AllNodes, get_response_policy(cmd)), + ))), + crate::command_request::SimpleRoutes::AllPrimaries => { Ok(Some(RoutingInfo::MultiNode(( MultipleNodeRoutingInfo::AllMasters, get_response_policy(cmd), )))) } - crate::redis_request::SimpleRoutes::Random => { + crate::command_request::SimpleRoutes::Random => { Ok(Some(RoutingInfo::SingleNode(SingleNodeRoutingInfo::Random))) } } @@ -474,14 +473,11 @@ fn get_route( } } -fn handle_request(request: RedisRequest, client: Client, writer: Rc) { +fn handle_request(request: CommandRequest, client: Client, writer: Rc) { task::spawn_local(async move { let result = match request.command { Some(action) => match action { - redis_request::Command::ClusterScan(cluster_scan_command) => { - cluster_scan(cluster_scan_command, client).await - } - redis_request::Command::SingleCommand(command) => { + command_request::Command::SingleCommand(command) => { match get_redis_command(&command) { Ok(cmd) => match get_route(request.route.0, Some(&cmd)) { Ok(routes) => send_command(cmd, client, routes).await, @@ -490,13 +486,13 @@ fn handle_request(request: RedisRequest, client: Client, writer: Rc) { Err(e) => Err(e), } } - redis_request::Command::Transaction(transaction) => { + command_request::Command::Transaction(transaction) => { match get_route(request.route.0, None) { Ok(routes) => send_transaction(transaction, client, routes).await, Err(e) => Err(e), } } - redis_request::Command::ScriptInvocation(script) => { + command_request::Command::ScriptInvocation(script) => { match get_route(request.route.0, None) { Ok(routes) => { invoke_script( @@ -511,7 +507,7 @@ fn handle_request(request: RedisRequest, client: Client, writer: Rc) { Err(e) => Err(e), } } - redis_request::Command::ScriptInvocationPointers(script) => { + command_request::Command::ScriptInvocationPointers(script) => { let keys = script .keys_pointer .map(|pointer| *unsafe { Box::from_raw(pointer as *mut Vec) }); @@ -543,7 +539,7 @@ fn handle_request(request: RedisRequest, client: Client, writer: Rc) { } async fn handle_requests( - received_requests: Vec, + received_requests: Vec, client: &Client, writer: &Rc, ) { diff --git a/glide-core/tests/test_socket_listener.rs b/glide-core/tests/test_socket_listener.rs index fee76b7c16..d538a28a14 100644 --- a/glide-core/tests/test_socket_listener.rs +++ b/glide-core/tests/test_socket_listener.rs @@ -22,13 +22,13 @@ mod socket_listener { use crate::utilities::mocks::{Mock, ServerMock}; use super::*; - use glide_core::redis_request::command::{Args, ArgsArray}; - use glide_core::redis_request::{Command, Transaction}; + use command_request::{CommandRequest, RequestType}; + use glide_core::command_request::command::{Args, ArgsArray}; + use glide_core::command_request::{Command, Transaction}; use glide_core::response::{response, ConstantResponse, Response}; use glide_core::scripts_container::add_script; use protobuf::{EnumOrUnknown, Message}; use redis::{Cmd, ConnectionAddr, FromRedisValue, Value}; - use redis_request::{RedisRequest, RequestType}; use rstest::rstest; use std::mem::size_of; use tokio::{net::UnixListener, runtime::Builder}; @@ -256,11 +256,11 @@ mod socket_listener { args: Vec, request_type: EnumOrUnknown, args_pointer: bool, - ) -> RedisRequest { - let mut request = RedisRequest::new(); + ) -> CommandRequest { + let mut request = CommandRequest::new(); request.callback_idx = callback_index; - request.command = Some(redis_request::redis_request::Command::SingleCommand( + request.command = Some(command_request::command_request::Command::SingleCommand( get_command(CommandComponents { args, request_type, @@ -270,7 +270,7 @@ mod socket_listener { request } - fn write_request(buffer: &mut Vec, socket: &mut UnixStream, request: RedisRequest) { + fn write_request(buffer: &mut Vec, socket: &mut UnixStream, request: CommandRequest) { write_message(buffer, request); socket.write_all(buffer).unwrap(); } @@ -294,7 +294,7 @@ mod socket_listener { callback_index: u32, commands_components: Vec, ) { - let mut request = RedisRequest::new(); + let mut request = CommandRequest::new(); request.callback_idx = callback_index; let mut transaction = Transaction::new(); transaction.commands.reserve(commands_components.len()); @@ -303,7 +303,7 @@ mod socket_listener { transaction.commands.push(get_command(components)); } - request.command = Some(redis_request::redis_request::Command::Transaction( + request.command = Some(command_request::command_request::Command::Transaction( transaction, )); @@ -685,8 +685,8 @@ mod socket_listener { RequestType::CustomCommand.into(), false, ); - let mut routes = redis_request::Routes::default(); - routes.set_simple_routes(redis_request::SimpleRoutes::AllPrimaries); + let mut routes = command_request::Routes::default(); + routes.set_simple_routes(command_request::SimpleRoutes::AllPrimaries); request.route = Some(routes).into(); write_request(&mut buffer, &mut test_basics.socket, request); @@ -733,8 +733,8 @@ mod socket_listener { RequestType::CustomCommand.into(), false, ); - let mut routes = redis_request::Routes::default(); - routes.set_simple_routes(redis_request::SimpleRoutes::Random); + let mut routes = command_request::Routes::default(); + routes.set_simple_routes(command_request::SimpleRoutes::Random); request.route = Some(routes).into(); write_request(&mut buffer, &mut test_basics.socket, request.clone()); @@ -755,8 +755,8 @@ mod socket_listener { .unwrap(); buffer.clear(); - let mut routes = redis_request::Routes::default(); - let by_address_route = glide_core::redis_request::ByAddressRoute { + let mut routes = command_request::Routes::default(); + let by_address_route = glide_core::command_request::ByAddressRoute { host: host.into(), port, ..Default::default() @@ -1216,10 +1216,10 @@ mod socket_listener { let approx_message_length = hash.len() + value.len() + key.len() + APPROX_RESP_HEADER_LEN; let mut buffer = Vec::with_capacity(approx_message_length); - let mut request = RedisRequest::new(); + let mut request = CommandRequest::new(); request.callback_idx = CALLBACK_INDEX; - request.command = Some(redis_request::redis_request::Command::ScriptInvocation( - redis_request::ScriptInvocation { + request.command = Some(command_request::command_request::Command::ScriptInvocation( + command_request::ScriptInvocation { hash: hash.into(), keys: vec![key.into()], args: vec![value.clone().into()], diff --git a/go/Makefile b/go/Makefile index 160eaa394b..0400e849f5 100644 --- a/go/Makefile +++ b/go/Makefile @@ -34,7 +34,7 @@ generate-protobuf: mkdir -p protobuf protoc --proto_path=../glide-core/src/protobuf \ --go_opt=Mconnection_request.proto=github.com/aws/glide-for-redis/go/protobuf \ - --go_opt=Mredis_request.proto=github.com/aws/glide-for-redis/go/protobuf \ + --go_opt=Mcommand_request.proto=github.com/aws/glide-for-redis/go/protobuf \ --go_opt=Mresponse.proto=github.com/aws/glide-for-redis/go/protobuf \ --go_out=./protobuf \ --go_opt=paths=source_relative \ diff --git a/java/DEVELOPER.md b/java/DEVELOPER.md index 8f3ba443d3..f7e78ef8e5 100644 --- a/java/DEVELOPER.md +++ b/java/DEVELOPER.md @@ -213,7 +213,7 @@ A redis command can either have a standalone or cluster implementation which is - A cluster command will require a note to indicate a node will follow a specific routing. Refer to https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec for more details on how hash slots work for cluster commands. -When you start implementing a new command, check the [redis_request.proto](https://github.com/aws/glide-for-redis/blob/main/glide-core/src/protobuf/redis_request.proto) and [request_type.rs](https://github.com/aws/glide-for-redis/blob/main/glide-core/src/request_type.rs) files to see whether the command has already been implemented in another language such as Python or Node.js. +When you start implementing a new command, check the [command_request.proto](https://github.com/aws/glide-for-redis/blob/main/glide-core/src/protobuf/command_request.proto) and [request_type.rs](https://github.com/aws/glide-for-redis/blob/main/glide-core/src/request_type.rs) files to see whether the command has already been implemented in another language such as Python or Node.js. Standalone and cluster clients both extend [BaseClient.java](https://github.com/aws/glide-for-redis/blob/main/java/client/src/main/java/glide/api/BaseClient.java) and implement methods from the interfaces listed in `java/client/src/main/java/glide/api/commands`. The return types of these methods are in the form of a `CompletableFuture`, which fulfill the purpose of the asynchronous features of the program. diff --git a/java/client/build.gradle b/java/client/build.gradle index 6fa657d654..ba01cd58d1 100644 --- a/java/client/build.gradle +++ b/java/client/build.gradle @@ -71,7 +71,7 @@ tasks.register('protobuf', Exec) { '-Iprotobuf=glide-core/src/protobuf/', '--java_out=java/client/src/main/java/glide/models/protobuf', 'glide-core/src/protobuf/connection_request.proto', - 'glide-core/src/protobuf/redis_request.proto', + 'glide-core/src/protobuf/command_request.proto', 'glide-core/src/protobuf/response.proto' workingDir Paths.get(project.rootDir.path, '..').toFile() } diff --git a/java/client/src/main/java/glide/api/BaseClient.java b/java/client/src/main/java/glide/api/BaseClient.java index cccf184a3e..5632f6cf46 100644 --- a/java/client/src/main/java/glide/api/BaseClient.java +++ b/java/client/src/main/java/glide/api/BaseClient.java @@ -1,6 +1,171 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api; +import static command_request.CommandRequestOuterClass.RequestType.Append; +import static command_request.CommandRequestOuterClass.RequestType.BLMPop; +import static command_request.CommandRequestOuterClass.RequestType.BLMove; +import static command_request.CommandRequestOuterClass.RequestType.BLPop; +import static command_request.CommandRequestOuterClass.RequestType.BRPop; +import static command_request.CommandRequestOuterClass.RequestType.BZMPop; +import static command_request.CommandRequestOuterClass.RequestType.BZPopMax; +import static command_request.CommandRequestOuterClass.RequestType.BZPopMin; +import static command_request.CommandRequestOuterClass.RequestType.BitCount; +import static command_request.CommandRequestOuterClass.RequestType.BitField; +import static command_request.CommandRequestOuterClass.RequestType.BitFieldReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.BitOp; +import static command_request.CommandRequestOuterClass.RequestType.BitPos; +import static command_request.CommandRequestOuterClass.RequestType.Copy; +import static command_request.CommandRequestOuterClass.RequestType.Decr; +import static command_request.CommandRequestOuterClass.RequestType.DecrBy; +import static command_request.CommandRequestOuterClass.RequestType.Del; +import static command_request.CommandRequestOuterClass.RequestType.Dump; +import static command_request.CommandRequestOuterClass.RequestType.Exists; +import static command_request.CommandRequestOuterClass.RequestType.Expire; +import static command_request.CommandRequestOuterClass.RequestType.ExpireAt; +import static command_request.CommandRequestOuterClass.RequestType.ExpireTime; +import static command_request.CommandRequestOuterClass.RequestType.FCall; +import static command_request.CommandRequestOuterClass.RequestType.FCallReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.GeoAdd; +import static command_request.CommandRequestOuterClass.RequestType.GeoDist; +import static command_request.CommandRequestOuterClass.RequestType.GeoHash; +import static command_request.CommandRequestOuterClass.RequestType.GeoPos; +import static command_request.CommandRequestOuterClass.RequestType.GeoSearch; +import static command_request.CommandRequestOuterClass.RequestType.GeoSearchStore; +import static command_request.CommandRequestOuterClass.RequestType.Get; +import static command_request.CommandRequestOuterClass.RequestType.GetBit; +import static command_request.CommandRequestOuterClass.RequestType.GetDel; +import static command_request.CommandRequestOuterClass.RequestType.GetEx; +import static command_request.CommandRequestOuterClass.RequestType.GetRange; +import static command_request.CommandRequestOuterClass.RequestType.HDel; +import static command_request.CommandRequestOuterClass.RequestType.HExists; +import static command_request.CommandRequestOuterClass.RequestType.HGet; +import static command_request.CommandRequestOuterClass.RequestType.HGetAll; +import static command_request.CommandRequestOuterClass.RequestType.HIncrBy; +import static command_request.CommandRequestOuterClass.RequestType.HIncrByFloat; +import static command_request.CommandRequestOuterClass.RequestType.HKeys; +import static command_request.CommandRequestOuterClass.RequestType.HLen; +import static command_request.CommandRequestOuterClass.RequestType.HMGet; +import static command_request.CommandRequestOuterClass.RequestType.HRandField; +import static command_request.CommandRequestOuterClass.RequestType.HScan; +import static command_request.CommandRequestOuterClass.RequestType.HSet; +import static command_request.CommandRequestOuterClass.RequestType.HSetNX; +import static command_request.CommandRequestOuterClass.RequestType.HStrlen; +import static command_request.CommandRequestOuterClass.RequestType.HVals; +import static command_request.CommandRequestOuterClass.RequestType.Incr; +import static command_request.CommandRequestOuterClass.RequestType.IncrBy; +import static command_request.CommandRequestOuterClass.RequestType.IncrByFloat; +import static command_request.CommandRequestOuterClass.RequestType.LCS; +import static command_request.CommandRequestOuterClass.RequestType.LIndex; +import static command_request.CommandRequestOuterClass.RequestType.LInsert; +import static command_request.CommandRequestOuterClass.RequestType.LLen; +import static command_request.CommandRequestOuterClass.RequestType.LMPop; +import static command_request.CommandRequestOuterClass.RequestType.LMove; +import static command_request.CommandRequestOuterClass.RequestType.LPop; +import static command_request.CommandRequestOuterClass.RequestType.LPos; +import static command_request.CommandRequestOuterClass.RequestType.LPush; +import static command_request.CommandRequestOuterClass.RequestType.LPushX; +import static command_request.CommandRequestOuterClass.RequestType.LRange; +import static command_request.CommandRequestOuterClass.RequestType.LRem; +import static command_request.CommandRequestOuterClass.RequestType.LSet; +import static command_request.CommandRequestOuterClass.RequestType.LTrim; +import static command_request.CommandRequestOuterClass.RequestType.MGet; +import static command_request.CommandRequestOuterClass.RequestType.MSet; +import static command_request.CommandRequestOuterClass.RequestType.MSetNX; +import static command_request.CommandRequestOuterClass.RequestType.ObjectEncoding; +import static command_request.CommandRequestOuterClass.RequestType.ObjectFreq; +import static command_request.CommandRequestOuterClass.RequestType.ObjectIdleTime; +import static command_request.CommandRequestOuterClass.RequestType.ObjectRefCount; +import static command_request.CommandRequestOuterClass.RequestType.PExpire; +import static command_request.CommandRequestOuterClass.RequestType.PExpireAt; +import static command_request.CommandRequestOuterClass.RequestType.PExpireTime; +import static command_request.CommandRequestOuterClass.RequestType.PTTL; +import static command_request.CommandRequestOuterClass.RequestType.Persist; +import static command_request.CommandRequestOuterClass.RequestType.PfAdd; +import static command_request.CommandRequestOuterClass.RequestType.PfCount; +import static command_request.CommandRequestOuterClass.RequestType.PfMerge; +import static command_request.CommandRequestOuterClass.RequestType.Publish; +import static command_request.CommandRequestOuterClass.RequestType.RPop; +import static command_request.CommandRequestOuterClass.RequestType.RPush; +import static command_request.CommandRequestOuterClass.RequestType.RPushX; +import static command_request.CommandRequestOuterClass.RequestType.Rename; +import static command_request.CommandRequestOuterClass.RequestType.RenameNX; +import static command_request.CommandRequestOuterClass.RequestType.Restore; +import static command_request.CommandRequestOuterClass.RequestType.SAdd; +import static command_request.CommandRequestOuterClass.RequestType.SCard; +import static command_request.CommandRequestOuterClass.RequestType.SDiff; +import static command_request.CommandRequestOuterClass.RequestType.SDiffStore; +import static command_request.CommandRequestOuterClass.RequestType.SInter; +import static command_request.CommandRequestOuterClass.RequestType.SInterCard; +import static command_request.CommandRequestOuterClass.RequestType.SInterStore; +import static command_request.CommandRequestOuterClass.RequestType.SIsMember; +import static command_request.CommandRequestOuterClass.RequestType.SMIsMember; +import static command_request.CommandRequestOuterClass.RequestType.SMembers; +import static command_request.CommandRequestOuterClass.RequestType.SMove; +import static command_request.CommandRequestOuterClass.RequestType.SPop; +import static command_request.CommandRequestOuterClass.RequestType.SRandMember; +import static command_request.CommandRequestOuterClass.RequestType.SRem; +import static command_request.CommandRequestOuterClass.RequestType.SScan; +import static command_request.CommandRequestOuterClass.RequestType.SUnion; +import static command_request.CommandRequestOuterClass.RequestType.SUnionStore; +import static command_request.CommandRequestOuterClass.RequestType.Set; +import static command_request.CommandRequestOuterClass.RequestType.SetBit; +import static command_request.CommandRequestOuterClass.RequestType.SetRange; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.Strlen; +import static command_request.CommandRequestOuterClass.RequestType.TTL; +import static command_request.CommandRequestOuterClass.RequestType.Touch; +import static command_request.CommandRequestOuterClass.RequestType.Type; +import static command_request.CommandRequestOuterClass.RequestType.Unlink; +import static command_request.CommandRequestOuterClass.RequestType.Wait; +import static command_request.CommandRequestOuterClass.RequestType.Watch; +import static command_request.CommandRequestOuterClass.RequestType.XAck; +import static command_request.CommandRequestOuterClass.RequestType.XAdd; +import static command_request.CommandRequestOuterClass.RequestType.XAutoClaim; +import static command_request.CommandRequestOuterClass.RequestType.XClaim; +import static command_request.CommandRequestOuterClass.RequestType.XDel; +import static command_request.CommandRequestOuterClass.RequestType.XGroupCreate; +import static command_request.CommandRequestOuterClass.RequestType.XGroupCreateConsumer; +import static command_request.CommandRequestOuterClass.RequestType.XGroupDelConsumer; +import static command_request.CommandRequestOuterClass.RequestType.XGroupDestroy; +import static command_request.CommandRequestOuterClass.RequestType.XGroupSetId; +import static command_request.CommandRequestOuterClass.RequestType.XInfoConsumers; +import static command_request.CommandRequestOuterClass.RequestType.XInfoGroups; +import static command_request.CommandRequestOuterClass.RequestType.XInfoStream; +import static command_request.CommandRequestOuterClass.RequestType.XLen; +import static command_request.CommandRequestOuterClass.RequestType.XPending; +import static command_request.CommandRequestOuterClass.RequestType.XRange; +import static command_request.CommandRequestOuterClass.RequestType.XRead; +import static command_request.CommandRequestOuterClass.RequestType.XReadGroup; +import static command_request.CommandRequestOuterClass.RequestType.XRevRange; +import static command_request.CommandRequestOuterClass.RequestType.XTrim; +import static command_request.CommandRequestOuterClass.RequestType.ZAdd; +import static command_request.CommandRequestOuterClass.RequestType.ZCard; +import static command_request.CommandRequestOuterClass.RequestType.ZCount; +import static command_request.CommandRequestOuterClass.RequestType.ZDiff; +import static command_request.CommandRequestOuterClass.RequestType.ZDiffStore; +import static command_request.CommandRequestOuterClass.RequestType.ZIncrBy; +import static command_request.CommandRequestOuterClass.RequestType.ZInter; +import static command_request.CommandRequestOuterClass.RequestType.ZInterCard; +import static command_request.CommandRequestOuterClass.RequestType.ZInterStore; +import static command_request.CommandRequestOuterClass.RequestType.ZLexCount; +import static command_request.CommandRequestOuterClass.RequestType.ZMPop; +import static command_request.CommandRequestOuterClass.RequestType.ZMScore; +import static command_request.CommandRequestOuterClass.RequestType.ZPopMax; +import static command_request.CommandRequestOuterClass.RequestType.ZPopMin; +import static command_request.CommandRequestOuterClass.RequestType.ZRandMember; +import static command_request.CommandRequestOuterClass.RequestType.ZRange; +import static command_request.CommandRequestOuterClass.RequestType.ZRangeStore; +import static command_request.CommandRequestOuterClass.RequestType.ZRank; +import static command_request.CommandRequestOuterClass.RequestType.ZRem; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByLex; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByRank; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByScore; +import static command_request.CommandRequestOuterClass.RequestType.ZRevRank; +import static command_request.CommandRequestOuterClass.RequestType.ZScan; +import static command_request.CommandRequestOuterClass.RequestType.ZScore; +import static command_request.CommandRequestOuterClass.RequestType.ZUnion; +import static command_request.CommandRequestOuterClass.RequestType.ZUnionStore; import static glide.api.models.GlideString.gs; import static glide.api.models.commands.SortBaseOptions.STORE_COMMAND_STRING; import static glide.api.models.commands.bitmap.BitFieldOptions.createBitFieldArgs; @@ -22,171 +187,6 @@ import static glide.utils.ArrayTransformUtils.convertMapToValueKeyStringArray; import static glide.utils.ArrayTransformUtils.mapGeoDataToArray; import static glide.utils.ArrayTransformUtils.mapGeoDataToGlideStringArray; -import static redis_request.RedisRequestOuterClass.RequestType.Append; -import static redis_request.RedisRequestOuterClass.RequestType.BLMPop; -import static redis_request.RedisRequestOuterClass.RequestType.BLMove; -import static redis_request.RedisRequestOuterClass.RequestType.BLPop; -import static redis_request.RedisRequestOuterClass.RequestType.BRPop; -import static redis_request.RedisRequestOuterClass.RequestType.BZMPop; -import static redis_request.RedisRequestOuterClass.RequestType.BZPopMax; -import static redis_request.RedisRequestOuterClass.RequestType.BZPopMin; -import static redis_request.RedisRequestOuterClass.RequestType.BitCount; -import static redis_request.RedisRequestOuterClass.RequestType.BitField; -import static redis_request.RedisRequestOuterClass.RequestType.BitFieldReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.BitOp; -import static redis_request.RedisRequestOuterClass.RequestType.BitPos; -import static redis_request.RedisRequestOuterClass.RequestType.Copy; -import static redis_request.RedisRequestOuterClass.RequestType.Decr; -import static redis_request.RedisRequestOuterClass.RequestType.DecrBy; -import static redis_request.RedisRequestOuterClass.RequestType.Del; -import static redis_request.RedisRequestOuterClass.RequestType.Dump; -import static redis_request.RedisRequestOuterClass.RequestType.Exists; -import static redis_request.RedisRequestOuterClass.RequestType.Expire; -import static redis_request.RedisRequestOuterClass.RequestType.ExpireAt; -import static redis_request.RedisRequestOuterClass.RequestType.ExpireTime; -import static redis_request.RedisRequestOuterClass.RequestType.FCall; -import static redis_request.RedisRequestOuterClass.RequestType.FCallReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.GeoAdd; -import static redis_request.RedisRequestOuterClass.RequestType.GeoDist; -import static redis_request.RedisRequestOuterClass.RequestType.GeoHash; -import static redis_request.RedisRequestOuterClass.RequestType.GeoPos; -import static redis_request.RedisRequestOuterClass.RequestType.GeoSearch; -import static redis_request.RedisRequestOuterClass.RequestType.GeoSearchStore; -import static redis_request.RedisRequestOuterClass.RequestType.Get; -import static redis_request.RedisRequestOuterClass.RequestType.GetBit; -import static redis_request.RedisRequestOuterClass.RequestType.GetDel; -import static redis_request.RedisRequestOuterClass.RequestType.GetEx; -import static redis_request.RedisRequestOuterClass.RequestType.GetRange; -import static redis_request.RedisRequestOuterClass.RequestType.HDel; -import static redis_request.RedisRequestOuterClass.RequestType.HExists; -import static redis_request.RedisRequestOuterClass.RequestType.HGet; -import static redis_request.RedisRequestOuterClass.RequestType.HGetAll; -import static redis_request.RedisRequestOuterClass.RequestType.HIncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.HIncrByFloat; -import static redis_request.RedisRequestOuterClass.RequestType.HKeys; -import static redis_request.RedisRequestOuterClass.RequestType.HLen; -import static redis_request.RedisRequestOuterClass.RequestType.HMGet; -import static redis_request.RedisRequestOuterClass.RequestType.HRandField; -import static redis_request.RedisRequestOuterClass.RequestType.HScan; -import static redis_request.RedisRequestOuterClass.RequestType.HSet; -import static redis_request.RedisRequestOuterClass.RequestType.HSetNX; -import static redis_request.RedisRequestOuterClass.RequestType.HStrlen; -import static redis_request.RedisRequestOuterClass.RequestType.HVals; -import static redis_request.RedisRequestOuterClass.RequestType.Incr; -import static redis_request.RedisRequestOuterClass.RequestType.IncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.IncrByFloat; -import static redis_request.RedisRequestOuterClass.RequestType.LCS; -import static redis_request.RedisRequestOuterClass.RequestType.LIndex; -import static redis_request.RedisRequestOuterClass.RequestType.LInsert; -import static redis_request.RedisRequestOuterClass.RequestType.LLen; -import static redis_request.RedisRequestOuterClass.RequestType.LMPop; -import static redis_request.RedisRequestOuterClass.RequestType.LMove; -import static redis_request.RedisRequestOuterClass.RequestType.LPop; -import static redis_request.RedisRequestOuterClass.RequestType.LPos; -import static redis_request.RedisRequestOuterClass.RequestType.LPush; -import static redis_request.RedisRequestOuterClass.RequestType.LPushX; -import static redis_request.RedisRequestOuterClass.RequestType.LRange; -import static redis_request.RedisRequestOuterClass.RequestType.LRem; -import static redis_request.RedisRequestOuterClass.RequestType.LSet; -import static redis_request.RedisRequestOuterClass.RequestType.LTrim; -import static redis_request.RedisRequestOuterClass.RequestType.MGet; -import static redis_request.RedisRequestOuterClass.RequestType.MSet; -import static redis_request.RedisRequestOuterClass.RequestType.MSetNX; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectEncoding; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectFreq; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectIdleTime; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectRefCount; -import static redis_request.RedisRequestOuterClass.RequestType.PExpire; -import static redis_request.RedisRequestOuterClass.RequestType.PExpireAt; -import static redis_request.RedisRequestOuterClass.RequestType.PExpireTime; -import static redis_request.RedisRequestOuterClass.RequestType.PTTL; -import static redis_request.RedisRequestOuterClass.RequestType.Persist; -import static redis_request.RedisRequestOuterClass.RequestType.PfAdd; -import static redis_request.RedisRequestOuterClass.RequestType.PfCount; -import static redis_request.RedisRequestOuterClass.RequestType.PfMerge; -import static redis_request.RedisRequestOuterClass.RequestType.Publish; -import static redis_request.RedisRequestOuterClass.RequestType.RPop; -import static redis_request.RedisRequestOuterClass.RequestType.RPush; -import static redis_request.RedisRequestOuterClass.RequestType.RPushX; -import static redis_request.RedisRequestOuterClass.RequestType.Rename; -import static redis_request.RedisRequestOuterClass.RequestType.RenameNX; -import static redis_request.RedisRequestOuterClass.RequestType.Restore; -import static redis_request.RedisRequestOuterClass.RequestType.SAdd; -import static redis_request.RedisRequestOuterClass.RequestType.SCard; -import static redis_request.RedisRequestOuterClass.RequestType.SDiff; -import static redis_request.RedisRequestOuterClass.RequestType.SDiffStore; -import static redis_request.RedisRequestOuterClass.RequestType.SInter; -import static redis_request.RedisRequestOuterClass.RequestType.SInterCard; -import static redis_request.RedisRequestOuterClass.RequestType.SInterStore; -import static redis_request.RedisRequestOuterClass.RequestType.SIsMember; -import static redis_request.RedisRequestOuterClass.RequestType.SMIsMember; -import static redis_request.RedisRequestOuterClass.RequestType.SMembers; -import static redis_request.RedisRequestOuterClass.RequestType.SMove; -import static redis_request.RedisRequestOuterClass.RequestType.SPop; -import static redis_request.RedisRequestOuterClass.RequestType.SRandMember; -import static redis_request.RedisRequestOuterClass.RequestType.SRem; -import static redis_request.RedisRequestOuterClass.RequestType.SScan; -import static redis_request.RedisRequestOuterClass.RequestType.SUnion; -import static redis_request.RedisRequestOuterClass.RequestType.SUnionStore; -import static redis_request.RedisRequestOuterClass.RequestType.Set; -import static redis_request.RedisRequestOuterClass.RequestType.SetBit; -import static redis_request.RedisRequestOuterClass.RequestType.SetRange; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.Strlen; -import static redis_request.RedisRequestOuterClass.RequestType.TTL; -import static redis_request.RedisRequestOuterClass.RequestType.Touch; -import static redis_request.RedisRequestOuterClass.RequestType.Type; -import static redis_request.RedisRequestOuterClass.RequestType.Unlink; -import static redis_request.RedisRequestOuterClass.RequestType.Wait; -import static redis_request.RedisRequestOuterClass.RequestType.Watch; -import static redis_request.RedisRequestOuterClass.RequestType.XAck; -import static redis_request.RedisRequestOuterClass.RequestType.XAdd; -import static redis_request.RedisRequestOuterClass.RequestType.XAutoClaim; -import static redis_request.RedisRequestOuterClass.RequestType.XClaim; -import static redis_request.RedisRequestOuterClass.RequestType.XDel; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreate; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreateConsumer; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupDelConsumer; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupDestroy; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupSetId; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoConsumers; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoGroups; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoStream; -import static redis_request.RedisRequestOuterClass.RequestType.XLen; -import static redis_request.RedisRequestOuterClass.RequestType.XPending; -import static redis_request.RedisRequestOuterClass.RequestType.XRange; -import static redis_request.RedisRequestOuterClass.RequestType.XRead; -import static redis_request.RedisRequestOuterClass.RequestType.XReadGroup; -import static redis_request.RedisRequestOuterClass.RequestType.XRevRange; -import static redis_request.RedisRequestOuterClass.RequestType.XTrim; -import static redis_request.RedisRequestOuterClass.RequestType.ZAdd; -import static redis_request.RedisRequestOuterClass.RequestType.ZCard; -import static redis_request.RedisRequestOuterClass.RequestType.ZCount; -import static redis_request.RedisRequestOuterClass.RequestType.ZDiff; -import static redis_request.RedisRequestOuterClass.RequestType.ZDiffStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZIncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.ZInter; -import static redis_request.RedisRequestOuterClass.RequestType.ZInterCard; -import static redis_request.RedisRequestOuterClass.RequestType.ZInterStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZLexCount; -import static redis_request.RedisRequestOuterClass.RequestType.ZMPop; -import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; -import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; -import static redis_request.RedisRequestOuterClass.RequestType.ZRandMember; -import static redis_request.RedisRequestOuterClass.RequestType.ZRange; -import static redis_request.RedisRequestOuterClass.RequestType.ZRangeStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZRem; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByLex; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZRevRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZScan; -import static redis_request.RedisRequestOuterClass.RequestType.ZScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZUnion; -import static redis_request.RedisRequestOuterClass.RequestType.ZUnionStore; import glide.api.commands.BitmapBaseCommands; import glide.api.commands.GenericBaseCommands; diff --git a/java/client/src/main/java/glide/api/RedisClient.java b/java/client/src/main/java/glide/api/RedisClient.java index 593ca46b54..2460f1ee24 100644 --- a/java/client/src/main/java/glide/api/RedisClient.java +++ b/java/client/src/main/java/glide/api/RedisClient.java @@ -1,6 +1,38 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api; +import static command_request.CommandRequestOuterClass.RequestType.ClientGetName; +import static command_request.CommandRequestOuterClass.RequestType.ClientId; +import static command_request.CommandRequestOuterClass.RequestType.ConfigGet; +import static command_request.CommandRequestOuterClass.RequestType.ConfigResetStat; +import static command_request.CommandRequestOuterClass.RequestType.ConfigRewrite; +import static command_request.CommandRequestOuterClass.RequestType.ConfigSet; +import static command_request.CommandRequestOuterClass.RequestType.Copy; +import static command_request.CommandRequestOuterClass.RequestType.CustomCommand; +import static command_request.CommandRequestOuterClass.RequestType.DBSize; +import static command_request.CommandRequestOuterClass.RequestType.Echo; +import static command_request.CommandRequestOuterClass.RequestType.FlushAll; +import static command_request.CommandRequestOuterClass.RequestType.FlushDB; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDelete; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDump; +import static command_request.CommandRequestOuterClass.RequestType.FunctionFlush; +import static command_request.CommandRequestOuterClass.RequestType.FunctionKill; +import static command_request.CommandRequestOuterClass.RequestType.FunctionList; +import static command_request.CommandRequestOuterClass.RequestType.FunctionLoad; +import static command_request.CommandRequestOuterClass.RequestType.FunctionRestore; +import static command_request.CommandRequestOuterClass.RequestType.FunctionStats; +import static command_request.CommandRequestOuterClass.RequestType.Info; +import static command_request.CommandRequestOuterClass.RequestType.LastSave; +import static command_request.CommandRequestOuterClass.RequestType.Lolwut; +import static command_request.CommandRequestOuterClass.RequestType.Move; +import static command_request.CommandRequestOuterClass.RequestType.Ping; +import static command_request.CommandRequestOuterClass.RequestType.RandomKey; +import static command_request.CommandRequestOuterClass.RequestType.Scan; +import static command_request.CommandRequestOuterClass.RequestType.Select; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.Time; +import static command_request.CommandRequestOuterClass.RequestType.UnWatch; import static glide.api.models.GlideString.gs; import static glide.api.models.commands.SortBaseOptions.STORE_COMMAND_STRING; import static glide.api.models.commands.function.FunctionListOptions.LIBRARY_NAME_REDIS_API; @@ -9,38 +41,6 @@ import static glide.utils.ArrayTransformUtils.castArray; import static glide.utils.ArrayTransformUtils.concatenateArrays; import static glide.utils.ArrayTransformUtils.convertMapToKeyValueStringArray; -import static redis_request.RedisRequestOuterClass.RequestType.ClientGetName; -import static redis_request.RedisRequestOuterClass.RequestType.ClientId; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigGet; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigResetStat; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigRewrite; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigSet; -import static redis_request.RedisRequestOuterClass.RequestType.Copy; -import static redis_request.RedisRequestOuterClass.RequestType.CustomCommand; -import static redis_request.RedisRequestOuterClass.RequestType.DBSize; -import static redis_request.RedisRequestOuterClass.RequestType.Echo; -import static redis_request.RedisRequestOuterClass.RequestType.FlushAll; -import static redis_request.RedisRequestOuterClass.RequestType.FlushDB; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDelete; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDump; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionFlush; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionKill; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionList; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionLoad; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionRestore; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionStats; -import static redis_request.RedisRequestOuterClass.RequestType.Info; -import static redis_request.RedisRequestOuterClass.RequestType.LastSave; -import static redis_request.RedisRequestOuterClass.RequestType.Lolwut; -import static redis_request.RedisRequestOuterClass.RequestType.Move; -import static redis_request.RedisRequestOuterClass.RequestType.Ping; -import static redis_request.RedisRequestOuterClass.RequestType.RandomKey; -import static redis_request.RedisRequestOuterClass.RequestType.Scan; -import static redis_request.RedisRequestOuterClass.RequestType.Select; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.Time; -import static redis_request.RedisRequestOuterClass.RequestType.UnWatch; import glide.api.commands.ConnectionManagementCommands; import glide.api.commands.GenericCommands; diff --git a/java/client/src/main/java/glide/api/RedisClusterClient.java b/java/client/src/main/java/glide/api/RedisClusterClient.java index 049dff3ee6..2c68f06284 100644 --- a/java/client/src/main/java/glide/api/RedisClusterClient.java +++ b/java/client/src/main/java/glide/api/RedisClusterClient.java @@ -1,6 +1,37 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api; +import static command_request.CommandRequestOuterClass.RequestType.ClientGetName; +import static command_request.CommandRequestOuterClass.RequestType.ClientId; +import static command_request.CommandRequestOuterClass.RequestType.ConfigGet; +import static command_request.CommandRequestOuterClass.RequestType.ConfigResetStat; +import static command_request.CommandRequestOuterClass.RequestType.ConfigRewrite; +import static command_request.CommandRequestOuterClass.RequestType.ConfigSet; +import static command_request.CommandRequestOuterClass.RequestType.CustomCommand; +import static command_request.CommandRequestOuterClass.RequestType.DBSize; +import static command_request.CommandRequestOuterClass.RequestType.Echo; +import static command_request.CommandRequestOuterClass.RequestType.FCall; +import static command_request.CommandRequestOuterClass.RequestType.FCallReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.FlushAll; +import static command_request.CommandRequestOuterClass.RequestType.FlushDB; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDelete; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDump; +import static command_request.CommandRequestOuterClass.RequestType.FunctionFlush; +import static command_request.CommandRequestOuterClass.RequestType.FunctionKill; +import static command_request.CommandRequestOuterClass.RequestType.FunctionList; +import static command_request.CommandRequestOuterClass.RequestType.FunctionLoad; +import static command_request.CommandRequestOuterClass.RequestType.FunctionRestore; +import static command_request.CommandRequestOuterClass.RequestType.FunctionStats; +import static command_request.CommandRequestOuterClass.RequestType.Info; +import static command_request.CommandRequestOuterClass.RequestType.LastSave; +import static command_request.CommandRequestOuterClass.RequestType.Lolwut; +import static command_request.CommandRequestOuterClass.RequestType.Ping; +import static command_request.CommandRequestOuterClass.RequestType.RandomKey; +import static command_request.CommandRequestOuterClass.RequestType.SPublish; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.Time; +import static command_request.CommandRequestOuterClass.RequestType.UnWatch; import static glide.api.commands.ServerManagementCommands.VERSION_REDIS_API; import static glide.api.models.GlideString.gs; import static glide.api.models.commands.SortBaseOptions.STORE_COMMAND_STRING; @@ -11,37 +42,6 @@ import static glide.utils.ArrayTransformUtils.castMapOfArrays; import static glide.utils.ArrayTransformUtils.concatenateArrays; import static glide.utils.ArrayTransformUtils.convertMapToKeyValueStringArray; -import static redis_request.RedisRequestOuterClass.RequestType.ClientGetName; -import static redis_request.RedisRequestOuterClass.RequestType.ClientId; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigGet; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigResetStat; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigRewrite; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigSet; -import static redis_request.RedisRequestOuterClass.RequestType.CustomCommand; -import static redis_request.RedisRequestOuterClass.RequestType.DBSize; -import static redis_request.RedisRequestOuterClass.RequestType.Echo; -import static redis_request.RedisRequestOuterClass.RequestType.FCall; -import static redis_request.RedisRequestOuterClass.RequestType.FCallReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.FlushAll; -import static redis_request.RedisRequestOuterClass.RequestType.FlushDB; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDelete; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDump; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionFlush; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionKill; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionList; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionLoad; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionRestore; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionStats; -import static redis_request.RedisRequestOuterClass.RequestType.Info; -import static redis_request.RedisRequestOuterClass.RequestType.LastSave; -import static redis_request.RedisRequestOuterClass.RequestType.Lolwut; -import static redis_request.RedisRequestOuterClass.RequestType.Ping; -import static redis_request.RedisRequestOuterClass.RequestType.RandomKey; -import static redis_request.RedisRequestOuterClass.RequestType.SPublish; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.Time; -import static redis_request.RedisRequestOuterClass.RequestType.UnWatch; import glide.api.commands.ConnectionManagementClusterCommands; import glide.api.commands.GenericClusterCommands; diff --git a/java/client/src/main/java/glide/api/models/BaseTransaction.java b/java/client/src/main/java/glide/api/models/BaseTransaction.java index bdff1e42ae..d529af24d5 100644 --- a/java/client/src/main/java/glide/api/models/BaseTransaction.java +++ b/java/client/src/main/java/glide/api/models/BaseTransaction.java @@ -1,6 +1,194 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api.models; +import static command_request.CommandRequestOuterClass.RequestType.Append; +import static command_request.CommandRequestOuterClass.RequestType.BLMPop; +import static command_request.CommandRequestOuterClass.RequestType.BLMove; +import static command_request.CommandRequestOuterClass.RequestType.BLPop; +import static command_request.CommandRequestOuterClass.RequestType.BRPop; +import static command_request.CommandRequestOuterClass.RequestType.BZMPop; +import static command_request.CommandRequestOuterClass.RequestType.BZPopMax; +import static command_request.CommandRequestOuterClass.RequestType.BZPopMin; +import static command_request.CommandRequestOuterClass.RequestType.BitCount; +import static command_request.CommandRequestOuterClass.RequestType.BitField; +import static command_request.CommandRequestOuterClass.RequestType.BitFieldReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.BitOp; +import static command_request.CommandRequestOuterClass.RequestType.BitPos; +import static command_request.CommandRequestOuterClass.RequestType.ClientGetName; +import static command_request.CommandRequestOuterClass.RequestType.ClientId; +import static command_request.CommandRequestOuterClass.RequestType.ConfigGet; +import static command_request.CommandRequestOuterClass.RequestType.ConfigResetStat; +import static command_request.CommandRequestOuterClass.RequestType.ConfigRewrite; +import static command_request.CommandRequestOuterClass.RequestType.ConfigSet; +import static command_request.CommandRequestOuterClass.RequestType.Copy; +import static command_request.CommandRequestOuterClass.RequestType.CustomCommand; +import static command_request.CommandRequestOuterClass.RequestType.DBSize; +import static command_request.CommandRequestOuterClass.RequestType.Decr; +import static command_request.CommandRequestOuterClass.RequestType.DecrBy; +import static command_request.CommandRequestOuterClass.RequestType.Del; +import static command_request.CommandRequestOuterClass.RequestType.Dump; +import static command_request.CommandRequestOuterClass.RequestType.Echo; +import static command_request.CommandRequestOuterClass.RequestType.Exists; +import static command_request.CommandRequestOuterClass.RequestType.Expire; +import static command_request.CommandRequestOuterClass.RequestType.ExpireAt; +import static command_request.CommandRequestOuterClass.RequestType.ExpireTime; +import static command_request.CommandRequestOuterClass.RequestType.FCall; +import static command_request.CommandRequestOuterClass.RequestType.FCallReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.FlushAll; +import static command_request.CommandRequestOuterClass.RequestType.FlushDB; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDelete; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDump; +import static command_request.CommandRequestOuterClass.RequestType.FunctionFlush; +import static command_request.CommandRequestOuterClass.RequestType.FunctionList; +import static command_request.CommandRequestOuterClass.RequestType.FunctionLoad; +import static command_request.CommandRequestOuterClass.RequestType.FunctionRestore; +import static command_request.CommandRequestOuterClass.RequestType.FunctionStats; +import static command_request.CommandRequestOuterClass.RequestType.GeoAdd; +import static command_request.CommandRequestOuterClass.RequestType.GeoDist; +import static command_request.CommandRequestOuterClass.RequestType.GeoHash; +import static command_request.CommandRequestOuterClass.RequestType.GeoPos; +import static command_request.CommandRequestOuterClass.RequestType.GeoSearch; +import static command_request.CommandRequestOuterClass.RequestType.GeoSearchStore; +import static command_request.CommandRequestOuterClass.RequestType.Get; +import static command_request.CommandRequestOuterClass.RequestType.GetBit; +import static command_request.CommandRequestOuterClass.RequestType.GetDel; +import static command_request.CommandRequestOuterClass.RequestType.GetEx; +import static command_request.CommandRequestOuterClass.RequestType.GetRange; +import static command_request.CommandRequestOuterClass.RequestType.HDel; +import static command_request.CommandRequestOuterClass.RequestType.HExists; +import static command_request.CommandRequestOuterClass.RequestType.HGet; +import static command_request.CommandRequestOuterClass.RequestType.HGetAll; +import static command_request.CommandRequestOuterClass.RequestType.HIncrBy; +import static command_request.CommandRequestOuterClass.RequestType.HIncrByFloat; +import static command_request.CommandRequestOuterClass.RequestType.HKeys; +import static command_request.CommandRequestOuterClass.RequestType.HLen; +import static command_request.CommandRequestOuterClass.RequestType.HMGet; +import static command_request.CommandRequestOuterClass.RequestType.HRandField; +import static command_request.CommandRequestOuterClass.RequestType.HScan; +import static command_request.CommandRequestOuterClass.RequestType.HSet; +import static command_request.CommandRequestOuterClass.RequestType.HSetNX; +import static command_request.CommandRequestOuterClass.RequestType.HStrlen; +import static command_request.CommandRequestOuterClass.RequestType.HVals; +import static command_request.CommandRequestOuterClass.RequestType.Incr; +import static command_request.CommandRequestOuterClass.RequestType.IncrBy; +import static command_request.CommandRequestOuterClass.RequestType.IncrByFloat; +import static command_request.CommandRequestOuterClass.RequestType.Info; +import static command_request.CommandRequestOuterClass.RequestType.LCS; +import static command_request.CommandRequestOuterClass.RequestType.LIndex; +import static command_request.CommandRequestOuterClass.RequestType.LInsert; +import static command_request.CommandRequestOuterClass.RequestType.LLen; +import static command_request.CommandRequestOuterClass.RequestType.LMPop; +import static command_request.CommandRequestOuterClass.RequestType.LMove; +import static command_request.CommandRequestOuterClass.RequestType.LPop; +import static command_request.CommandRequestOuterClass.RequestType.LPos; +import static command_request.CommandRequestOuterClass.RequestType.LPush; +import static command_request.CommandRequestOuterClass.RequestType.LPushX; +import static command_request.CommandRequestOuterClass.RequestType.LRange; +import static command_request.CommandRequestOuterClass.RequestType.LRem; +import static command_request.CommandRequestOuterClass.RequestType.LSet; +import static command_request.CommandRequestOuterClass.RequestType.LTrim; +import static command_request.CommandRequestOuterClass.RequestType.LastSave; +import static command_request.CommandRequestOuterClass.RequestType.Lolwut; +import static command_request.CommandRequestOuterClass.RequestType.MGet; +import static command_request.CommandRequestOuterClass.RequestType.MSet; +import static command_request.CommandRequestOuterClass.RequestType.MSetNX; +import static command_request.CommandRequestOuterClass.RequestType.ObjectEncoding; +import static command_request.CommandRequestOuterClass.RequestType.ObjectFreq; +import static command_request.CommandRequestOuterClass.RequestType.ObjectIdleTime; +import static command_request.CommandRequestOuterClass.RequestType.ObjectRefCount; +import static command_request.CommandRequestOuterClass.RequestType.PExpire; +import static command_request.CommandRequestOuterClass.RequestType.PExpireAt; +import static command_request.CommandRequestOuterClass.RequestType.PExpireTime; +import static command_request.CommandRequestOuterClass.RequestType.PTTL; +import static command_request.CommandRequestOuterClass.RequestType.Persist; +import static command_request.CommandRequestOuterClass.RequestType.PfAdd; +import static command_request.CommandRequestOuterClass.RequestType.PfCount; +import static command_request.CommandRequestOuterClass.RequestType.PfMerge; +import static command_request.CommandRequestOuterClass.RequestType.Ping; +import static command_request.CommandRequestOuterClass.RequestType.Publish; +import static command_request.CommandRequestOuterClass.RequestType.RPop; +import static command_request.CommandRequestOuterClass.RequestType.RPush; +import static command_request.CommandRequestOuterClass.RequestType.RPushX; +import static command_request.CommandRequestOuterClass.RequestType.RandomKey; +import static command_request.CommandRequestOuterClass.RequestType.Rename; +import static command_request.CommandRequestOuterClass.RequestType.RenameNX; +import static command_request.CommandRequestOuterClass.RequestType.Restore; +import static command_request.CommandRequestOuterClass.RequestType.SAdd; +import static command_request.CommandRequestOuterClass.RequestType.SCard; +import static command_request.CommandRequestOuterClass.RequestType.SDiff; +import static command_request.CommandRequestOuterClass.RequestType.SDiffStore; +import static command_request.CommandRequestOuterClass.RequestType.SInter; +import static command_request.CommandRequestOuterClass.RequestType.SInterCard; +import static command_request.CommandRequestOuterClass.RequestType.SInterStore; +import static command_request.CommandRequestOuterClass.RequestType.SIsMember; +import static command_request.CommandRequestOuterClass.RequestType.SMIsMember; +import static command_request.CommandRequestOuterClass.RequestType.SMembers; +import static command_request.CommandRequestOuterClass.RequestType.SMove; +import static command_request.CommandRequestOuterClass.RequestType.SPop; +import static command_request.CommandRequestOuterClass.RequestType.SRandMember; +import static command_request.CommandRequestOuterClass.RequestType.SRem; +import static command_request.CommandRequestOuterClass.RequestType.SScan; +import static command_request.CommandRequestOuterClass.RequestType.SUnion; +import static command_request.CommandRequestOuterClass.RequestType.SUnionStore; +import static command_request.CommandRequestOuterClass.RequestType.Set; +import static command_request.CommandRequestOuterClass.RequestType.SetBit; +import static command_request.CommandRequestOuterClass.RequestType.SetRange; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.Strlen; +import static command_request.CommandRequestOuterClass.RequestType.TTL; +import static command_request.CommandRequestOuterClass.RequestType.Time; +import static command_request.CommandRequestOuterClass.RequestType.Touch; +import static command_request.CommandRequestOuterClass.RequestType.Type; +import static command_request.CommandRequestOuterClass.RequestType.Unlink; +import static command_request.CommandRequestOuterClass.RequestType.Wait; +import static command_request.CommandRequestOuterClass.RequestType.XAck; +import static command_request.CommandRequestOuterClass.RequestType.XAdd; +import static command_request.CommandRequestOuterClass.RequestType.XAutoClaim; +import static command_request.CommandRequestOuterClass.RequestType.XClaim; +import static command_request.CommandRequestOuterClass.RequestType.XDel; +import static command_request.CommandRequestOuterClass.RequestType.XGroupCreate; +import static command_request.CommandRequestOuterClass.RequestType.XGroupCreateConsumer; +import static command_request.CommandRequestOuterClass.RequestType.XGroupDelConsumer; +import static command_request.CommandRequestOuterClass.RequestType.XGroupDestroy; +import static command_request.CommandRequestOuterClass.RequestType.XGroupSetId; +import static command_request.CommandRequestOuterClass.RequestType.XInfoConsumers; +import static command_request.CommandRequestOuterClass.RequestType.XInfoGroups; +import static command_request.CommandRequestOuterClass.RequestType.XInfoStream; +import static command_request.CommandRequestOuterClass.RequestType.XLen; +import static command_request.CommandRequestOuterClass.RequestType.XPending; +import static command_request.CommandRequestOuterClass.RequestType.XRange; +import static command_request.CommandRequestOuterClass.RequestType.XRead; +import static command_request.CommandRequestOuterClass.RequestType.XReadGroup; +import static command_request.CommandRequestOuterClass.RequestType.XRevRange; +import static command_request.CommandRequestOuterClass.RequestType.XTrim; +import static command_request.CommandRequestOuterClass.RequestType.ZAdd; +import static command_request.CommandRequestOuterClass.RequestType.ZCard; +import static command_request.CommandRequestOuterClass.RequestType.ZCount; +import static command_request.CommandRequestOuterClass.RequestType.ZDiff; +import static command_request.CommandRequestOuterClass.RequestType.ZDiffStore; +import static command_request.CommandRequestOuterClass.RequestType.ZIncrBy; +import static command_request.CommandRequestOuterClass.RequestType.ZInter; +import static command_request.CommandRequestOuterClass.RequestType.ZInterCard; +import static command_request.CommandRequestOuterClass.RequestType.ZInterStore; +import static command_request.CommandRequestOuterClass.RequestType.ZLexCount; +import static command_request.CommandRequestOuterClass.RequestType.ZMPop; +import static command_request.CommandRequestOuterClass.RequestType.ZMScore; +import static command_request.CommandRequestOuterClass.RequestType.ZPopMax; +import static command_request.CommandRequestOuterClass.RequestType.ZPopMin; +import static command_request.CommandRequestOuterClass.RequestType.ZRandMember; +import static command_request.CommandRequestOuterClass.RequestType.ZRange; +import static command_request.CommandRequestOuterClass.RequestType.ZRangeStore; +import static command_request.CommandRequestOuterClass.RequestType.ZRank; +import static command_request.CommandRequestOuterClass.RequestType.ZRem; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByLex; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByRank; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByScore; +import static command_request.CommandRequestOuterClass.RequestType.ZRevRank; +import static command_request.CommandRequestOuterClass.RequestType.ZScan; +import static command_request.CommandRequestOuterClass.RequestType.ZScore; +import static command_request.CommandRequestOuterClass.RequestType.ZUnion; +import static command_request.CommandRequestOuterClass.RequestType.ZUnionStore; import static glide.api.commands.GenericBaseCommands.REPLACE_REDIS_API; import static glide.api.commands.HashBaseCommands.WITH_VALUES_REDIS_API; import static glide.api.commands.ListBaseCommands.COUNT_FOR_LIST_REDIS_API; @@ -28,195 +216,11 @@ import static glide.utils.ArrayTransformUtils.flattenMapToGlideStringArray; import static glide.utils.ArrayTransformUtils.flattenMapToGlideStringArrayValueFirst; import static glide.utils.ArrayTransformUtils.mapGeoDataToGlideStringArray; -import static redis_request.RedisRequestOuterClass.RequestType.Append; -import static redis_request.RedisRequestOuterClass.RequestType.BLMPop; -import static redis_request.RedisRequestOuterClass.RequestType.BLMove; -import static redis_request.RedisRequestOuterClass.RequestType.BLPop; -import static redis_request.RedisRequestOuterClass.RequestType.BRPop; -import static redis_request.RedisRequestOuterClass.RequestType.BZMPop; -import static redis_request.RedisRequestOuterClass.RequestType.BZPopMax; -import static redis_request.RedisRequestOuterClass.RequestType.BZPopMin; -import static redis_request.RedisRequestOuterClass.RequestType.BitCount; -import static redis_request.RedisRequestOuterClass.RequestType.BitField; -import static redis_request.RedisRequestOuterClass.RequestType.BitFieldReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.BitOp; -import static redis_request.RedisRequestOuterClass.RequestType.BitPos; -import static redis_request.RedisRequestOuterClass.RequestType.ClientGetName; -import static redis_request.RedisRequestOuterClass.RequestType.ClientId; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigGet; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigResetStat; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigRewrite; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigSet; -import static redis_request.RedisRequestOuterClass.RequestType.Copy; -import static redis_request.RedisRequestOuterClass.RequestType.CustomCommand; -import static redis_request.RedisRequestOuterClass.RequestType.DBSize; -import static redis_request.RedisRequestOuterClass.RequestType.Decr; -import static redis_request.RedisRequestOuterClass.RequestType.DecrBy; -import static redis_request.RedisRequestOuterClass.RequestType.Del; -import static redis_request.RedisRequestOuterClass.RequestType.Dump; -import static redis_request.RedisRequestOuterClass.RequestType.Echo; -import static redis_request.RedisRequestOuterClass.RequestType.Exists; -import static redis_request.RedisRequestOuterClass.RequestType.Expire; -import static redis_request.RedisRequestOuterClass.RequestType.ExpireAt; -import static redis_request.RedisRequestOuterClass.RequestType.ExpireTime; -import static redis_request.RedisRequestOuterClass.RequestType.FCall; -import static redis_request.RedisRequestOuterClass.RequestType.FCallReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.FlushAll; -import static redis_request.RedisRequestOuterClass.RequestType.FlushDB; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDelete; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDump; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionFlush; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionList; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionLoad; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionRestore; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionStats; -import static redis_request.RedisRequestOuterClass.RequestType.GeoAdd; -import static redis_request.RedisRequestOuterClass.RequestType.GeoDist; -import static redis_request.RedisRequestOuterClass.RequestType.GeoHash; -import static redis_request.RedisRequestOuterClass.RequestType.GeoPos; -import static redis_request.RedisRequestOuterClass.RequestType.GeoSearch; -import static redis_request.RedisRequestOuterClass.RequestType.GeoSearchStore; -import static redis_request.RedisRequestOuterClass.RequestType.Get; -import static redis_request.RedisRequestOuterClass.RequestType.GetBit; -import static redis_request.RedisRequestOuterClass.RequestType.GetDel; -import static redis_request.RedisRequestOuterClass.RequestType.GetEx; -import static redis_request.RedisRequestOuterClass.RequestType.GetRange; -import static redis_request.RedisRequestOuterClass.RequestType.HDel; -import static redis_request.RedisRequestOuterClass.RequestType.HExists; -import static redis_request.RedisRequestOuterClass.RequestType.HGet; -import static redis_request.RedisRequestOuterClass.RequestType.HGetAll; -import static redis_request.RedisRequestOuterClass.RequestType.HIncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.HIncrByFloat; -import static redis_request.RedisRequestOuterClass.RequestType.HKeys; -import static redis_request.RedisRequestOuterClass.RequestType.HLen; -import static redis_request.RedisRequestOuterClass.RequestType.HMGet; -import static redis_request.RedisRequestOuterClass.RequestType.HRandField; -import static redis_request.RedisRequestOuterClass.RequestType.HScan; -import static redis_request.RedisRequestOuterClass.RequestType.HSet; -import static redis_request.RedisRequestOuterClass.RequestType.HSetNX; -import static redis_request.RedisRequestOuterClass.RequestType.HStrlen; -import static redis_request.RedisRequestOuterClass.RequestType.HVals; -import static redis_request.RedisRequestOuterClass.RequestType.Incr; -import static redis_request.RedisRequestOuterClass.RequestType.IncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.IncrByFloat; -import static redis_request.RedisRequestOuterClass.RequestType.Info; -import static redis_request.RedisRequestOuterClass.RequestType.LCS; -import static redis_request.RedisRequestOuterClass.RequestType.LIndex; -import static redis_request.RedisRequestOuterClass.RequestType.LInsert; -import static redis_request.RedisRequestOuterClass.RequestType.LLen; -import static redis_request.RedisRequestOuterClass.RequestType.LMPop; -import static redis_request.RedisRequestOuterClass.RequestType.LMove; -import static redis_request.RedisRequestOuterClass.RequestType.LPop; -import static redis_request.RedisRequestOuterClass.RequestType.LPos; -import static redis_request.RedisRequestOuterClass.RequestType.LPush; -import static redis_request.RedisRequestOuterClass.RequestType.LPushX; -import static redis_request.RedisRequestOuterClass.RequestType.LRange; -import static redis_request.RedisRequestOuterClass.RequestType.LRem; -import static redis_request.RedisRequestOuterClass.RequestType.LSet; -import static redis_request.RedisRequestOuterClass.RequestType.LTrim; -import static redis_request.RedisRequestOuterClass.RequestType.LastSave; -import static redis_request.RedisRequestOuterClass.RequestType.Lolwut; -import static redis_request.RedisRequestOuterClass.RequestType.MGet; -import static redis_request.RedisRequestOuterClass.RequestType.MSet; -import static redis_request.RedisRequestOuterClass.RequestType.MSetNX; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectEncoding; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectFreq; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectIdleTime; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectRefCount; -import static redis_request.RedisRequestOuterClass.RequestType.PExpire; -import static redis_request.RedisRequestOuterClass.RequestType.PExpireAt; -import static redis_request.RedisRequestOuterClass.RequestType.PExpireTime; -import static redis_request.RedisRequestOuterClass.RequestType.PTTL; -import static redis_request.RedisRequestOuterClass.RequestType.Persist; -import static redis_request.RedisRequestOuterClass.RequestType.PfAdd; -import static redis_request.RedisRequestOuterClass.RequestType.PfCount; -import static redis_request.RedisRequestOuterClass.RequestType.PfMerge; -import static redis_request.RedisRequestOuterClass.RequestType.Ping; -import static redis_request.RedisRequestOuterClass.RequestType.Publish; -import static redis_request.RedisRequestOuterClass.RequestType.RPop; -import static redis_request.RedisRequestOuterClass.RequestType.RPush; -import static redis_request.RedisRequestOuterClass.RequestType.RPushX; -import static redis_request.RedisRequestOuterClass.RequestType.RandomKey; -import static redis_request.RedisRequestOuterClass.RequestType.Rename; -import static redis_request.RedisRequestOuterClass.RequestType.RenameNX; -import static redis_request.RedisRequestOuterClass.RequestType.Restore; -import static redis_request.RedisRequestOuterClass.RequestType.SAdd; -import static redis_request.RedisRequestOuterClass.RequestType.SCard; -import static redis_request.RedisRequestOuterClass.RequestType.SDiff; -import static redis_request.RedisRequestOuterClass.RequestType.SDiffStore; -import static redis_request.RedisRequestOuterClass.RequestType.SInter; -import static redis_request.RedisRequestOuterClass.RequestType.SInterCard; -import static redis_request.RedisRequestOuterClass.RequestType.SInterStore; -import static redis_request.RedisRequestOuterClass.RequestType.SIsMember; -import static redis_request.RedisRequestOuterClass.RequestType.SMIsMember; -import static redis_request.RedisRequestOuterClass.RequestType.SMembers; -import static redis_request.RedisRequestOuterClass.RequestType.SMove; -import static redis_request.RedisRequestOuterClass.RequestType.SPop; -import static redis_request.RedisRequestOuterClass.RequestType.SRandMember; -import static redis_request.RedisRequestOuterClass.RequestType.SRem; -import static redis_request.RedisRequestOuterClass.RequestType.SScan; -import static redis_request.RedisRequestOuterClass.RequestType.SUnion; -import static redis_request.RedisRequestOuterClass.RequestType.SUnionStore; -import static redis_request.RedisRequestOuterClass.RequestType.Set; -import static redis_request.RedisRequestOuterClass.RequestType.SetBit; -import static redis_request.RedisRequestOuterClass.RequestType.SetRange; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.Strlen; -import static redis_request.RedisRequestOuterClass.RequestType.TTL; -import static redis_request.RedisRequestOuterClass.RequestType.Time; -import static redis_request.RedisRequestOuterClass.RequestType.Touch; -import static redis_request.RedisRequestOuterClass.RequestType.Type; -import static redis_request.RedisRequestOuterClass.RequestType.Unlink; -import static redis_request.RedisRequestOuterClass.RequestType.Wait; -import static redis_request.RedisRequestOuterClass.RequestType.XAck; -import static redis_request.RedisRequestOuterClass.RequestType.XAdd; -import static redis_request.RedisRequestOuterClass.RequestType.XAutoClaim; -import static redis_request.RedisRequestOuterClass.RequestType.XClaim; -import static redis_request.RedisRequestOuterClass.RequestType.XDel; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreate; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreateConsumer; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupDelConsumer; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupDestroy; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupSetId; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoConsumers; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoGroups; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoStream; -import static redis_request.RedisRequestOuterClass.RequestType.XLen; -import static redis_request.RedisRequestOuterClass.RequestType.XPending; -import static redis_request.RedisRequestOuterClass.RequestType.XRange; -import static redis_request.RedisRequestOuterClass.RequestType.XRead; -import static redis_request.RedisRequestOuterClass.RequestType.XReadGroup; -import static redis_request.RedisRequestOuterClass.RequestType.XRevRange; -import static redis_request.RedisRequestOuterClass.RequestType.XTrim; -import static redis_request.RedisRequestOuterClass.RequestType.ZAdd; -import static redis_request.RedisRequestOuterClass.RequestType.ZCard; -import static redis_request.RedisRequestOuterClass.RequestType.ZCount; -import static redis_request.RedisRequestOuterClass.RequestType.ZDiff; -import static redis_request.RedisRequestOuterClass.RequestType.ZDiffStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZIncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.ZInter; -import static redis_request.RedisRequestOuterClass.RequestType.ZInterCard; -import static redis_request.RedisRequestOuterClass.RequestType.ZInterStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZLexCount; -import static redis_request.RedisRequestOuterClass.RequestType.ZMPop; -import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; -import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; -import static redis_request.RedisRequestOuterClass.RequestType.ZRandMember; -import static redis_request.RedisRequestOuterClass.RequestType.ZRange; -import static redis_request.RedisRequestOuterClass.RequestType.ZRangeStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZRem; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByLex; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZRevRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZScan; -import static redis_request.RedisRequestOuterClass.RequestType.ZScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZUnion; -import static redis_request.RedisRequestOuterClass.RequestType.ZUnionStore; +import command_request.CommandRequestOuterClass.Command; +import command_request.CommandRequestOuterClass.Command.ArgsArray; +import command_request.CommandRequestOuterClass.RequestType; +import command_request.CommandRequestOuterClass.Transaction; import glide.api.models.commands.ExpireOptions; import glide.api.models.commands.FlushMode; import glide.api.models.commands.GetExOptions; @@ -292,10 +296,6 @@ import java.util.Map; import lombok.Getter; import lombok.NonNull; -import redis_request.RedisRequestOuterClass.Command; -import redis_request.RedisRequestOuterClass.Command.ArgsArray; -import redis_request.RedisRequestOuterClass.RequestType; -import redis_request.RedisRequestOuterClass.Transaction; /** * Base class encompassing shared commands for both standalone and cluster server installations. diff --git a/java/client/src/main/java/glide/api/models/ClusterTransaction.java b/java/client/src/main/java/glide/api/models/ClusterTransaction.java index 803470fed8..4390626cec 100644 --- a/java/client/src/main/java/glide/api/models/ClusterTransaction.java +++ b/java/client/src/main/java/glide/api/models/ClusterTransaction.java @@ -1,10 +1,10 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api.models; +import static command_request.CommandRequestOuterClass.RequestType.SPublish; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; import static glide.api.models.commands.SortBaseOptions.STORE_COMMAND_STRING; -import static redis_request.RedisRequestOuterClass.RequestType.SPublish; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; import glide.api.RedisClusterClient; import glide.api.models.commands.SortClusterOptions; diff --git a/java/client/src/main/java/glide/api/models/Transaction.java b/java/client/src/main/java/glide/api/models/Transaction.java index 0a5d514e19..ef2334f6c4 100644 --- a/java/client/src/main/java/glide/api/models/Transaction.java +++ b/java/client/src/main/java/glide/api/models/Transaction.java @@ -1,15 +1,15 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api.models; +import static command_request.CommandRequestOuterClass.RequestType.Copy; +import static command_request.CommandRequestOuterClass.RequestType.Move; +import static command_request.CommandRequestOuterClass.RequestType.Scan; +import static command_request.CommandRequestOuterClass.RequestType.Select; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; import static glide.api.commands.GenericBaseCommands.REPLACE_REDIS_API; import static glide.api.commands.GenericCommands.DB_REDIS_API; import static glide.api.models.commands.SortBaseOptions.STORE_COMMAND_STRING; -import static redis_request.RedisRequestOuterClass.RequestType.Copy; -import static redis_request.RedisRequestOuterClass.RequestType.Move; -import static redis_request.RedisRequestOuterClass.RequestType.Scan; -import static redis_request.RedisRequestOuterClass.RequestType.Select; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; import glide.api.RedisClient; import glide.api.models.commands.SortOptions; diff --git a/java/client/src/main/java/glide/api/models/commands/SetOptions.java b/java/client/src/main/java/glide/api/models/commands/SetOptions.java index 306cb2ef1d..2c7c7b08dc 100644 --- a/java/client/src/main/java/glide/api/models/commands/SetOptions.java +++ b/java/client/src/main/java/glide/api/models/commands/SetOptions.java @@ -7,13 +7,13 @@ import static glide.api.models.commands.SetOptions.ExpiryType.UNIX_MILLISECONDS; import static glide.api.models.commands.SetOptions.ExpiryType.UNIX_SECONDS; +import command_request.CommandRequestOuterClass.Command; import glide.api.commands.StringBaseCommands; import java.util.ArrayList; import java.util.List; import lombok.Builder; import lombok.Getter; import lombok.RequiredArgsConstructor; -import redis_request.RedisRequestOuterClass.Command; /** * Optional arguments for {@link StringBaseCommands#set(String, String, SetOptions)} command. diff --git a/java/client/src/main/java/glide/connectors/handlers/ChannelHandler.java b/java/client/src/main/java/glide/connectors/handlers/ChannelHandler.java index af9507b867..9a5836401c 100644 --- a/java/client/src/main/java/glide/connectors/handlers/ChannelHandler.java +++ b/java/client/src/main/java/glide/connectors/handlers/ChannelHandler.java @@ -1,6 +1,7 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.connectors.handlers; +import command_request.CommandRequestOuterClass.CommandRequest; import connection_request.ConnectionRequestOuterClass.ConnectionRequest; import glide.connectors.resources.ThreadPoolResource; import io.netty.bootstrap.Bootstrap; @@ -12,7 +13,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import lombok.NonNull; import lombok.RequiredArgsConstructor; -import redis_request.RedisRequestOuterClass.RedisRequest; import response.ResponseOuterClass.Response; /** @@ -62,7 +62,7 @@ public ChannelHandler( * @param flush True to flush immediately * @return A response promise */ - public CompletableFuture write(RedisRequest.Builder request, boolean flush) { + public CompletableFuture write(CommandRequest.Builder request, boolean flush) { var commandId = callbackDispatcher.registerRequest(); request.setCallbackIdx(commandId.getKey()); diff --git a/java/client/src/main/java/glide/managers/CommandManager.java b/java/client/src/main/java/glide/managers/CommandManager.java index 34f52dd6b4..a3f5d17139 100644 --- a/java/client/src/main/java/glide/managers/CommandManager.java +++ b/java/client/src/main/java/glide/managers/CommandManager.java @@ -2,6 +2,16 @@ package glide.managers; import com.google.protobuf.ByteString; +import command_request.CommandRequestOuterClass; +import command_request.CommandRequestOuterClass.Command; +import command_request.CommandRequestOuterClass.Command.ArgsArray; +import command_request.CommandRequestOuterClass.CommandRequest; +import command_request.CommandRequestOuterClass.RequestType; +import command_request.CommandRequestOuterClass.Routes; +import command_request.CommandRequestOuterClass.ScriptInvocation; +import command_request.CommandRequestOuterClass.ScriptInvocationPointers; +import command_request.CommandRequestOuterClass.SimpleRoutes; +import command_request.CommandRequestOuterClass.SlotTypes; import glide.api.models.ClusterTransaction; import glide.api.models.GlideString; import glide.api.models.Script; @@ -26,16 +36,6 @@ import java.util.stream.Collectors; import lombok.NonNull; import lombok.RequiredArgsConstructor; -import redis_request.RedisRequestOuterClass; -import redis_request.RedisRequestOuterClass.Command; -import redis_request.RedisRequestOuterClass.Command.ArgsArray; -import redis_request.RedisRequestOuterClass.RedisRequest; -import redis_request.RedisRequestOuterClass.RequestType; -import redis_request.RedisRequestOuterClass.Routes; -import redis_request.RedisRequestOuterClass.ScriptInvocation; -import redis_request.RedisRequestOuterClass.ScriptInvocationPointers; -import redis_request.RedisRequestOuterClass.SimpleRoutes; -import redis_request.RedisRequestOuterClass.SlotTypes; import response.ResponseOuterClass.Response; /** @@ -74,7 +74,7 @@ public CompletableFuture submitNewCommand( String[] arguments, RedisExceptionCheckedFunction responseHandler) { - RedisRequest.Builder command = prepareRedisRequest(requestType, arguments); + CommandRequest.Builder command = prepareCommandRequest(requestType, arguments); return submitCommandToChannel(command, responseHandler); } @@ -91,7 +91,7 @@ public CompletableFuture submitNewCommand( GlideString[] arguments, RedisExceptionCheckedFunction responseHandler) { - RedisRequest.Builder command = prepareRedisRequest(requestType, arguments); + CommandRequest.Builder command = prepareCommandRequest(requestType, arguments); return submitCommandToChannel(command, responseHandler); } @@ -110,7 +110,7 @@ public CompletableFuture submitNewCommand( Route route, RedisExceptionCheckedFunction responseHandler) { - RedisRequest.Builder command = prepareRedisRequest(requestType, arguments, route); + CommandRequest.Builder command = prepareCommandRequest(requestType, arguments, route); return submitCommandToChannel(command, responseHandler); } @@ -129,7 +129,7 @@ public CompletableFuture submitNewCommand( Route route, RedisExceptionCheckedFunction responseHandler) { - RedisRequest.Builder command = prepareRedisRequest(requestType, arguments, route); + CommandRequest.Builder command = prepareCommandRequest(requestType, arguments, route); return submitCommandToChannel(command, responseHandler); } @@ -143,7 +143,7 @@ public CompletableFuture submitNewCommand( public CompletableFuture submitNewTransaction( Transaction transaction, RedisExceptionCheckedFunction responseHandler) { - RedisRequest.Builder command = prepareRedisRequest(transaction); + CommandRequest.Builder command = prepareCommandRequest(transaction); return submitCommandToChannel(command, responseHandler); } @@ -162,7 +162,7 @@ public CompletableFuture submitScript( List args, RedisExceptionCheckedFunction responseHandler) { - RedisRequest.Builder command = prepareScript(script, keys, args); + CommandRequest.Builder command = prepareScript(script, keys, args); return submitCommandToChannel(command, responseHandler); } @@ -179,7 +179,7 @@ public CompletableFuture submitNewTransaction( Optional route, RedisExceptionCheckedFunction responseHandler) { - RedisRequest.Builder command = prepareRedisRequest(transaction, route); + CommandRequest.Builder command = prepareCommandRequest(transaction, route); return submitCommandToChannel(command, responseHandler); } @@ -196,7 +196,7 @@ public CompletableFuture submitClusterScan( @NonNull ScanOptions options, RedisExceptionCheckedFunction responseHandler) { - final RedisRequest.Builder command = prepareCursorRequest(cursor, options); + final CommandRequest.Builder command = prepareCursorRequest(cursor, options); return submitCommandToChannel(command, responseHandler); } @@ -208,7 +208,7 @@ public CompletableFuture submitClusterScan( * @return A result promise of type T */ protected CompletableFuture submitCommandToChannel( - RedisRequest.Builder command, RedisExceptionCheckedFunction responseHandler) { + CommandRequest.Builder command, RedisExceptionCheckedFunction responseHandler) { if (channel.isClosed()) { var errorFuture = new CompletableFuture(); errorFuture.completeExceptionally( @@ -233,16 +233,16 @@ protected CompletableFuture submitCommandToChannel( * @return An incomplete request. {@link CallbackDispatcher} is responsible to complete it by * adding a callback id. */ - protected RedisRequest.Builder prepareRedisRequest( + protected CommandRequest.Builder prepareCommandRequest( RequestType requestType, String[] arguments, Route route) { final Command.Builder commandBuilder = Command.newBuilder(); populateCommandWithArgs(arguments, commandBuilder); var builder = - RedisRequest.newBuilder() + CommandRequest.newBuilder() .setSingleCommand(commandBuilder.setRequestType(requestType).build()); - return prepareRedisRequestRoute(builder, route); + return prepareCommandRequestRoute(builder, route); } /** @@ -254,16 +254,16 @@ protected RedisRequest.Builder prepareRedisRequest( * @return An incomplete request. {@link CallbackDispatcher} is responsible to complete it by * adding a callback id. */ - protected RedisRequest.Builder prepareRedisRequest( + protected CommandRequest.Builder prepareCommandRequest( RequestType requestType, GlideString[] arguments, Route route) { final Command.Builder commandBuilder = Command.newBuilder(); populateCommandWithArgs(arguments, commandBuilder); var builder = - RedisRequest.newBuilder() + CommandRequest.newBuilder() .setSingleCommand(commandBuilder.setRequestType(requestType).build()); - return prepareRedisRequestRoute(builder, route); + return prepareCommandRequestRoute(builder, route); } /** @@ -273,8 +273,8 @@ protected RedisRequest.Builder prepareRedisRequest( * @return An uncompleted request. {@link CallbackDispatcher} is responsible to complete it by * adding a callback id. */ - protected RedisRequest.Builder prepareRedisRequest(Transaction transaction) { - return RedisRequest.newBuilder().setTransaction(transaction.getProtobufTransaction().build()); + protected CommandRequest.Builder prepareCommandRequest(Transaction transaction) { + return CommandRequest.newBuilder().setTransaction(transaction.getProtobufTransaction().build()); } /** @@ -286,13 +286,13 @@ protected RedisRequest.Builder prepareRedisRequest(Transaction transaction) { * @return An uncompleted request. {@link CallbackDispatcher} is responsible to complete it by * adding a callback id. */ - protected RedisRequest.Builder prepareScript( + protected CommandRequest.Builder prepareScript( Script script, List keys, List args) { if (keys.stream().mapToLong(key -> key.getBytes().length).sum() + args.stream().mapToLong(key -> key.getBytes().length).sum() > RedisValueResolver.MAX_REQUEST_ARGS_LENGTH_IN_BYTES) { - return RedisRequest.newBuilder() + return CommandRequest.newBuilder() .setScriptInvocationPointers( ScriptInvocationPointers.newBuilder() .setHash(script.getHash()) @@ -305,7 +305,7 @@ protected RedisRequest.Builder prepareScript( .build()); } - return RedisRequest.newBuilder() + return CommandRequest.newBuilder() .setScriptInvocation( ScriptInvocation.newBuilder() .setHash(script.getHash()) @@ -330,13 +330,13 @@ protected RedisRequest.Builder prepareScript( * @return An uncompleted request. {@link CallbackDispatcher} is responsible to complete it by * adding a callback id. */ - protected RedisRequest.Builder prepareRedisRequest( + protected CommandRequest.Builder prepareCommandRequest( ClusterTransaction transaction, Optional route) { - RedisRequest.Builder builder = - RedisRequest.newBuilder().setTransaction(transaction.getProtobufTransaction().build()); + CommandRequest.Builder builder = + CommandRequest.newBuilder().setTransaction(transaction.getProtobufTransaction().build()); - return route.isPresent() ? prepareRedisRequestRoute(builder, route.get()) : builder; + return route.isPresent() ? prepareCommandRequestRoute(builder, route.get()) : builder; } /** @@ -347,11 +347,11 @@ protected RedisRequest.Builder prepareRedisRequest( * @return An uncompleted request. {@link CallbackDispatcher} is responsible to complete it by * adding a callback id. */ - protected RedisRequest.Builder prepareCursorRequest( + protected CommandRequest.Builder prepareCursorRequest( @NonNull ClusterScanCursor cursor, @NonNull ScanOptions options) { - RedisRequestOuterClass.ClusterScan.Builder clusterScanBuilder = - RedisRequestOuterClass.ClusterScan.newBuilder(); + CommandRequestOuterClass.ClusterScan.Builder clusterScanBuilder = + CommandRequestOuterClass.ClusterScan.newBuilder(); if (cursor != ClusterScanCursor.INITIAL_CURSOR_INSTANCE) { if (cursor instanceof ClusterScanCursorDetail) { @@ -373,7 +373,7 @@ protected RedisRequest.Builder prepareCursorRequest( clusterScanBuilder.setObjectType(options.getType().getNativeName()); } - return RedisRequest.newBuilder().setClusterScan(clusterScanBuilder.build()); + return CommandRequest.newBuilder().setClusterScan(clusterScanBuilder.build()); } /** @@ -384,11 +384,12 @@ protected RedisRequest.Builder prepareCursorRequest( * @return An uncompleted request. {@link CallbackDispatcher} is responsible to complete it by * adding a callback id. */ - protected RedisRequest.Builder prepareRedisRequest(RequestType requestType, String[] arguments) { + protected CommandRequest.Builder prepareCommandRequest( + RequestType requestType, String[] arguments) { final Command.Builder commandBuilder = Command.newBuilder(); populateCommandWithArgs(arguments, commandBuilder); - return RedisRequest.newBuilder() + return CommandRequest.newBuilder() .setSingleCommand(commandBuilder.setRequestType(requestType).build()); } @@ -400,16 +401,17 @@ protected RedisRequest.Builder prepareRedisRequest(RequestType requestType, Stri * @return An uncompleted request. {@link CallbackDispatcher} is responsible to complete it by * adding a callback id. */ - protected RedisRequest.Builder prepareRedisRequest( + protected CommandRequest.Builder prepareCommandRequest( RequestType requestType, GlideString[] arguments) { final Command.Builder commandBuilder = Command.newBuilder(); populateCommandWithArgs(arguments, commandBuilder); - return RedisRequest.newBuilder() + return CommandRequest.newBuilder() .setSingleCommand(commandBuilder.setRequestType(requestType).build()); } - private RedisRequest.Builder prepareRedisRequestRoute(RedisRequest.Builder builder, Route route) { + private CommandRequest.Builder prepareCommandRequestRoute( + CommandRequest.Builder builder, Route route) { if (route instanceof SimpleMultiNodeRoute) { builder.setRoute( @@ -425,7 +427,7 @@ private RedisRequest.Builder prepareRedisRequestRoute(RedisRequest.Builder build builder.setRoute( Routes.newBuilder() .setSlotIdRoute( - RedisRequestOuterClass.SlotIdRoute.newBuilder() + CommandRequestOuterClass.SlotIdRoute.newBuilder() .setSlotId(((SlotIdRoute) route).getSlotId()) .setSlotType( SlotTypes.forNumber(((SlotIdRoute) route).getSlotType().ordinal())))); @@ -433,7 +435,7 @@ private RedisRequest.Builder prepareRedisRequestRoute(RedisRequest.Builder build builder.setRoute( Routes.newBuilder() .setSlotKeyRoute( - RedisRequestOuterClass.SlotKeyRoute.newBuilder() + CommandRequestOuterClass.SlotKeyRoute.newBuilder() .setSlotKey(((SlotKeyRoute) route).getSlotKey()) .setSlotType( SlotTypes.forNumber(((SlotKeyRoute) route).getSlotType().ordinal())))); @@ -441,7 +443,7 @@ private RedisRequest.Builder prepareRedisRequestRoute(RedisRequest.Builder build builder.setRoute( Routes.newBuilder() .setByAddressRoute( - RedisRequestOuterClass.ByAddressRoute.newBuilder() + CommandRequestOuterClass.ByAddressRoute.newBuilder() .setHost(((ByAddressRoute) route).getHost()) .setPort(((ByAddressRoute) route).getPort()))); } else { diff --git a/java/client/src/test/java/glide/ExceptionHandlingTests.java b/java/client/src/test/java/glide/ExceptionHandlingTests.java index d383797bd5..ae02b30b46 100644 --- a/java/client/src/test/java/glide/ExceptionHandlingTests.java +++ b/java/client/src/test/java/glide/ExceptionHandlingTests.java @@ -1,18 +1,19 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide; +import static command_request.CommandRequestOuterClass.RequestType.CustomCommand; import static glide.ffi.resolvers.SocketListenerResolver.getSocket; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mockStatic; -import static redis_request.RedisRequestOuterClass.RequestType.CustomCommand; import static response.ResponseOuterClass.RequestErrorType.Disconnect; import static response.ResponseOuterClass.RequestErrorType.ExecAbort; import static response.ResponseOuterClass.RequestErrorType.Timeout; import static response.ResponseOuterClass.RequestErrorType.Unspecified; +import command_request.CommandRequestOuterClass.CommandRequest; import connection_request.ConnectionRequestOuterClass; import glide.api.logging.Logger; import glide.api.models.configuration.RedisClientConfiguration; @@ -43,7 +44,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.mockito.MockedStatic; -import redis_request.RedisRequestOuterClass.RedisRequest; import response.ResponseOuterClass.RequestError; import response.ResponseOuterClass.RequestErrorType; import response.ResponseOuterClass.Response; @@ -311,7 +311,7 @@ public ChannelFuture close() { } @Override - public CompletableFuture write(RedisRequest.Builder request, boolean flush) { + public CompletableFuture write(CommandRequest.Builder request, boolean flush) { var commandId = callbackDispatcher.registerRequest(); return commandId.getValue(); } diff --git a/java/client/src/test/java/glide/api/RedisClientTest.java b/java/client/src/test/java/glide/api/RedisClientTest.java index 41ae446263..06ff9f998b 100644 --- a/java/client/src/test/java/glide/api/RedisClientTest.java +++ b/java/client/src/test/java/glide/api/RedisClientTest.java @@ -1,6 +1,199 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api; +import static command_request.CommandRequestOuterClass.RequestType.Append; +import static command_request.CommandRequestOuterClass.RequestType.BLMPop; +import static command_request.CommandRequestOuterClass.RequestType.BLMove; +import static command_request.CommandRequestOuterClass.RequestType.BLPop; +import static command_request.CommandRequestOuterClass.RequestType.BRPop; +import static command_request.CommandRequestOuterClass.RequestType.BZMPop; +import static command_request.CommandRequestOuterClass.RequestType.BZPopMax; +import static command_request.CommandRequestOuterClass.RequestType.BZPopMin; +import static command_request.CommandRequestOuterClass.RequestType.BitCount; +import static command_request.CommandRequestOuterClass.RequestType.BitField; +import static command_request.CommandRequestOuterClass.RequestType.BitFieldReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.BitOp; +import static command_request.CommandRequestOuterClass.RequestType.BitPos; +import static command_request.CommandRequestOuterClass.RequestType.ClientGetName; +import static command_request.CommandRequestOuterClass.RequestType.ClientId; +import static command_request.CommandRequestOuterClass.RequestType.ConfigGet; +import static command_request.CommandRequestOuterClass.RequestType.ConfigResetStat; +import static command_request.CommandRequestOuterClass.RequestType.ConfigRewrite; +import static command_request.CommandRequestOuterClass.RequestType.ConfigSet; +import static command_request.CommandRequestOuterClass.RequestType.Copy; +import static command_request.CommandRequestOuterClass.RequestType.CustomCommand; +import static command_request.CommandRequestOuterClass.RequestType.DBSize; +import static command_request.CommandRequestOuterClass.RequestType.Decr; +import static command_request.CommandRequestOuterClass.RequestType.DecrBy; +import static command_request.CommandRequestOuterClass.RequestType.Del; +import static command_request.CommandRequestOuterClass.RequestType.Dump; +import static command_request.CommandRequestOuterClass.RequestType.Echo; +import static command_request.CommandRequestOuterClass.RequestType.Exists; +import static command_request.CommandRequestOuterClass.RequestType.Expire; +import static command_request.CommandRequestOuterClass.RequestType.ExpireAt; +import static command_request.CommandRequestOuterClass.RequestType.ExpireTime; +import static command_request.CommandRequestOuterClass.RequestType.FCall; +import static command_request.CommandRequestOuterClass.RequestType.FCallReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.FlushAll; +import static command_request.CommandRequestOuterClass.RequestType.FlushDB; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDelete; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDump; +import static command_request.CommandRequestOuterClass.RequestType.FunctionFlush; +import static command_request.CommandRequestOuterClass.RequestType.FunctionKill; +import static command_request.CommandRequestOuterClass.RequestType.FunctionList; +import static command_request.CommandRequestOuterClass.RequestType.FunctionLoad; +import static command_request.CommandRequestOuterClass.RequestType.FunctionRestore; +import static command_request.CommandRequestOuterClass.RequestType.FunctionStats; +import static command_request.CommandRequestOuterClass.RequestType.GeoAdd; +import static command_request.CommandRequestOuterClass.RequestType.GeoDist; +import static command_request.CommandRequestOuterClass.RequestType.GeoHash; +import static command_request.CommandRequestOuterClass.RequestType.GeoPos; +import static command_request.CommandRequestOuterClass.RequestType.GeoSearch; +import static command_request.CommandRequestOuterClass.RequestType.GeoSearchStore; +import static command_request.CommandRequestOuterClass.RequestType.Get; +import static command_request.CommandRequestOuterClass.RequestType.GetBit; +import static command_request.CommandRequestOuterClass.RequestType.GetDel; +import static command_request.CommandRequestOuterClass.RequestType.GetEx; +import static command_request.CommandRequestOuterClass.RequestType.GetRange; +import static command_request.CommandRequestOuterClass.RequestType.HDel; +import static command_request.CommandRequestOuterClass.RequestType.HExists; +import static command_request.CommandRequestOuterClass.RequestType.HGet; +import static command_request.CommandRequestOuterClass.RequestType.HGetAll; +import static command_request.CommandRequestOuterClass.RequestType.HIncrBy; +import static command_request.CommandRequestOuterClass.RequestType.HIncrByFloat; +import static command_request.CommandRequestOuterClass.RequestType.HKeys; +import static command_request.CommandRequestOuterClass.RequestType.HLen; +import static command_request.CommandRequestOuterClass.RequestType.HMGet; +import static command_request.CommandRequestOuterClass.RequestType.HRandField; +import static command_request.CommandRequestOuterClass.RequestType.HScan; +import static command_request.CommandRequestOuterClass.RequestType.HSet; +import static command_request.CommandRequestOuterClass.RequestType.HSetNX; +import static command_request.CommandRequestOuterClass.RequestType.HStrlen; +import static command_request.CommandRequestOuterClass.RequestType.HVals; +import static command_request.CommandRequestOuterClass.RequestType.Incr; +import static command_request.CommandRequestOuterClass.RequestType.IncrBy; +import static command_request.CommandRequestOuterClass.RequestType.IncrByFloat; +import static command_request.CommandRequestOuterClass.RequestType.Info; +import static command_request.CommandRequestOuterClass.RequestType.LCS; +import static command_request.CommandRequestOuterClass.RequestType.LIndex; +import static command_request.CommandRequestOuterClass.RequestType.LInsert; +import static command_request.CommandRequestOuterClass.RequestType.LLen; +import static command_request.CommandRequestOuterClass.RequestType.LMPop; +import static command_request.CommandRequestOuterClass.RequestType.LMove; +import static command_request.CommandRequestOuterClass.RequestType.LPop; +import static command_request.CommandRequestOuterClass.RequestType.LPos; +import static command_request.CommandRequestOuterClass.RequestType.LPush; +import static command_request.CommandRequestOuterClass.RequestType.LPushX; +import static command_request.CommandRequestOuterClass.RequestType.LRange; +import static command_request.CommandRequestOuterClass.RequestType.LRem; +import static command_request.CommandRequestOuterClass.RequestType.LSet; +import static command_request.CommandRequestOuterClass.RequestType.LTrim; +import static command_request.CommandRequestOuterClass.RequestType.LastSave; +import static command_request.CommandRequestOuterClass.RequestType.Lolwut; +import static command_request.CommandRequestOuterClass.RequestType.MGet; +import static command_request.CommandRequestOuterClass.RequestType.MSet; +import static command_request.CommandRequestOuterClass.RequestType.MSetNX; +import static command_request.CommandRequestOuterClass.RequestType.Move; +import static command_request.CommandRequestOuterClass.RequestType.ObjectEncoding; +import static command_request.CommandRequestOuterClass.RequestType.ObjectFreq; +import static command_request.CommandRequestOuterClass.RequestType.ObjectIdleTime; +import static command_request.CommandRequestOuterClass.RequestType.ObjectRefCount; +import static command_request.CommandRequestOuterClass.RequestType.PExpire; +import static command_request.CommandRequestOuterClass.RequestType.PExpireAt; +import static command_request.CommandRequestOuterClass.RequestType.PExpireTime; +import static command_request.CommandRequestOuterClass.RequestType.PTTL; +import static command_request.CommandRequestOuterClass.RequestType.Persist; +import static command_request.CommandRequestOuterClass.RequestType.PfAdd; +import static command_request.CommandRequestOuterClass.RequestType.PfCount; +import static command_request.CommandRequestOuterClass.RequestType.PfMerge; +import static command_request.CommandRequestOuterClass.RequestType.Ping; +import static command_request.CommandRequestOuterClass.RequestType.Publish; +import static command_request.CommandRequestOuterClass.RequestType.RPop; +import static command_request.CommandRequestOuterClass.RequestType.RPush; +import static command_request.CommandRequestOuterClass.RequestType.RPushX; +import static command_request.CommandRequestOuterClass.RequestType.RandomKey; +import static command_request.CommandRequestOuterClass.RequestType.Rename; +import static command_request.CommandRequestOuterClass.RequestType.RenameNX; +import static command_request.CommandRequestOuterClass.RequestType.Restore; +import static command_request.CommandRequestOuterClass.RequestType.SAdd; +import static command_request.CommandRequestOuterClass.RequestType.SCard; +import static command_request.CommandRequestOuterClass.RequestType.SDiff; +import static command_request.CommandRequestOuterClass.RequestType.SDiffStore; +import static command_request.CommandRequestOuterClass.RequestType.SInter; +import static command_request.CommandRequestOuterClass.RequestType.SInterCard; +import static command_request.CommandRequestOuterClass.RequestType.SInterStore; +import static command_request.CommandRequestOuterClass.RequestType.SIsMember; +import static command_request.CommandRequestOuterClass.RequestType.SMIsMember; +import static command_request.CommandRequestOuterClass.RequestType.SMembers; +import static command_request.CommandRequestOuterClass.RequestType.SMove; +import static command_request.CommandRequestOuterClass.RequestType.SPop; +import static command_request.CommandRequestOuterClass.RequestType.SRandMember; +import static command_request.CommandRequestOuterClass.RequestType.SRem; +import static command_request.CommandRequestOuterClass.RequestType.SScan; +import static command_request.CommandRequestOuterClass.RequestType.SUnion; +import static command_request.CommandRequestOuterClass.RequestType.SUnionStore; +import static command_request.CommandRequestOuterClass.RequestType.Scan; +import static command_request.CommandRequestOuterClass.RequestType.Select; +import static command_request.CommandRequestOuterClass.RequestType.SetBit; +import static command_request.CommandRequestOuterClass.RequestType.SetRange; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.Strlen; +import static command_request.CommandRequestOuterClass.RequestType.TTL; +import static command_request.CommandRequestOuterClass.RequestType.Time; +import static command_request.CommandRequestOuterClass.RequestType.Touch; +import static command_request.CommandRequestOuterClass.RequestType.Type; +import static command_request.CommandRequestOuterClass.RequestType.UnWatch; +import static command_request.CommandRequestOuterClass.RequestType.Unlink; +import static command_request.CommandRequestOuterClass.RequestType.Wait; +import static command_request.CommandRequestOuterClass.RequestType.Watch; +import static command_request.CommandRequestOuterClass.RequestType.XAck; +import static command_request.CommandRequestOuterClass.RequestType.XAdd; +import static command_request.CommandRequestOuterClass.RequestType.XAutoClaim; +import static command_request.CommandRequestOuterClass.RequestType.XClaim; +import static command_request.CommandRequestOuterClass.RequestType.XDel; +import static command_request.CommandRequestOuterClass.RequestType.XGroupCreate; +import static command_request.CommandRequestOuterClass.RequestType.XGroupCreateConsumer; +import static command_request.CommandRequestOuterClass.RequestType.XGroupDelConsumer; +import static command_request.CommandRequestOuterClass.RequestType.XGroupDestroy; +import static command_request.CommandRequestOuterClass.RequestType.XGroupSetId; +import static command_request.CommandRequestOuterClass.RequestType.XInfoConsumers; +import static command_request.CommandRequestOuterClass.RequestType.XInfoGroups; +import static command_request.CommandRequestOuterClass.RequestType.XInfoStream; +import static command_request.CommandRequestOuterClass.RequestType.XLen; +import static command_request.CommandRequestOuterClass.RequestType.XPending; +import static command_request.CommandRequestOuterClass.RequestType.XRange; +import static command_request.CommandRequestOuterClass.RequestType.XRead; +import static command_request.CommandRequestOuterClass.RequestType.XReadGroup; +import static command_request.CommandRequestOuterClass.RequestType.XRevRange; +import static command_request.CommandRequestOuterClass.RequestType.XTrim; +import static command_request.CommandRequestOuterClass.RequestType.ZAdd; +import static command_request.CommandRequestOuterClass.RequestType.ZCard; +import static command_request.CommandRequestOuterClass.RequestType.ZCount; +import static command_request.CommandRequestOuterClass.RequestType.ZDiff; +import static command_request.CommandRequestOuterClass.RequestType.ZDiffStore; +import static command_request.CommandRequestOuterClass.RequestType.ZIncrBy; +import static command_request.CommandRequestOuterClass.RequestType.ZInter; +import static command_request.CommandRequestOuterClass.RequestType.ZInterCard; +import static command_request.CommandRequestOuterClass.RequestType.ZInterStore; +import static command_request.CommandRequestOuterClass.RequestType.ZLexCount; +import static command_request.CommandRequestOuterClass.RequestType.ZMPop; +import static command_request.CommandRequestOuterClass.RequestType.ZMScore; +import static command_request.CommandRequestOuterClass.RequestType.ZPopMax; +import static command_request.CommandRequestOuterClass.RequestType.ZPopMin; +import static command_request.CommandRequestOuterClass.RequestType.ZRandMember; +import static command_request.CommandRequestOuterClass.RequestType.ZRange; +import static command_request.CommandRequestOuterClass.RequestType.ZRangeStore; +import static command_request.CommandRequestOuterClass.RequestType.ZRank; +import static command_request.CommandRequestOuterClass.RequestType.ZRem; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByLex; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByRank; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByScore; +import static command_request.CommandRequestOuterClass.RequestType.ZRevRank; +import static command_request.CommandRequestOuterClass.RequestType.ZScan; +import static command_request.CommandRequestOuterClass.RequestType.ZScore; +import static command_request.CommandRequestOuterClass.RequestType.ZUnion; +import static command_request.CommandRequestOuterClass.RequestType.ZUnionStore; import static glide.api.BaseClient.OK; import static glide.api.commands.GenericBaseCommands.REPLACE_REDIS_API; import static glide.api.commands.GenericCommands.DB_REDIS_API; @@ -88,200 +281,8 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static redis_request.RedisRequestOuterClass.RequestType.Append; -import static redis_request.RedisRequestOuterClass.RequestType.BLMPop; -import static redis_request.RedisRequestOuterClass.RequestType.BLMove; -import static redis_request.RedisRequestOuterClass.RequestType.BLPop; -import static redis_request.RedisRequestOuterClass.RequestType.BRPop; -import static redis_request.RedisRequestOuterClass.RequestType.BZMPop; -import static redis_request.RedisRequestOuterClass.RequestType.BZPopMax; -import static redis_request.RedisRequestOuterClass.RequestType.BZPopMin; -import static redis_request.RedisRequestOuterClass.RequestType.BitCount; -import static redis_request.RedisRequestOuterClass.RequestType.BitField; -import static redis_request.RedisRequestOuterClass.RequestType.BitFieldReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.BitOp; -import static redis_request.RedisRequestOuterClass.RequestType.BitPos; -import static redis_request.RedisRequestOuterClass.RequestType.ClientGetName; -import static redis_request.RedisRequestOuterClass.RequestType.ClientId; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigGet; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigResetStat; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigRewrite; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigSet; -import static redis_request.RedisRequestOuterClass.RequestType.Copy; -import static redis_request.RedisRequestOuterClass.RequestType.CustomCommand; -import static redis_request.RedisRequestOuterClass.RequestType.DBSize; -import static redis_request.RedisRequestOuterClass.RequestType.Decr; -import static redis_request.RedisRequestOuterClass.RequestType.DecrBy; -import static redis_request.RedisRequestOuterClass.RequestType.Del; -import static redis_request.RedisRequestOuterClass.RequestType.Dump; -import static redis_request.RedisRequestOuterClass.RequestType.Echo; -import static redis_request.RedisRequestOuterClass.RequestType.Exists; -import static redis_request.RedisRequestOuterClass.RequestType.Expire; -import static redis_request.RedisRequestOuterClass.RequestType.ExpireAt; -import static redis_request.RedisRequestOuterClass.RequestType.ExpireTime; -import static redis_request.RedisRequestOuterClass.RequestType.FCall; -import static redis_request.RedisRequestOuterClass.RequestType.FCallReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.FlushAll; -import static redis_request.RedisRequestOuterClass.RequestType.FlushDB; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDelete; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDump; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionFlush; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionKill; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionList; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionLoad; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionRestore; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionStats; -import static redis_request.RedisRequestOuterClass.RequestType.GeoAdd; -import static redis_request.RedisRequestOuterClass.RequestType.GeoDist; -import static redis_request.RedisRequestOuterClass.RequestType.GeoHash; -import static redis_request.RedisRequestOuterClass.RequestType.GeoPos; -import static redis_request.RedisRequestOuterClass.RequestType.GeoSearch; -import static redis_request.RedisRequestOuterClass.RequestType.GeoSearchStore; -import static redis_request.RedisRequestOuterClass.RequestType.Get; -import static redis_request.RedisRequestOuterClass.RequestType.GetBit; -import static redis_request.RedisRequestOuterClass.RequestType.GetDel; -import static redis_request.RedisRequestOuterClass.RequestType.GetEx; -import static redis_request.RedisRequestOuterClass.RequestType.GetRange; -import static redis_request.RedisRequestOuterClass.RequestType.HDel; -import static redis_request.RedisRequestOuterClass.RequestType.HExists; -import static redis_request.RedisRequestOuterClass.RequestType.HGet; -import static redis_request.RedisRequestOuterClass.RequestType.HGetAll; -import static redis_request.RedisRequestOuterClass.RequestType.HIncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.HIncrByFloat; -import static redis_request.RedisRequestOuterClass.RequestType.HKeys; -import static redis_request.RedisRequestOuterClass.RequestType.HLen; -import static redis_request.RedisRequestOuterClass.RequestType.HMGet; -import static redis_request.RedisRequestOuterClass.RequestType.HRandField; -import static redis_request.RedisRequestOuterClass.RequestType.HScan; -import static redis_request.RedisRequestOuterClass.RequestType.HSet; -import static redis_request.RedisRequestOuterClass.RequestType.HSetNX; -import static redis_request.RedisRequestOuterClass.RequestType.HStrlen; -import static redis_request.RedisRequestOuterClass.RequestType.HVals; -import static redis_request.RedisRequestOuterClass.RequestType.Incr; -import static redis_request.RedisRequestOuterClass.RequestType.IncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.IncrByFloat; -import static redis_request.RedisRequestOuterClass.RequestType.Info; -import static redis_request.RedisRequestOuterClass.RequestType.LCS; -import static redis_request.RedisRequestOuterClass.RequestType.LIndex; -import static redis_request.RedisRequestOuterClass.RequestType.LInsert; -import static redis_request.RedisRequestOuterClass.RequestType.LLen; -import static redis_request.RedisRequestOuterClass.RequestType.LMPop; -import static redis_request.RedisRequestOuterClass.RequestType.LMove; -import static redis_request.RedisRequestOuterClass.RequestType.LPop; -import static redis_request.RedisRequestOuterClass.RequestType.LPos; -import static redis_request.RedisRequestOuterClass.RequestType.LPush; -import static redis_request.RedisRequestOuterClass.RequestType.LPushX; -import static redis_request.RedisRequestOuterClass.RequestType.LRange; -import static redis_request.RedisRequestOuterClass.RequestType.LRem; -import static redis_request.RedisRequestOuterClass.RequestType.LSet; -import static redis_request.RedisRequestOuterClass.RequestType.LTrim; -import static redis_request.RedisRequestOuterClass.RequestType.LastSave; -import static redis_request.RedisRequestOuterClass.RequestType.Lolwut; -import static redis_request.RedisRequestOuterClass.RequestType.MGet; -import static redis_request.RedisRequestOuterClass.RequestType.MSet; -import static redis_request.RedisRequestOuterClass.RequestType.MSetNX; -import static redis_request.RedisRequestOuterClass.RequestType.Move; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectEncoding; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectFreq; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectIdleTime; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectRefCount; -import static redis_request.RedisRequestOuterClass.RequestType.PExpire; -import static redis_request.RedisRequestOuterClass.RequestType.PExpireAt; -import static redis_request.RedisRequestOuterClass.RequestType.PExpireTime; -import static redis_request.RedisRequestOuterClass.RequestType.PTTL; -import static redis_request.RedisRequestOuterClass.RequestType.Persist; -import static redis_request.RedisRequestOuterClass.RequestType.PfAdd; -import static redis_request.RedisRequestOuterClass.RequestType.PfCount; -import static redis_request.RedisRequestOuterClass.RequestType.PfMerge; -import static redis_request.RedisRequestOuterClass.RequestType.Ping; -import static redis_request.RedisRequestOuterClass.RequestType.Publish; -import static redis_request.RedisRequestOuterClass.RequestType.RPop; -import static redis_request.RedisRequestOuterClass.RequestType.RPush; -import static redis_request.RedisRequestOuterClass.RequestType.RPushX; -import static redis_request.RedisRequestOuterClass.RequestType.RandomKey; -import static redis_request.RedisRequestOuterClass.RequestType.Rename; -import static redis_request.RedisRequestOuterClass.RequestType.RenameNX; -import static redis_request.RedisRequestOuterClass.RequestType.Restore; -import static redis_request.RedisRequestOuterClass.RequestType.SAdd; -import static redis_request.RedisRequestOuterClass.RequestType.SCard; -import static redis_request.RedisRequestOuterClass.RequestType.SDiff; -import static redis_request.RedisRequestOuterClass.RequestType.SDiffStore; -import static redis_request.RedisRequestOuterClass.RequestType.SInter; -import static redis_request.RedisRequestOuterClass.RequestType.SInterCard; -import static redis_request.RedisRequestOuterClass.RequestType.SInterStore; -import static redis_request.RedisRequestOuterClass.RequestType.SIsMember; -import static redis_request.RedisRequestOuterClass.RequestType.SMIsMember; -import static redis_request.RedisRequestOuterClass.RequestType.SMembers; -import static redis_request.RedisRequestOuterClass.RequestType.SMove; -import static redis_request.RedisRequestOuterClass.RequestType.SPop; -import static redis_request.RedisRequestOuterClass.RequestType.SRandMember; -import static redis_request.RedisRequestOuterClass.RequestType.SRem; -import static redis_request.RedisRequestOuterClass.RequestType.SScan; -import static redis_request.RedisRequestOuterClass.RequestType.SUnion; -import static redis_request.RedisRequestOuterClass.RequestType.SUnionStore; -import static redis_request.RedisRequestOuterClass.RequestType.Scan; -import static redis_request.RedisRequestOuterClass.RequestType.Select; -import static redis_request.RedisRequestOuterClass.RequestType.SetBit; -import static redis_request.RedisRequestOuterClass.RequestType.SetRange; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.Strlen; -import static redis_request.RedisRequestOuterClass.RequestType.TTL; -import static redis_request.RedisRequestOuterClass.RequestType.Time; -import static redis_request.RedisRequestOuterClass.RequestType.Touch; -import static redis_request.RedisRequestOuterClass.RequestType.Type; -import static redis_request.RedisRequestOuterClass.RequestType.UnWatch; -import static redis_request.RedisRequestOuterClass.RequestType.Unlink; -import static redis_request.RedisRequestOuterClass.RequestType.Wait; -import static redis_request.RedisRequestOuterClass.RequestType.Watch; -import static redis_request.RedisRequestOuterClass.RequestType.XAck; -import static redis_request.RedisRequestOuterClass.RequestType.XAdd; -import static redis_request.RedisRequestOuterClass.RequestType.XAutoClaim; -import static redis_request.RedisRequestOuterClass.RequestType.XClaim; -import static redis_request.RedisRequestOuterClass.RequestType.XDel; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreate; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreateConsumer; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupDelConsumer; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupDestroy; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupSetId; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoConsumers; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoGroups; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoStream; -import static redis_request.RedisRequestOuterClass.RequestType.XLen; -import static redis_request.RedisRequestOuterClass.RequestType.XPending; -import static redis_request.RedisRequestOuterClass.RequestType.XRange; -import static redis_request.RedisRequestOuterClass.RequestType.XRead; -import static redis_request.RedisRequestOuterClass.RequestType.XReadGroup; -import static redis_request.RedisRequestOuterClass.RequestType.XRevRange; -import static redis_request.RedisRequestOuterClass.RequestType.XTrim; -import static redis_request.RedisRequestOuterClass.RequestType.ZAdd; -import static redis_request.RedisRequestOuterClass.RequestType.ZCard; -import static redis_request.RedisRequestOuterClass.RequestType.ZCount; -import static redis_request.RedisRequestOuterClass.RequestType.ZDiff; -import static redis_request.RedisRequestOuterClass.RequestType.ZDiffStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZIncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.ZInter; -import static redis_request.RedisRequestOuterClass.RequestType.ZInterCard; -import static redis_request.RedisRequestOuterClass.RequestType.ZInterStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZLexCount; -import static redis_request.RedisRequestOuterClass.RequestType.ZMPop; -import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; -import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; -import static redis_request.RedisRequestOuterClass.RequestType.ZRandMember; -import static redis_request.RedisRequestOuterClass.RequestType.ZRange; -import static redis_request.RedisRequestOuterClass.RequestType.ZRangeStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZRem; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByLex; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZRevRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZScan; -import static redis_request.RedisRequestOuterClass.RequestType.ZScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZUnion; -import static redis_request.RedisRequestOuterClass.RequestType.ZUnionStore; +import command_request.CommandRequestOuterClass.RequestType; import glide.api.models.GlideString; import glide.api.models.Script; import glide.api.models.Transaction; @@ -373,7 +374,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import redis_request.RedisRequestOuterClass.RequestType; public class RedisClientTest { diff --git a/java/client/src/test/java/glide/api/RedisClusterClientTest.java b/java/client/src/test/java/glide/api/RedisClusterClientTest.java index 228cfc63f4..ceaf691bfa 100644 --- a/java/client/src/test/java/glide/api/RedisClusterClientTest.java +++ b/java/client/src/test/java/glide/api/RedisClusterClientTest.java @@ -1,6 +1,36 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api; +import static command_request.CommandRequestOuterClass.RequestType.ClientGetName; +import static command_request.CommandRequestOuterClass.RequestType.ClientId; +import static command_request.CommandRequestOuterClass.RequestType.ConfigGet; +import static command_request.CommandRequestOuterClass.RequestType.ConfigResetStat; +import static command_request.CommandRequestOuterClass.RequestType.ConfigRewrite; +import static command_request.CommandRequestOuterClass.RequestType.ConfigSet; +import static command_request.CommandRequestOuterClass.RequestType.DBSize; +import static command_request.CommandRequestOuterClass.RequestType.Echo; +import static command_request.CommandRequestOuterClass.RequestType.FCall; +import static command_request.CommandRequestOuterClass.RequestType.FCallReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.FlushAll; +import static command_request.CommandRequestOuterClass.RequestType.FlushDB; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDelete; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDump; +import static command_request.CommandRequestOuterClass.RequestType.FunctionFlush; +import static command_request.CommandRequestOuterClass.RequestType.FunctionKill; +import static command_request.CommandRequestOuterClass.RequestType.FunctionList; +import static command_request.CommandRequestOuterClass.RequestType.FunctionLoad; +import static command_request.CommandRequestOuterClass.RequestType.FunctionRestore; +import static command_request.CommandRequestOuterClass.RequestType.FunctionStats; +import static command_request.CommandRequestOuterClass.RequestType.Info; +import static command_request.CommandRequestOuterClass.RequestType.LastSave; +import static command_request.CommandRequestOuterClass.RequestType.Lolwut; +import static command_request.CommandRequestOuterClass.RequestType.Ping; +import static command_request.CommandRequestOuterClass.RequestType.RandomKey; +import static command_request.CommandRequestOuterClass.RequestType.SPublish; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.Time; +import static command_request.CommandRequestOuterClass.RequestType.UnWatch; import static glide.api.BaseClient.OK; import static glide.api.commands.ServerManagementCommands.VERSION_REDIS_API; import static glide.api.models.GlideString.gs; @@ -23,37 +53,8 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static redis_request.RedisRequestOuterClass.RequestType.ClientGetName; -import static redis_request.RedisRequestOuterClass.RequestType.ClientId; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigGet; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigResetStat; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigRewrite; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigSet; -import static redis_request.RedisRequestOuterClass.RequestType.DBSize; -import static redis_request.RedisRequestOuterClass.RequestType.Echo; -import static redis_request.RedisRequestOuterClass.RequestType.FCall; -import static redis_request.RedisRequestOuterClass.RequestType.FCallReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.FlushAll; -import static redis_request.RedisRequestOuterClass.RequestType.FlushDB; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDelete; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDump; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionFlush; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionKill; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionList; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionLoad; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionRestore; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionStats; -import static redis_request.RedisRequestOuterClass.RequestType.Info; -import static redis_request.RedisRequestOuterClass.RequestType.LastSave; -import static redis_request.RedisRequestOuterClass.RequestType.Lolwut; -import static redis_request.RedisRequestOuterClass.RequestType.Ping; -import static redis_request.RedisRequestOuterClass.RequestType.RandomKey; -import static redis_request.RedisRequestOuterClass.RequestType.SPublish; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.Time; -import static redis_request.RedisRequestOuterClass.RequestType.UnWatch; +import command_request.CommandRequestOuterClass.CommandRequest; import glide.api.models.ClusterTransaction; import glide.api.models.ClusterValue; import glide.api.models.GlideString; @@ -78,7 +79,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import redis_request.RedisRequestOuterClass.RedisRequest; import response.ResponseOuterClass.ConstantResponse; import response.ResponseOuterClass.Response; @@ -190,7 +190,8 @@ public TestCommandManager(Response responseToReturn) { @Override public CompletableFuture submitCommandToChannel( - RedisRequest.Builder command, RedisExceptionCheckedFunction responseHandler) { + CommandRequest.Builder command, + RedisExceptionCheckedFunction responseHandler) { return CompletableFuture.supplyAsync(() -> responseHandler.apply(response)); } } diff --git a/java/client/src/test/java/glide/api/models/ClusterTransactionTests.java b/java/client/src/test/java/glide/api/models/ClusterTransactionTests.java index 7881c0ff0f..07e025a2b9 100644 --- a/java/client/src/test/java/glide/api/models/ClusterTransactionTests.java +++ b/java/client/src/test/java/glide/api/models/ClusterTransactionTests.java @@ -1,25 +1,25 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api.models; +import static command_request.CommandRequestOuterClass.RequestType.SPublish; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; import static glide.api.models.TransactionTests.buildArgs; import static glide.api.models.commands.SortBaseOptions.ALPHA_COMMAND_STRING; import static glide.api.models.commands.SortBaseOptions.LIMIT_COMMAND_STRING; import static glide.api.models.commands.SortBaseOptions.OrderBy.ASC; import static glide.api.models.commands.SortBaseOptions.STORE_COMMAND_STRING; import static org.junit.jupiter.api.Assertions.assertEquals; -import static redis_request.RedisRequestOuterClass.RequestType.SPublish; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; +import command_request.CommandRequestOuterClass.Command; +import command_request.CommandRequestOuterClass.Command.ArgsArray; +import command_request.CommandRequestOuterClass.RequestType; import glide.api.models.commands.SortBaseOptions; import glide.api.models.commands.SortClusterOptions; import java.util.LinkedList; import java.util.List; import org.apache.commons.lang3.tuple.Pair; import org.junit.jupiter.api.Test; -import redis_request.RedisRequestOuterClass.Command; -import redis_request.RedisRequestOuterClass.Command.ArgsArray; -import redis_request.RedisRequestOuterClass.RequestType; public class ClusterTransactionTests { diff --git a/java/client/src/test/java/glide/api/models/StandaloneTransactionTests.java b/java/client/src/test/java/glide/api/models/StandaloneTransactionTests.java index cb525c4c73..645885ee39 100644 --- a/java/client/src/test/java/glide/api/models/StandaloneTransactionTests.java +++ b/java/client/src/test/java/glide/api/models/StandaloneTransactionTests.java @@ -1,6 +1,12 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api.models; +import static command_request.CommandRequestOuterClass.RequestType.Copy; +import static command_request.CommandRequestOuterClass.RequestType.Move; +import static command_request.CommandRequestOuterClass.RequestType.Scan; +import static command_request.CommandRequestOuterClass.RequestType.Select; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; import static glide.api.commands.GenericBaseCommands.REPLACE_REDIS_API; import static glide.api.commands.GenericCommands.DB_REDIS_API; import static glide.api.models.TransactionTests.buildArgs; @@ -16,25 +22,19 @@ import static glide.api.models.commands.scan.ScanOptions.ObjectType.ZSET; import static glide.api.models.commands.scan.ScanOptions.TYPE_OPTION_STRING; import static org.junit.jupiter.api.Assertions.assertEquals; -import static redis_request.RedisRequestOuterClass.RequestType.Copy; -import static redis_request.RedisRequestOuterClass.RequestType.Move; -import static redis_request.RedisRequestOuterClass.RequestType.Scan; -import static redis_request.RedisRequestOuterClass.RequestType.Select; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; +import command_request.CommandRequestOuterClass; import glide.api.models.commands.SortOptions; import glide.api.models.commands.scan.ScanOptions; import java.util.LinkedList; import java.util.List; import org.apache.commons.lang3.tuple.Pair; import org.junit.jupiter.api.Test; -import redis_request.RedisRequestOuterClass; public class StandaloneTransactionTests { @Test public void standalone_transaction_commands() { - List> + List> results = new LinkedList<>(); Transaction transaction = new Transaction(); @@ -198,7 +198,7 @@ public void standalone_transaction_commands() { var protobufTransaction = transaction.getProtobufTransaction().build(); for (int idx = 0; idx < protobufTransaction.getCommandsCount(); idx++) { - RedisRequestOuterClass.Command protobuf = protobufTransaction.getCommands(idx); + CommandRequestOuterClass.Command protobuf = protobufTransaction.getCommands(idx); assertEquals(results.get(idx).getLeft(), protobuf.getRequestType()); assertEquals( diff --git a/java/client/src/test/java/glide/api/models/TransactionTests.java b/java/client/src/test/java/glide/api/models/TransactionTests.java index 1dcbec19ec..42fea6c51c 100644 --- a/java/client/src/test/java/glide/api/models/TransactionTests.java +++ b/java/client/src/test/java/glide/api/models/TransactionTests.java @@ -1,6 +1,193 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.api.models; +import static command_request.CommandRequestOuterClass.RequestType.Append; +import static command_request.CommandRequestOuterClass.RequestType.BLMPop; +import static command_request.CommandRequestOuterClass.RequestType.BLMove; +import static command_request.CommandRequestOuterClass.RequestType.BLPop; +import static command_request.CommandRequestOuterClass.RequestType.BRPop; +import static command_request.CommandRequestOuterClass.RequestType.BZMPop; +import static command_request.CommandRequestOuterClass.RequestType.BZPopMax; +import static command_request.CommandRequestOuterClass.RequestType.BZPopMin; +import static command_request.CommandRequestOuterClass.RequestType.BitCount; +import static command_request.CommandRequestOuterClass.RequestType.BitField; +import static command_request.CommandRequestOuterClass.RequestType.BitFieldReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.BitOp; +import static command_request.CommandRequestOuterClass.RequestType.BitPos; +import static command_request.CommandRequestOuterClass.RequestType.ClientGetName; +import static command_request.CommandRequestOuterClass.RequestType.ClientId; +import static command_request.CommandRequestOuterClass.RequestType.ConfigGet; +import static command_request.CommandRequestOuterClass.RequestType.ConfigResetStat; +import static command_request.CommandRequestOuterClass.RequestType.ConfigRewrite; +import static command_request.CommandRequestOuterClass.RequestType.ConfigSet; +import static command_request.CommandRequestOuterClass.RequestType.Copy; +import static command_request.CommandRequestOuterClass.RequestType.DBSize; +import static command_request.CommandRequestOuterClass.RequestType.Decr; +import static command_request.CommandRequestOuterClass.RequestType.DecrBy; +import static command_request.CommandRequestOuterClass.RequestType.Del; +import static command_request.CommandRequestOuterClass.RequestType.Dump; +import static command_request.CommandRequestOuterClass.RequestType.Echo; +import static command_request.CommandRequestOuterClass.RequestType.Exists; +import static command_request.CommandRequestOuterClass.RequestType.Expire; +import static command_request.CommandRequestOuterClass.RequestType.ExpireAt; +import static command_request.CommandRequestOuterClass.RequestType.ExpireTime; +import static command_request.CommandRequestOuterClass.RequestType.FCall; +import static command_request.CommandRequestOuterClass.RequestType.FCallReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.FlushAll; +import static command_request.CommandRequestOuterClass.RequestType.FlushDB; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDelete; +import static command_request.CommandRequestOuterClass.RequestType.FunctionDump; +import static command_request.CommandRequestOuterClass.RequestType.FunctionFlush; +import static command_request.CommandRequestOuterClass.RequestType.FunctionList; +import static command_request.CommandRequestOuterClass.RequestType.FunctionLoad; +import static command_request.CommandRequestOuterClass.RequestType.FunctionRestore; +import static command_request.CommandRequestOuterClass.RequestType.FunctionStats; +import static command_request.CommandRequestOuterClass.RequestType.GeoAdd; +import static command_request.CommandRequestOuterClass.RequestType.GeoDist; +import static command_request.CommandRequestOuterClass.RequestType.GeoHash; +import static command_request.CommandRequestOuterClass.RequestType.GeoPos; +import static command_request.CommandRequestOuterClass.RequestType.GeoSearch; +import static command_request.CommandRequestOuterClass.RequestType.GeoSearchStore; +import static command_request.CommandRequestOuterClass.RequestType.Get; +import static command_request.CommandRequestOuterClass.RequestType.GetBit; +import static command_request.CommandRequestOuterClass.RequestType.GetDel; +import static command_request.CommandRequestOuterClass.RequestType.GetEx; +import static command_request.CommandRequestOuterClass.RequestType.GetRange; +import static command_request.CommandRequestOuterClass.RequestType.HDel; +import static command_request.CommandRequestOuterClass.RequestType.HExists; +import static command_request.CommandRequestOuterClass.RequestType.HGet; +import static command_request.CommandRequestOuterClass.RequestType.HGetAll; +import static command_request.CommandRequestOuterClass.RequestType.HIncrBy; +import static command_request.CommandRequestOuterClass.RequestType.HIncrByFloat; +import static command_request.CommandRequestOuterClass.RequestType.HKeys; +import static command_request.CommandRequestOuterClass.RequestType.HLen; +import static command_request.CommandRequestOuterClass.RequestType.HMGet; +import static command_request.CommandRequestOuterClass.RequestType.HRandField; +import static command_request.CommandRequestOuterClass.RequestType.HScan; +import static command_request.CommandRequestOuterClass.RequestType.HSet; +import static command_request.CommandRequestOuterClass.RequestType.HSetNX; +import static command_request.CommandRequestOuterClass.RequestType.HStrlen; +import static command_request.CommandRequestOuterClass.RequestType.HVals; +import static command_request.CommandRequestOuterClass.RequestType.Incr; +import static command_request.CommandRequestOuterClass.RequestType.IncrBy; +import static command_request.CommandRequestOuterClass.RequestType.IncrByFloat; +import static command_request.CommandRequestOuterClass.RequestType.Info; +import static command_request.CommandRequestOuterClass.RequestType.LCS; +import static command_request.CommandRequestOuterClass.RequestType.LIndex; +import static command_request.CommandRequestOuterClass.RequestType.LInsert; +import static command_request.CommandRequestOuterClass.RequestType.LLen; +import static command_request.CommandRequestOuterClass.RequestType.LMPop; +import static command_request.CommandRequestOuterClass.RequestType.LMove; +import static command_request.CommandRequestOuterClass.RequestType.LPop; +import static command_request.CommandRequestOuterClass.RequestType.LPos; +import static command_request.CommandRequestOuterClass.RequestType.LPush; +import static command_request.CommandRequestOuterClass.RequestType.LPushX; +import static command_request.CommandRequestOuterClass.RequestType.LRange; +import static command_request.CommandRequestOuterClass.RequestType.LRem; +import static command_request.CommandRequestOuterClass.RequestType.LSet; +import static command_request.CommandRequestOuterClass.RequestType.LTrim; +import static command_request.CommandRequestOuterClass.RequestType.LastSave; +import static command_request.CommandRequestOuterClass.RequestType.Lolwut; +import static command_request.CommandRequestOuterClass.RequestType.MGet; +import static command_request.CommandRequestOuterClass.RequestType.MSet; +import static command_request.CommandRequestOuterClass.RequestType.MSetNX; +import static command_request.CommandRequestOuterClass.RequestType.ObjectEncoding; +import static command_request.CommandRequestOuterClass.RequestType.ObjectFreq; +import static command_request.CommandRequestOuterClass.RequestType.ObjectIdleTime; +import static command_request.CommandRequestOuterClass.RequestType.ObjectRefCount; +import static command_request.CommandRequestOuterClass.RequestType.PExpire; +import static command_request.CommandRequestOuterClass.RequestType.PExpireAt; +import static command_request.CommandRequestOuterClass.RequestType.PExpireTime; +import static command_request.CommandRequestOuterClass.RequestType.PTTL; +import static command_request.CommandRequestOuterClass.RequestType.Persist; +import static command_request.CommandRequestOuterClass.RequestType.PfAdd; +import static command_request.CommandRequestOuterClass.RequestType.PfCount; +import static command_request.CommandRequestOuterClass.RequestType.PfMerge; +import static command_request.CommandRequestOuterClass.RequestType.Ping; +import static command_request.CommandRequestOuterClass.RequestType.Publish; +import static command_request.CommandRequestOuterClass.RequestType.RPop; +import static command_request.CommandRequestOuterClass.RequestType.RPush; +import static command_request.CommandRequestOuterClass.RequestType.RPushX; +import static command_request.CommandRequestOuterClass.RequestType.RandomKey; +import static command_request.CommandRequestOuterClass.RequestType.Rename; +import static command_request.CommandRequestOuterClass.RequestType.RenameNX; +import static command_request.CommandRequestOuterClass.RequestType.Restore; +import static command_request.CommandRequestOuterClass.RequestType.SAdd; +import static command_request.CommandRequestOuterClass.RequestType.SCard; +import static command_request.CommandRequestOuterClass.RequestType.SDiff; +import static command_request.CommandRequestOuterClass.RequestType.SDiffStore; +import static command_request.CommandRequestOuterClass.RequestType.SInter; +import static command_request.CommandRequestOuterClass.RequestType.SInterCard; +import static command_request.CommandRequestOuterClass.RequestType.SInterStore; +import static command_request.CommandRequestOuterClass.RequestType.SIsMember; +import static command_request.CommandRequestOuterClass.RequestType.SMIsMember; +import static command_request.CommandRequestOuterClass.RequestType.SMembers; +import static command_request.CommandRequestOuterClass.RequestType.SMove; +import static command_request.CommandRequestOuterClass.RequestType.SPop; +import static command_request.CommandRequestOuterClass.RequestType.SRandMember; +import static command_request.CommandRequestOuterClass.RequestType.SRem; +import static command_request.CommandRequestOuterClass.RequestType.SScan; +import static command_request.CommandRequestOuterClass.RequestType.SUnion; +import static command_request.CommandRequestOuterClass.RequestType.SUnionStore; +import static command_request.CommandRequestOuterClass.RequestType.Set; +import static command_request.CommandRequestOuterClass.RequestType.SetBit; +import static command_request.CommandRequestOuterClass.RequestType.SetRange; +import static command_request.CommandRequestOuterClass.RequestType.Sort; +import static command_request.CommandRequestOuterClass.RequestType.SortReadOnly; +import static command_request.CommandRequestOuterClass.RequestType.Strlen; +import static command_request.CommandRequestOuterClass.RequestType.TTL; +import static command_request.CommandRequestOuterClass.RequestType.Time; +import static command_request.CommandRequestOuterClass.RequestType.Touch; +import static command_request.CommandRequestOuterClass.RequestType.Type; +import static command_request.CommandRequestOuterClass.RequestType.Unlink; +import static command_request.CommandRequestOuterClass.RequestType.Wait; +import static command_request.CommandRequestOuterClass.RequestType.XAck; +import static command_request.CommandRequestOuterClass.RequestType.XAdd; +import static command_request.CommandRequestOuterClass.RequestType.XAutoClaim; +import static command_request.CommandRequestOuterClass.RequestType.XClaim; +import static command_request.CommandRequestOuterClass.RequestType.XDel; +import static command_request.CommandRequestOuterClass.RequestType.XGroupCreate; +import static command_request.CommandRequestOuterClass.RequestType.XGroupCreateConsumer; +import static command_request.CommandRequestOuterClass.RequestType.XGroupDelConsumer; +import static command_request.CommandRequestOuterClass.RequestType.XGroupDestroy; +import static command_request.CommandRequestOuterClass.RequestType.XGroupSetId; +import static command_request.CommandRequestOuterClass.RequestType.XInfoConsumers; +import static command_request.CommandRequestOuterClass.RequestType.XInfoGroups; +import static command_request.CommandRequestOuterClass.RequestType.XInfoStream; +import static command_request.CommandRequestOuterClass.RequestType.XLen; +import static command_request.CommandRequestOuterClass.RequestType.XPending; +import static command_request.CommandRequestOuterClass.RequestType.XRange; +import static command_request.CommandRequestOuterClass.RequestType.XRead; +import static command_request.CommandRequestOuterClass.RequestType.XReadGroup; +import static command_request.CommandRequestOuterClass.RequestType.XRevRange; +import static command_request.CommandRequestOuterClass.RequestType.XTrim; +import static command_request.CommandRequestOuterClass.RequestType.ZAdd; +import static command_request.CommandRequestOuterClass.RequestType.ZCard; +import static command_request.CommandRequestOuterClass.RequestType.ZCount; +import static command_request.CommandRequestOuterClass.RequestType.ZDiff; +import static command_request.CommandRequestOuterClass.RequestType.ZDiffStore; +import static command_request.CommandRequestOuterClass.RequestType.ZIncrBy; +import static command_request.CommandRequestOuterClass.RequestType.ZInter; +import static command_request.CommandRequestOuterClass.RequestType.ZInterCard; +import static command_request.CommandRequestOuterClass.RequestType.ZInterStore; +import static command_request.CommandRequestOuterClass.RequestType.ZLexCount; +import static command_request.CommandRequestOuterClass.RequestType.ZMPop; +import static command_request.CommandRequestOuterClass.RequestType.ZMScore; +import static command_request.CommandRequestOuterClass.RequestType.ZPopMax; +import static command_request.CommandRequestOuterClass.RequestType.ZPopMin; +import static command_request.CommandRequestOuterClass.RequestType.ZRandMember; +import static command_request.CommandRequestOuterClass.RequestType.ZRange; +import static command_request.CommandRequestOuterClass.RequestType.ZRangeStore; +import static command_request.CommandRequestOuterClass.RequestType.ZRank; +import static command_request.CommandRequestOuterClass.RequestType.ZRem; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByLex; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByRank; +import static command_request.CommandRequestOuterClass.RequestType.ZRemRangeByScore; +import static command_request.CommandRequestOuterClass.RequestType.ZRevRank; +import static command_request.CommandRequestOuterClass.RequestType.ZScan; +import static command_request.CommandRequestOuterClass.RequestType.ZScore; +import static command_request.CommandRequestOuterClass.RequestType.ZUnion; +import static command_request.CommandRequestOuterClass.RequestType.ZUnionStore; import static glide.api.commands.GenericBaseCommands.REPLACE_REDIS_API; import static glide.api.commands.HashBaseCommands.WITH_VALUES_REDIS_API; import static glide.api.commands.ServerManagementCommands.VERSION_REDIS_API; @@ -53,195 +240,11 @@ import static glide.api.models.commands.stream.XInfoStreamOptions.COUNT; import static glide.api.models.commands.stream.XInfoStreamOptions.FULL; import static org.junit.jupiter.api.Assertions.assertEquals; -import static redis_request.RedisRequestOuterClass.RequestType.Append; -import static redis_request.RedisRequestOuterClass.RequestType.BLMPop; -import static redis_request.RedisRequestOuterClass.RequestType.BLMove; -import static redis_request.RedisRequestOuterClass.RequestType.BLPop; -import static redis_request.RedisRequestOuterClass.RequestType.BRPop; -import static redis_request.RedisRequestOuterClass.RequestType.BZMPop; -import static redis_request.RedisRequestOuterClass.RequestType.BZPopMax; -import static redis_request.RedisRequestOuterClass.RequestType.BZPopMin; -import static redis_request.RedisRequestOuterClass.RequestType.BitCount; -import static redis_request.RedisRequestOuterClass.RequestType.BitField; -import static redis_request.RedisRequestOuterClass.RequestType.BitFieldReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.BitOp; -import static redis_request.RedisRequestOuterClass.RequestType.BitPos; -import static redis_request.RedisRequestOuterClass.RequestType.ClientGetName; -import static redis_request.RedisRequestOuterClass.RequestType.ClientId; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigGet; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigResetStat; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigRewrite; -import static redis_request.RedisRequestOuterClass.RequestType.ConfigSet; -import static redis_request.RedisRequestOuterClass.RequestType.Copy; -import static redis_request.RedisRequestOuterClass.RequestType.DBSize; -import static redis_request.RedisRequestOuterClass.RequestType.Decr; -import static redis_request.RedisRequestOuterClass.RequestType.DecrBy; -import static redis_request.RedisRequestOuterClass.RequestType.Del; -import static redis_request.RedisRequestOuterClass.RequestType.Dump; -import static redis_request.RedisRequestOuterClass.RequestType.Echo; -import static redis_request.RedisRequestOuterClass.RequestType.Exists; -import static redis_request.RedisRequestOuterClass.RequestType.Expire; -import static redis_request.RedisRequestOuterClass.RequestType.ExpireAt; -import static redis_request.RedisRequestOuterClass.RequestType.ExpireTime; -import static redis_request.RedisRequestOuterClass.RequestType.FCall; -import static redis_request.RedisRequestOuterClass.RequestType.FCallReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.FlushAll; -import static redis_request.RedisRequestOuterClass.RequestType.FlushDB; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDelete; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionDump; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionFlush; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionList; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionLoad; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionRestore; -import static redis_request.RedisRequestOuterClass.RequestType.FunctionStats; -import static redis_request.RedisRequestOuterClass.RequestType.GeoAdd; -import static redis_request.RedisRequestOuterClass.RequestType.GeoDist; -import static redis_request.RedisRequestOuterClass.RequestType.GeoHash; -import static redis_request.RedisRequestOuterClass.RequestType.GeoPos; -import static redis_request.RedisRequestOuterClass.RequestType.GeoSearch; -import static redis_request.RedisRequestOuterClass.RequestType.GeoSearchStore; -import static redis_request.RedisRequestOuterClass.RequestType.Get; -import static redis_request.RedisRequestOuterClass.RequestType.GetBit; -import static redis_request.RedisRequestOuterClass.RequestType.GetDel; -import static redis_request.RedisRequestOuterClass.RequestType.GetEx; -import static redis_request.RedisRequestOuterClass.RequestType.GetRange; -import static redis_request.RedisRequestOuterClass.RequestType.HDel; -import static redis_request.RedisRequestOuterClass.RequestType.HExists; -import static redis_request.RedisRequestOuterClass.RequestType.HGet; -import static redis_request.RedisRequestOuterClass.RequestType.HGetAll; -import static redis_request.RedisRequestOuterClass.RequestType.HIncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.HIncrByFloat; -import static redis_request.RedisRequestOuterClass.RequestType.HKeys; -import static redis_request.RedisRequestOuterClass.RequestType.HLen; -import static redis_request.RedisRequestOuterClass.RequestType.HMGet; -import static redis_request.RedisRequestOuterClass.RequestType.HRandField; -import static redis_request.RedisRequestOuterClass.RequestType.HScan; -import static redis_request.RedisRequestOuterClass.RequestType.HSet; -import static redis_request.RedisRequestOuterClass.RequestType.HSetNX; -import static redis_request.RedisRequestOuterClass.RequestType.HStrlen; -import static redis_request.RedisRequestOuterClass.RequestType.HVals; -import static redis_request.RedisRequestOuterClass.RequestType.Incr; -import static redis_request.RedisRequestOuterClass.RequestType.IncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.IncrByFloat; -import static redis_request.RedisRequestOuterClass.RequestType.Info; -import static redis_request.RedisRequestOuterClass.RequestType.LCS; -import static redis_request.RedisRequestOuterClass.RequestType.LIndex; -import static redis_request.RedisRequestOuterClass.RequestType.LInsert; -import static redis_request.RedisRequestOuterClass.RequestType.LLen; -import static redis_request.RedisRequestOuterClass.RequestType.LMPop; -import static redis_request.RedisRequestOuterClass.RequestType.LMove; -import static redis_request.RedisRequestOuterClass.RequestType.LPop; -import static redis_request.RedisRequestOuterClass.RequestType.LPos; -import static redis_request.RedisRequestOuterClass.RequestType.LPush; -import static redis_request.RedisRequestOuterClass.RequestType.LPushX; -import static redis_request.RedisRequestOuterClass.RequestType.LRange; -import static redis_request.RedisRequestOuterClass.RequestType.LRem; -import static redis_request.RedisRequestOuterClass.RequestType.LSet; -import static redis_request.RedisRequestOuterClass.RequestType.LTrim; -import static redis_request.RedisRequestOuterClass.RequestType.LastSave; -import static redis_request.RedisRequestOuterClass.RequestType.Lolwut; -import static redis_request.RedisRequestOuterClass.RequestType.MGet; -import static redis_request.RedisRequestOuterClass.RequestType.MSet; -import static redis_request.RedisRequestOuterClass.RequestType.MSetNX; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectEncoding; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectFreq; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectIdleTime; -import static redis_request.RedisRequestOuterClass.RequestType.ObjectRefCount; -import static redis_request.RedisRequestOuterClass.RequestType.PExpire; -import static redis_request.RedisRequestOuterClass.RequestType.PExpireAt; -import static redis_request.RedisRequestOuterClass.RequestType.PExpireTime; -import static redis_request.RedisRequestOuterClass.RequestType.PTTL; -import static redis_request.RedisRequestOuterClass.RequestType.Persist; -import static redis_request.RedisRequestOuterClass.RequestType.PfAdd; -import static redis_request.RedisRequestOuterClass.RequestType.PfCount; -import static redis_request.RedisRequestOuterClass.RequestType.PfMerge; -import static redis_request.RedisRequestOuterClass.RequestType.Ping; -import static redis_request.RedisRequestOuterClass.RequestType.Publish; -import static redis_request.RedisRequestOuterClass.RequestType.RPop; -import static redis_request.RedisRequestOuterClass.RequestType.RPush; -import static redis_request.RedisRequestOuterClass.RequestType.RPushX; -import static redis_request.RedisRequestOuterClass.RequestType.RandomKey; -import static redis_request.RedisRequestOuterClass.RequestType.Rename; -import static redis_request.RedisRequestOuterClass.RequestType.RenameNX; -import static redis_request.RedisRequestOuterClass.RequestType.Restore; -import static redis_request.RedisRequestOuterClass.RequestType.SAdd; -import static redis_request.RedisRequestOuterClass.RequestType.SCard; -import static redis_request.RedisRequestOuterClass.RequestType.SDiff; -import static redis_request.RedisRequestOuterClass.RequestType.SDiffStore; -import static redis_request.RedisRequestOuterClass.RequestType.SInter; -import static redis_request.RedisRequestOuterClass.RequestType.SInterCard; -import static redis_request.RedisRequestOuterClass.RequestType.SInterStore; -import static redis_request.RedisRequestOuterClass.RequestType.SIsMember; -import static redis_request.RedisRequestOuterClass.RequestType.SMIsMember; -import static redis_request.RedisRequestOuterClass.RequestType.SMembers; -import static redis_request.RedisRequestOuterClass.RequestType.SMove; -import static redis_request.RedisRequestOuterClass.RequestType.SPop; -import static redis_request.RedisRequestOuterClass.RequestType.SRandMember; -import static redis_request.RedisRequestOuterClass.RequestType.SRem; -import static redis_request.RedisRequestOuterClass.RequestType.SScan; -import static redis_request.RedisRequestOuterClass.RequestType.SUnion; -import static redis_request.RedisRequestOuterClass.RequestType.SUnionStore; -import static redis_request.RedisRequestOuterClass.RequestType.Set; -import static redis_request.RedisRequestOuterClass.RequestType.SetBit; -import static redis_request.RedisRequestOuterClass.RequestType.SetRange; -import static redis_request.RedisRequestOuterClass.RequestType.Sort; -import static redis_request.RedisRequestOuterClass.RequestType.SortReadOnly; -import static redis_request.RedisRequestOuterClass.RequestType.Strlen; -import static redis_request.RedisRequestOuterClass.RequestType.TTL; -import static redis_request.RedisRequestOuterClass.RequestType.Time; -import static redis_request.RedisRequestOuterClass.RequestType.Touch; -import static redis_request.RedisRequestOuterClass.RequestType.Type; -import static redis_request.RedisRequestOuterClass.RequestType.Unlink; -import static redis_request.RedisRequestOuterClass.RequestType.Wait; -import static redis_request.RedisRequestOuterClass.RequestType.XAck; -import static redis_request.RedisRequestOuterClass.RequestType.XAdd; -import static redis_request.RedisRequestOuterClass.RequestType.XAutoClaim; -import static redis_request.RedisRequestOuterClass.RequestType.XClaim; -import static redis_request.RedisRequestOuterClass.RequestType.XDel; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreate; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreateConsumer; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupDelConsumer; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupDestroy; -import static redis_request.RedisRequestOuterClass.RequestType.XGroupSetId; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoConsumers; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoGroups; -import static redis_request.RedisRequestOuterClass.RequestType.XInfoStream; -import static redis_request.RedisRequestOuterClass.RequestType.XLen; -import static redis_request.RedisRequestOuterClass.RequestType.XPending; -import static redis_request.RedisRequestOuterClass.RequestType.XRange; -import static redis_request.RedisRequestOuterClass.RequestType.XRead; -import static redis_request.RedisRequestOuterClass.RequestType.XReadGroup; -import static redis_request.RedisRequestOuterClass.RequestType.XRevRange; -import static redis_request.RedisRequestOuterClass.RequestType.XTrim; -import static redis_request.RedisRequestOuterClass.RequestType.ZAdd; -import static redis_request.RedisRequestOuterClass.RequestType.ZCard; -import static redis_request.RedisRequestOuterClass.RequestType.ZCount; -import static redis_request.RedisRequestOuterClass.RequestType.ZDiff; -import static redis_request.RedisRequestOuterClass.RequestType.ZDiffStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZIncrBy; -import static redis_request.RedisRequestOuterClass.RequestType.ZInter; -import static redis_request.RedisRequestOuterClass.RequestType.ZInterCard; -import static redis_request.RedisRequestOuterClass.RequestType.ZInterStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZLexCount; -import static redis_request.RedisRequestOuterClass.RequestType.ZMPop; -import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; -import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; -import static redis_request.RedisRequestOuterClass.RequestType.ZRandMember; -import static redis_request.RedisRequestOuterClass.RequestType.ZRange; -import static redis_request.RedisRequestOuterClass.RequestType.ZRangeStore; -import static redis_request.RedisRequestOuterClass.RequestType.ZRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZRem; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByLex; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZRemRangeByScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZRevRank; -import static redis_request.RedisRequestOuterClass.RequestType.ZScan; -import static redis_request.RedisRequestOuterClass.RequestType.ZScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZUnion; -import static redis_request.RedisRequestOuterClass.RequestType.ZUnionStore; import com.google.protobuf.ByteString; +import command_request.CommandRequestOuterClass.Command; +import command_request.CommandRequestOuterClass.Command.ArgsArray; +import command_request.CommandRequestOuterClass.RequestType; import glide.api.models.commands.ConditionalChange; import glide.api.models.commands.GetExOptions; import glide.api.models.commands.InfoOptions; @@ -302,9 +305,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import redis_request.RedisRequestOuterClass.Command; -import redis_request.RedisRequestOuterClass.Command.ArgsArray; -import redis_request.RedisRequestOuterClass.RequestType; public class TransactionTests { private static Stream getTransactionBuilders() { diff --git a/java/client/src/test/java/glide/connection/ConnectionWithGlideMockTests.java b/java/client/src/test/java/glide/connection/ConnectionWithGlideMockTests.java index ebee688e69..d0acd024cb 100644 --- a/java/client/src/test/java/glide/connection/ConnectionWithGlideMockTests.java +++ b/java/client/src/test/java/glide/connection/ConnectionWithGlideMockTests.java @@ -8,6 +8,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import command_request.CommandRequestOuterClass.CommandRequest; import connection_request.ConnectionRequestOuterClass.ConnectionRequest; import connection_request.ConnectionRequestOuterClass.NodeAddress; import glide.api.RedisClient; @@ -28,7 +29,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import redis_request.RedisRequestOuterClass.RedisRequest; import response.ResponseOuterClass.Response; public class ConnectionWithGlideMockTests extends RustCoreLibMockTestBase { @@ -79,7 +79,7 @@ public Response connection(ConnectionRequest request) { } @Override - public Response.Builder redisRequest(RedisRequest request) { + public Response.Builder commandRequest(CommandRequest request) { return null; } }); @@ -102,7 +102,7 @@ public Response connection(ConnectionRequest request) { } @Override - public Response.Builder redisRequest(RedisRequest request) { + public Response.Builder commandRequest(CommandRequest request) { return null; } }); @@ -125,7 +125,7 @@ public Response connection(ConnectionRequest request) { } @Override - public Response.Builder redisRequest(RedisRequest request) { + public Response.Builder commandRequest(CommandRequest request) { return null; } }); @@ -144,7 +144,7 @@ public Response connection(ConnectionRequest request) { } @Override - public Response.Builder redisRequest(RedisRequest request) { + public Response.Builder commandRequest(CommandRequest request) { return null; } }); diff --git a/java/client/src/test/java/glide/managers/CommandManagerTest.java b/java/client/src/test/java/glide/managers/CommandManagerTest.java index 8935fc461b..418377ccd9 100644 --- a/java/client/src/test/java/glide/managers/CommandManagerTest.java +++ b/java/client/src/test/java/glide/managers/CommandManagerTest.java @@ -1,6 +1,7 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.managers; +import static command_request.CommandRequestOuterClass.RequestType.CustomCommand; import static glide.api.models.configuration.RequestRoutingConfiguration.SimpleMultiNodeRoute.ALL_NODES; import static glide.api.models.configuration.RequestRoutingConfiguration.SimpleMultiNodeRoute.ALL_PRIMARIES; import static glide.api.models.configuration.RequestRoutingConfiguration.SimpleSingleNodeRoute.RANDOM; @@ -15,9 +16,11 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static redis_request.RedisRequestOuterClass.RequestType.CustomCommand; import com.google.protobuf.ByteString; +import command_request.CommandRequestOuterClass.CommandRequest; +import command_request.CommandRequestOuterClass.SimpleRoutes; +import command_request.CommandRequestOuterClass.SlotTypes; import glide.api.models.ClusterTransaction; import glide.api.models.Transaction; import glide.api.models.configuration.RequestRoutingConfiguration.ByAddressRoute; @@ -40,9 +43,6 @@ import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; import org.mockito.ArgumentCaptor; -import redis_request.RedisRequestOuterClass.RedisRequest; -import redis_request.RedisRequestOuterClass.SimpleRoutes; -import redis_request.RedisRequestOuterClass.SlotTypes; import response.ResponseOuterClass.Response; public class CommandManagerTest { @@ -146,8 +146,8 @@ public void prepare_request_with_simple_routes(Route routeType) { when(channelHandler.write(any(), anyBoolean())).thenReturn(future); when(channelHandler.isClosed()).thenReturn(false); - ArgumentCaptor captor = - ArgumentCaptor.forClass(RedisRequest.Builder.class); + ArgumentCaptor captor = + ArgumentCaptor.forClass(CommandRequest.Builder.class); service.submitNewCommand(CustomCommand, new String[0], routeType, r -> null); verify(channelHandler).write(captor.capture(), anyBoolean()); @@ -177,8 +177,8 @@ public void prepare_request_with_slot_id_routes(SlotType slotType) { when(channelHandler.write(any(), anyBoolean())).thenReturn(future); when(channelHandler.isClosed()).thenReturn(false); - ArgumentCaptor captor = - ArgumentCaptor.forClass(RedisRequest.Builder.class); + ArgumentCaptor captor = + ArgumentCaptor.forClass(CommandRequest.Builder.class); service.submitNewCommand( CustomCommand, new String[0], new SlotIdRoute(42, slotType), r -> null); @@ -210,8 +210,8 @@ public void prepare_request_with_slot_key_routes(SlotType slotType) { when(channelHandler.write(any(), anyBoolean())).thenReturn(future); when(channelHandler.isClosed()).thenReturn(false); - ArgumentCaptor captor = - ArgumentCaptor.forClass(RedisRequest.Builder.class); + ArgumentCaptor captor = + ArgumentCaptor.forClass(CommandRequest.Builder.class); service.submitNewCommand( CustomCommand, new String[0], new SlotKeyRoute("TEST", slotType), r -> null); @@ -242,8 +242,8 @@ public void prepare_request_with_by_address_route() { when(channelHandler.write(any(), anyBoolean())).thenReturn(future); when(channelHandler.isClosed()).thenReturn(false); - ArgumentCaptor captor = - ArgumentCaptor.forClass(RedisRequest.Builder.class); + ArgumentCaptor captor = + ArgumentCaptor.forClass(CommandRequest.Builder.class); service.submitNewCommand( CustomCommand, new String[0], new ByAddressRoute("testhost", 6379), r -> null); @@ -287,8 +287,8 @@ public void submitNewCommand_with_Transaction_sends_protobuf_request() { when(channelHandler.write(any(), anyBoolean())).thenReturn(future); when(channelHandler.isClosed()).thenReturn(false); - ArgumentCaptor captor = - ArgumentCaptor.forClass(RedisRequest.Builder.class); + ArgumentCaptor captor = + ArgumentCaptor.forClass(CommandRequest.Builder.class); // exercise service.submitNewTransaction(trans, r -> null); @@ -305,7 +305,7 @@ public void submitNewCommand_with_Transaction_sends_protobuf_request() { resultPayloads.add(ByteString.copyFromUtf8("one")); resultPayloads.add(ByteString.copyFromUtf8("two")); resultPayloads.add(ByteString.copyFromUtf8("three")); - for (redis_request.RedisRequestOuterClass.Command command : + for (command_request.CommandRequestOuterClass.Command command : requestBuilder.getTransaction().getCommandsList()) { assertEquals(CustomCommand, command.getRequestType()); assertEquals(ByteString.copyFromUtf8("GETSTRING"), command.getArgsArray().getArgs(0)); @@ -328,8 +328,8 @@ public void submitNewCommand_with_ClusterTransaction_with_route_sends_protobuf_r when(channelHandler.write(any(), anyBoolean())).thenReturn(future); when(channelHandler.isClosed()).thenReturn(false); - ArgumentCaptor captor = - ArgumentCaptor.forClass(RedisRequest.Builder.class); + ArgumentCaptor captor = + ArgumentCaptor.forClass(CommandRequest.Builder.class); service.submitNewTransaction(trans, Optional.of(routeType), r -> null); verify(channelHandler).write(captor.capture(), anyBoolean()); diff --git a/java/client/src/test/java/glide/utils/RustCoreMock.java b/java/client/src/test/java/glide/utils/RustCoreMock.java index 93fa8d0030..c4daa80803 100644 --- a/java/client/src/test/java/glide/utils/RustCoreMock.java +++ b/java/client/src/test/java/glide/utils/RustCoreMock.java @@ -1,6 +1,7 @@ /** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ package glide.utils; +import command_request.CommandRequestOuterClass.CommandRequest; import connection_request.ConnectionRequestOuterClass.ConnectionRequest; import glide.connectors.resources.Platform; import io.netty.bootstrap.ServerBootstrap; @@ -24,7 +25,6 @@ import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; -import redis_request.RedisRequestOuterClass.RedisRequest; import response.ResponseOuterClass.ConstantResponse; import response.ResponseOuterClass.Response; @@ -54,10 +54,10 @@ public byte[] handle(byte[] request) { public abstract Response connection(ConnectionRequest request); /** Return `null` to do not reply. */ - public abstract Response.Builder redisRequest(RedisRequest request); + public abstract Response.Builder commandRequest(CommandRequest request); - public Response redisRequestWithCallbackId(RedisRequest request) { - var responseDraft = redisRequest(request); + public Response commandRequestWithCallbackId(CommandRequest request) { + var responseDraft = commandRequest(request); return responseDraft == null ? null : responseDraft.setCallbackIdx(request.getCallbackIdx()).build(); @@ -166,8 +166,8 @@ public void channelRead(@NonNull ChannelHandlerContext ctx, @NonNull Object msg) response = handler.connection(connection); anybodyConnected.setPlain(true); } else { - var request = RedisRequest.parseFrom(bytes); - response = handler.redisRequestWithCallbackId(request); + var request = CommandRequest.parseFrom(bytes); + response = handler.commandRequestWithCallbackId(request); } if (response != null) { ctx.writeAndFlush(response); diff --git a/node/src/BaseClient.ts b/node/src/BaseClient.ts index f86f39b661..b31b4f7612 100644 --- a/node/src/BaseClient.ts +++ b/node/src/BaseClient.ts @@ -113,7 +113,11 @@ import { TimeoutError, } from "./Errors"; import { Logger } from "./Logger"; -import { connection_request, redis_request, response } from "./ProtobufMessage"; +import { + command_request, + connection_request, + response, +} from "./ProtobufMessage"; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ type PromiseFunction = (value?: any) => void; @@ -373,10 +377,10 @@ export class BaseClient { */ protected createWritePromise( command: - | redis_request.Command - | redis_request.Command[] - | redis_request.ScriptInvocation, - route?: redis_request.Routes, + | command_request.Command + | command_request.Command[] + | command_request.ScriptInvocation, + route?: command_request.Routes, ): Promise { if (this.isClosed) { throw new ClosingError( @@ -387,31 +391,31 @@ export class BaseClient { return new Promise((resolve, reject) => { const callbackIndex = this.getCallbackIndex(); this.promiseCallbackFunctions[callbackIndex] = [resolve, reject]; - this.writeOrBufferRedisRequest(callbackIndex, command, route); + this.writeOrBufferCommandRequest(callbackIndex, command, route); }); } - private writeOrBufferRedisRequest( + private writeOrBufferCommandRequest( callbackIdx: number, command: - | redis_request.Command - | redis_request.Command[] - | redis_request.ScriptInvocation, - route?: redis_request.Routes, + | command_request.Command + | command_request.Command[] + | command_request.ScriptInvocation, + route?: command_request.Routes, ) { const message = Array.isArray(command) - ? redis_request.RedisRequest.create({ + ? command_request.CommandRequest.create({ callbackIdx, - transaction: redis_request.Transaction.create({ + transaction: command_request.Transaction.create({ commands: command, }), }) - : command instanceof redis_request.Command - ? redis_request.RedisRequest.create({ + : command instanceof command_request.Command + ? command_request.CommandRequest.create({ callbackIdx, singleCommand: command, }) - : redis_request.RedisRequest.create({ + : command_request.CommandRequest.create({ callbackIdx, scriptInvocation: command, }); @@ -419,8 +423,8 @@ export class BaseClient { this.writeOrBufferRequest( message, - (message: redis_request.RedisRequest, writer: Writer) => { - redis_request.RedisRequest.encodeDelimited(message, writer); + (message: command_request.CommandRequest, writer: Writer) => { + command_request.CommandRequest.encodeDelimited(message, writer); }, ); } @@ -1627,7 +1631,7 @@ export class BaseClient { script: Script, option?: ScriptOptions, ): Promise { - const scriptInvocation = redis_request.ScriptInvocation.create({ + const scriptInvocation = command_request.ScriptInvocation.create({ hash: script.getHash(), keys: option?.keys?.map((item) => { if (typeof item === "string") { diff --git a/node/src/Commands.ts b/node/src/Commands.ts index 0a16b1ea13..12d3667589 100644 --- a/node/src/Commands.ts +++ b/node/src/Commands.ts @@ -5,9 +5,9 @@ import { createLeakedStringVec, MAX_REQUEST_ARGS_LEN } from "glide-rs"; import Long from "long"; -import { redis_request } from "./ProtobufMessage"; +import { command_request } from "./ProtobufMessage"; -import RequestType = redis_request.RequestType; +import RequestType = command_request.RequestType; function isLargeCommand(args: BulkString[]) { let lenSum = 0; @@ -61,10 +61,10 @@ export function parseInfoResponse(response: string): Record { } function createCommand( - requestType: redis_request.RequestType, + requestType: command_request.RequestType, args: BulkString[], -): redis_request.Command { - const singleCommand = redis_request.Command.create({ +): command_request.Command { + const singleCommand = command_request.Command.create({ requestType, }); @@ -76,7 +76,7 @@ function createCommand( const pointer = new Long(pointerArr[0], pointerArr[1]); singleCommand.argsVecPointer = pointer; } else { - singleCommand.argsArray = redis_request.Command.ArgsArray.create({ + singleCommand.argsArray = command_request.Command.ArgsArray.create({ args: argsBytes, }); } @@ -87,7 +87,7 @@ function createCommand( /** * @internal */ -export function createGet(key: string): redis_request.Command { +export function createGet(key: string): command_request.Command { return createCommand(RequestType.Get, [key]); } @@ -146,7 +146,7 @@ export function createSet( key: BulkString, value: BulkString, options?: SetOptions, -): redis_request.Command { +): command_request.Command { const args = [key, value]; if (options) { @@ -266,7 +266,7 @@ export enum InfoOptions { /** * @internal */ -export function createPing(str?: string): redis_request.Command { +export function createPing(str?: string): command_request.Command { const args: string[] = str == undefined ? [] : [str]; return createCommand(RequestType.Ping, args); } @@ -274,7 +274,7 @@ export function createPing(str?: string): redis_request.Command { /** * @internal */ -export function createInfo(options?: InfoOptions[]): redis_request.Command { +export function createInfo(options?: InfoOptions[]): command_request.Command { const args: string[] = options == undefined ? [] : options; return createCommand(RequestType.Info, args); } @@ -282,42 +282,42 @@ export function createInfo(options?: InfoOptions[]): redis_request.Command { /** * @internal */ -export function createDel(keys: string[]): redis_request.Command { +export function createDel(keys: string[]): command_request.Command { return createCommand(RequestType.Del, keys); } /** * @internal */ -export function createSelect(index: number): redis_request.Command { +export function createSelect(index: number): command_request.Command { return createCommand(RequestType.Select, [index.toString()]); } /** * @internal */ -export function createClientGetName(): redis_request.Command { +export function createClientGetName(): command_request.Command { return createCommand(RequestType.ClientGetName, []); } /** * @internal */ -export function createConfigRewrite(): redis_request.Command { +export function createConfigRewrite(): command_request.Command { return createCommand(RequestType.ConfigRewrite, []); } /** * @internal */ -export function createConfigResetStat(): redis_request.Command { +export function createConfigResetStat(): command_request.Command { return createCommand(RequestType.ConfigResetStat, []); } /** * @internal */ -export function createMGet(keys: string[]): redis_request.Command { +export function createMGet(keys: string[]): command_request.Command { return createCommand(RequestType.MGet, keys); } @@ -326,14 +326,14 @@ export function createMGet(keys: string[]): redis_request.Command { */ export function createMSet( keyValueMap: Record, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.MSet, Object.entries(keyValueMap).flat()); } /** * @internal */ -export function createIncr(key: string): redis_request.Command { +export function createIncr(key: string): command_request.Command { return createCommand(RequestType.Incr, [key]); } @@ -343,7 +343,7 @@ export function createIncr(key: string): redis_request.Command { export function createIncrBy( key: string, amount: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.IncrBy, [key, amount.toString()]); } @@ -353,21 +353,21 @@ export function createIncrBy( export function createIncrByFloat( key: string, amount: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.IncrByFloat, [key, amount.toString()]); } /** * @internal */ -export function createClientId(): redis_request.Command { +export function createClientId(): command_request.Command { return createCommand(RequestType.ClientId, []); } /** * @internal */ -export function createConfigGet(parameters: string[]): redis_request.Command { +export function createConfigGet(parameters: string[]): command_request.Command { return createCommand(RequestType.ConfigGet, parameters); } @@ -376,7 +376,7 @@ export function createConfigGet(parameters: string[]): redis_request.Command { */ export function createConfigSet( parameters: Record, -): redis_request.Command { +): command_request.Command { return createCommand( RequestType.ConfigSet, Object.entries(parameters).flat(), @@ -386,7 +386,10 @@ export function createConfigSet( /** * @internal */ -export function createHGet(key: string, field: string): redis_request.Command { +export function createHGet( + key: string, + field: string, +): command_request.Command { return createCommand(RequestType.HGet, [key, field]); } @@ -396,7 +399,7 @@ export function createHGet(key: string, field: string): redis_request.Command { export function createHSet( key: string, fieldValueMap: Record, -): redis_request.Command { +): command_request.Command { return createCommand( RequestType.HSet, [key].concat(Object.entries(fieldValueMap).flat()), @@ -410,14 +413,14 @@ export function createHSetNX( key: string, field: string, value: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.HSetNX, [key, field, value]); } /** * @internal */ -export function createDecr(key: string): redis_request.Command { +export function createDecr(key: string): command_request.Command { return createCommand(RequestType.Decr, [key]); } @@ -427,7 +430,7 @@ export function createDecr(key: string): redis_request.Command { export function createDecrBy( key: string, amount: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.DecrBy, [key, amount.toString()]); } @@ -437,7 +440,7 @@ export function createDecrBy( export function createHDel( key: string, fields: string[], -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.HDel, [key].concat(fields)); } @@ -447,7 +450,7 @@ export function createHDel( export function createHMGet( key: string, fields: string[], -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.HMGet, [key].concat(fields)); } @@ -457,14 +460,14 @@ export function createHMGet( export function createHExists( key: string, field: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.HExists, [key, field]); } /** * @internal */ -export function createHGetAll(key: string): redis_request.Command { +export function createHGetAll(key: string): command_request.Command { return createCommand(RequestType.HGetAll, [key]); } @@ -474,14 +477,17 @@ export function createHGetAll(key: string): redis_request.Command { export function createLPush( key: string, elements: string[], -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.LPush, [key].concat(elements)); } /** * @internal */ -export function createLPop(key: string, count?: number): redis_request.Command { +export function createLPop( + key: string, + count?: number, +): command_request.Command { const args: string[] = count == undefined ? [key] : [key, count.toString()]; return createCommand(RequestType.LPop, args); } @@ -493,7 +499,7 @@ export function createLRange( key: string, start: number, end: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.LRange, [ key, start.toString(), @@ -504,7 +510,7 @@ export function createLRange( /** * @internal */ -export function createLLen(key: string): redis_request.Command { +export function createLLen(key: string): command_request.Command { return createCommand(RequestType.LLen, [key]); } @@ -515,7 +521,7 @@ export function createLTrim( key: string, start: number, end: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.LTrim, [ key, start.toString(), @@ -530,7 +536,7 @@ export function createLRem( key: string, count: number, element: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.LRem, [key, count.toString(), element]); } @@ -540,14 +546,17 @@ export function createLRem( export function createRPush( key: string, elements: string[], -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.RPush, [key].concat(elements)); } /** * @internal */ -export function createRPop(key: string, count?: number): redis_request.Command { +export function createRPop( + key: string, + count?: number, +): command_request.Command { const args: string[] = count == undefined ? [key] : [key, count.toString()]; return createCommand(RequestType.RPop, args); } @@ -558,7 +567,7 @@ export function createRPop(key: string, count?: number): redis_request.Command { export function createSAdd( key: string, members: string[], -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.SAdd, [key].concat(members)); } @@ -568,14 +577,14 @@ export function createSAdd( export function createSRem( key: string, members: string[], -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.SRem, [key].concat(members)); } /** * @internal */ -export function createSMembers(key: string): redis_request.Command { +export function createSMembers(key: string): command_request.Command { return createCommand(RequestType.SMembers, [key]); } @@ -587,21 +596,21 @@ export function createSMove( source: string, destination: string, member: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.SMove, [source, destination, member]); } /** * @internal */ -export function createSCard(key: string): redis_request.Command { +export function createSCard(key: string): command_request.Command { return createCommand(RequestType.SCard, [key]); } /** * @internal */ -export function createSInter(keys: string[]): redis_request.Command { +export function createSInter(keys: string[]): command_request.Command { return createCommand(RequestType.SInter, keys); } @@ -611,7 +620,7 @@ export function createSInter(keys: string[]): redis_request.Command { export function createSUnionStore( destination: string, keys: string[], -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.SUnionStore, [destination].concat(keys)); } @@ -621,14 +630,17 @@ export function createSUnionStore( export function createSIsMember( key: string, member: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.SIsMember, [key, member]); } /** * @internal */ -export function createSPop(key: string, count?: number): redis_request.Command { +export function createSPop( + key: string, + count?: number, +): command_request.Command { const args: string[] = count == undefined ? [key] : [key, count.toString()]; return createCommand(RequestType.SPop, args); } @@ -647,7 +659,7 @@ export function createHIncrBy( key: string, field: string, amount: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.HIncrBy, [key, field, amount.toString()]); } @@ -658,7 +670,7 @@ export function createHIncrByFloat( key: string, field: string, amount: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.HIncrByFloat, [ key, field, @@ -669,28 +681,28 @@ export function createHIncrByFloat( /** * @internal */ -export function createHLen(key: string): redis_request.Command { +export function createHLen(key: string): command_request.Command { return createCommand(RequestType.HLen, [key]); } /** * @internal */ -export function createHVals(key: string): redis_request.Command { +export function createHVals(key: string): command_request.Command { return createCommand(RequestType.HVals, [key]); } /** * @internal */ -export function createExists(keys: string[]): redis_request.Command { +export function createExists(keys: string[]): command_request.Command { return createCommand(RequestType.Exists, keys); } /** * @internal */ -export function createUnlink(keys: string[]): redis_request.Command { +export function createUnlink(keys: string[]): command_request.Command { return createCommand(RequestType.Unlink, keys); } @@ -722,7 +734,7 @@ export function createExpire( key: string, seconds: number, option?: ExpireOptions, -): redis_request.Command { +): command_request.Command { const args: string[] = option == undefined ? [key, seconds.toString()] @@ -737,7 +749,7 @@ export function createExpireAt( key: string, unixSeconds: number, option?: ExpireOptions, -): redis_request.Command { +): command_request.Command { const args: string[] = option == undefined ? [key, unixSeconds.toString()] @@ -752,7 +764,7 @@ export function createPExpire( key: string, milliseconds: number, option?: ExpireOptions, -): redis_request.Command { +): command_request.Command { const args: string[] = option == undefined ? [key, milliseconds.toString()] @@ -767,7 +779,7 @@ export function createPExpireAt( key: string, unixMilliseconds: number, option?: ExpireOptions, -): redis_request.Command { +): command_request.Command { const args: string[] = option == undefined ? [key, unixMilliseconds.toString()] @@ -778,7 +790,7 @@ export function createPExpireAt( /** * @internal */ -export function createTTL(key: string): redis_request.Command { +export function createTTL(key: string): command_request.Command { return createCommand(RequestType.TTL, [key]); } @@ -807,7 +819,7 @@ export function createZAdd( membersScoresMap: Record, options?: ZAddOptions, changedOrIncr?: "CH" | "INCR", -): redis_request.Command { +): command_request.Command { let args = [key]; if (options) { @@ -859,7 +871,7 @@ export function createZInterstore( destination: string, keys: string[] | KeyWeight[], aggregationType?: AggregationType, -): redis_request.Command { +): command_request.Command { const args = createZCmdStoreArgs(destination, keys, aggregationType); return createCommand(RequestType.ZInterStore, args); } @@ -893,14 +905,14 @@ function createZCmdStoreArgs( export function createZRem( key: string, members: string[], -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.ZRem, [key].concat(members)); } /** * @internal */ -export function createZCard(key: string): redis_request.Command { +export function createZCard(key: string): command_request.Command { return createCommand(RequestType.ZCard, [key]); } @@ -910,7 +922,7 @@ export function createZCard(key: string): redis_request.Command { export function createZInterCard( keys: string[], limit?: number, -): redis_request.Command { +): command_request.Command { let args: string[] = keys; args.unshift(keys.length.toString()); @@ -927,7 +939,7 @@ export function createZInterCard( export function createZScore( key: string, member: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.ZScore, [key, member]); } @@ -1078,7 +1090,7 @@ export function createZCount( key: string, minScore: ScoreBoundary, maxScore: ScoreBoundary, -): redis_request.Command { +): command_request.Command { const args = [key]; args.push(getScoreBoundaryArg(minScore)); args.push(getScoreBoundaryArg(maxScore)); @@ -1092,7 +1104,7 @@ export function createZRange( key: string, rangeQuery: RangeByIndex | RangeByScore | RangeByLex, reverse: boolean = false, -): redis_request.Command { +): command_request.Command { const args = createZRangeArgs(key, rangeQuery, reverse, false); return createCommand(RequestType.ZRange, args); } @@ -1104,7 +1116,7 @@ export function createZRangeWithScores( key: string, rangeQuery: RangeByIndex | RangeByScore | RangeByLex, reverse: boolean = false, -): redis_request.Command { +): command_request.Command { const args = createZRangeArgs(key, rangeQuery, reverse, true); return createCommand(RequestType.ZRange, args); } @@ -1112,14 +1124,14 @@ export function createZRangeWithScores( /** * @internal */ -export function createType(key: string): redis_request.Command { +export function createType(key: string): command_request.Command { return createCommand(RequestType.Type, [key]); } /** * @internal */ -export function createStrlen(key: string): redis_request.Command { +export function createStrlen(key: string): command_request.Command { return createCommand(RequestType.Strlen, [key]); } @@ -1129,7 +1141,7 @@ export function createStrlen(key: string): redis_request.Command { export function createLIndex( key: string, index: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.LIndex, [key, index.toString()]); } @@ -1155,7 +1167,7 @@ export function createLInsert( position: InsertPosition, pivot: string, element: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.LInsert, [key, position, pivot, element]); } @@ -1165,7 +1177,7 @@ export function createLInsert( export function createZPopMin( key: string, count?: number, -): redis_request.Command { +): command_request.Command { const args: string[] = count == undefined ? [key] : [key, count.toString()]; return createCommand(RequestType.ZPopMin, args); } @@ -1176,7 +1188,7 @@ export function createZPopMin( export function createZPopMax( key: string, count?: number, -): redis_request.Command { +): command_request.Command { const args: string[] = count == undefined ? [key] : [key, count.toString()]; return createCommand(RequestType.ZPopMax, args); } @@ -1184,14 +1196,14 @@ export function createZPopMax( /** * @internal */ -export function createEcho(message: string): redis_request.Command { +export function createEcho(message: string): command_request.Command { return createCommand(RequestType.Echo, [message]); } /** * @internal */ -export function createPTTL(key: string): redis_request.Command { +export function createPTTL(key: string): command_request.Command { return createCommand(RequestType.PTTL, [key]); } @@ -1202,7 +1214,7 @@ export function createZRemRangeByRank( key: string, start: number, stop: number, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.ZRemRangeByRank, [ key, start.toString(), @@ -1217,14 +1229,14 @@ export function createZRemRangeByScore( key: string, minScore: ScoreBoundary, maxScore: ScoreBoundary, -): redis_request.Command { +): command_request.Command { const args = [key]; args.push(getScoreBoundaryArg(minScore)); args.push(getScoreBoundaryArg(maxScore)); return createCommand(RequestType.ZRemRangeByScore, args); } -export function createPersist(key: string): redis_request.Command { +export function createPersist(key: string): command_request.Command { return createCommand(RequestType.Persist, [key]); } @@ -1232,7 +1244,7 @@ export function createZRank( key: string, member: string, withScores?: boolean, -): redis_request.Command { +): command_request.Command { const args = [key, member]; if (withScores) { @@ -1317,7 +1329,7 @@ export function createXAdd( key: string, values: [string, string][], options?: StreamAddOptions, -): redis_request.Command { +): command_request.Command { const args = [key]; if (options?.makeStream === false) { @@ -1348,7 +1360,7 @@ export function createXAdd( export function createXTrim( key: string, options: StreamTrimOptions, -): redis_request.Command { +): command_request.Command { const args = [key]; addTrimOptions(options, args); return createCommand(RequestType.XTrim, args); @@ -1357,7 +1369,7 @@ export function createXTrim( /** * @internal */ -export function createTime(): redis_request.Command { +export function createTime(): command_request.Command { return createCommand(RequestType.Time, []); } @@ -1367,7 +1379,7 @@ export function createTime(): redis_request.Command { export function createBRPop( keys: string[], timeout: number, -): redis_request.Command { +): command_request.Command { const args = [...keys, timeout.toString()]; return createCommand(RequestType.BRPop, args); } @@ -1378,7 +1390,7 @@ export function createBRPop( export function createBLPop( keys: string[], timeout: number, -): redis_request.Command { +): command_request.Command { const args = [...keys, timeout.toString()]; return createCommand(RequestType.BLPop, args); } @@ -1429,7 +1441,7 @@ function addStreamsArgs(keys_and_ids: Record, args: string[]) { export function createXRead( keys_and_ids: Record, options?: StreamReadOptions, -): redis_request.Command { +): command_request.Command { const args: string[] = []; if (options) { @@ -1444,7 +1456,7 @@ export function createXRead( /** * @internal */ -export function createXLen(key: string): redis_request.Command { +export function createXLen(key: string): command_request.Command { return createCommand(RequestType.XLen, [key]); } @@ -1454,7 +1466,7 @@ export function createXLen(key: string): redis_request.Command { export function createRename( key: string, newKey: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.Rename, [key, newKey]); } @@ -1464,7 +1476,7 @@ export function createRename( export function createRenameNX( key: string, newKey: string, -): redis_request.Command { +): command_request.Command { return createCommand(RequestType.RenameNX, [key, newKey]); } @@ -1474,7 +1486,7 @@ export function createRenameNX( export function createPfAdd( key: string, elements: string[], -): redis_request.Command { +): command_request.Command { const args = [key, ...elements]; return createCommand(RequestType.PfAdd, args); } @@ -1482,34 +1494,34 @@ export function createPfAdd( /** * @internal */ -export function createPfCount(keys: string[]): redis_request.Command { +export function createPfCount(keys: string[]): command_request.Command { return createCommand(RequestType.PfCount, keys); } /** * @internal */ -export function createObjectEncoding(key: string): redis_request.Command { +export function createObjectEncoding(key: string): command_request.Command { return createCommand(RequestType.ObjectEncoding, [key]); } /** * @internal */ -export function createObjectFreq(key: string): redis_request.Command { +export function createObjectFreq(key: string): command_request.Command { return createCommand(RequestType.ObjectFreq, [key]); } /** * @internal */ -export function createObjectIdletime(key: string): redis_request.Command { +export function createObjectIdletime(key: string): command_request.Command { return createCommand(RequestType.ObjectIdleTime, [key]); } /** * @internal */ -export function createObjectRefcount(key: string): redis_request.Command { +export function createObjectRefcount(key: string): command_request.Command { return createCommand(RequestType.ObjectRefCount, [key]); } diff --git a/node/src/GlideClusterClient.ts b/node/src/GlideClusterClient.ts index efe95bae75..29e5de12c4 100644 --- a/node/src/GlideClusterClient.ts +++ b/node/src/GlideClusterClient.ts @@ -19,7 +19,7 @@ import { createTime, } from "./Commands"; import { RequestError } from "./Errors"; -import { connection_request, redis_request } from "./ProtobufMessage"; +import { connection_request, command_request } from "./ProtobufMessage"; import { ClusterTransaction } from "./Transaction"; /** @@ -130,48 +130,48 @@ export type SingleNodeRoute = function toProtobufRoute( route: Routes | undefined, -): redis_request.Routes | undefined { +): command_request.Routes | undefined { if (route === undefined) { return undefined; } if (route === "allPrimaries") { - return redis_request.Routes.create({ - simpleRoutes: redis_request.SimpleRoutes.AllPrimaries, + return command_request.Routes.create({ + simpleRoutes: command_request.SimpleRoutes.AllPrimaries, }); } else if (route === "allNodes") { - return redis_request.Routes.create({ - simpleRoutes: redis_request.SimpleRoutes.AllNodes, + return command_request.Routes.create({ + simpleRoutes: command_request.SimpleRoutes.AllNodes, }); } else if (route === "randomNode") { - return redis_request.Routes.create({ - simpleRoutes: redis_request.SimpleRoutes.Random, + return command_request.Routes.create({ + simpleRoutes: command_request.SimpleRoutes.Random, }); } else if (route.type === "primarySlotKey") { - return redis_request.Routes.create({ - slotKeyRoute: redis_request.SlotKeyRoute.create({ - slotType: redis_request.SlotTypes.Primary, + return command_request.Routes.create({ + slotKeyRoute: command_request.SlotKeyRoute.create({ + slotType: command_request.SlotTypes.Primary, slotKey: route.key, }), }); } else if (route.type === "replicaSlotKey") { - return redis_request.Routes.create({ - slotKeyRoute: redis_request.SlotKeyRoute.create({ - slotType: redis_request.SlotTypes.Replica, + return command_request.Routes.create({ + slotKeyRoute: command_request.SlotKeyRoute.create({ + slotType: command_request.SlotTypes.Replica, slotKey: route.key, }), }); } else if (route.type === "primarySlotId") { - return redis_request.Routes.create({ - slotKeyRoute: redis_request.SlotIdRoute.create({ - slotType: redis_request.SlotTypes.Primary, + return command_request.Routes.create({ + slotKeyRoute: command_request.SlotIdRoute.create({ + slotType: command_request.SlotTypes.Primary, slotId: route.id, }), }); } else if (route.type === "replicaSlotId") { - return redis_request.Routes.create({ - slotKeyRoute: redis_request.SlotIdRoute.create({ - slotType: redis_request.SlotTypes.Replica, + return command_request.Routes.create({ + slotKeyRoute: command_request.SlotIdRoute.create({ + slotType: command_request.SlotTypes.Replica, slotId: route.id, }), }); @@ -193,7 +193,7 @@ function toProtobufRoute( port = Number(split[1]); } - return redis_request.Routes.create({ + return command_request.Routes.create({ byAddressRoute: { host, port }, }); } diff --git a/node/src/Transaction.ts b/node/src/Transaction.ts index 8e0e70e76a..a127a43373 100644 --- a/node/src/Transaction.ts +++ b/node/src/Transaction.ts @@ -109,7 +109,7 @@ import { createZRemRangeByScore, createZScore, } from "./Commands"; -import { redis_request } from "./ProtobufMessage"; +import { command_request } from "./ProtobufMessage"; /** * Base class encompassing shared commands for both standalone and cluster mode implementations in a transaction. @@ -134,7 +134,7 @@ export class BaseTransaction> { /** * @internal */ - readonly commands: redis_request.Command[] = []; + readonly commands: command_request.Command[] = []; /** * Array of command indexes indicating commands that need to be converted into a `Set` within the transaction. * @internal @@ -148,7 +148,7 @@ export class BaseTransaction> { * @returns The updated transaction instance. */ protected addAndReturn( - command: redis_request.Command, + command: command_request.Command, shouldConvertToSet: boolean = false, ): T { if (shouldConvertToSet) { diff --git a/node/tests/RedisClient.test.ts b/node/tests/RedisClient.test.ts index 0ec781ab17..debe11285d 100644 --- a/node/tests/RedisClient.test.ts +++ b/node/tests/RedisClient.test.ts @@ -14,7 +14,7 @@ import { BufferReader, BufferWriter } from "protobufjs"; import { v4 as uuidv4 } from "uuid"; import { GlideClient, ProtocolVersion, Transaction } from ".."; import { RedisCluster } from "../../utils/TestUtils.js"; -import { redis_request } from "../src/ProtobufMessage"; +import { command_request } from "../src/ProtobufMessage"; import { runBaseTests } from "./SharedTests"; import { checkSimple, @@ -69,7 +69,7 @@ describe("GlideClient", () => { callbackIdx: 1, singleCommand: { requestType: 2, - argsArray: redis_request.Command.ArgsArray.create({ + argsArray: command_request.Command.ArgsArray.create({ args: convertStringArrayToBuffer(["bar1", "bar2"]), }), }, @@ -78,24 +78,24 @@ describe("GlideClient", () => { callbackIdx: 3, singleCommand: { requestType: 4, - argsArray: redis_request.Command.ArgsArray.create({ + argsArray: command_request.Command.ArgsArray.create({ args: convertStringArrayToBuffer(["bar3", "bar4"]), }), }, }; - redis_request.RedisRequest.encodeDelimited(request, writer); - redis_request.RedisRequest.encodeDelimited(request2, writer); + command_request.CommandRequest.encodeDelimited(request, writer); + command_request.CommandRequest.encodeDelimited(request2, writer); const buffer = writer.finish(); const reader = new BufferReader(buffer); - const dec_msg1 = redis_request.RedisRequest.decodeDelimited(reader); + const dec_msg1 = command_request.CommandRequest.decodeDelimited(reader); expect(dec_msg1.callbackIdx).toEqual(1); expect(dec_msg1.singleCommand?.requestType).toEqual(2); expect(dec_msg1.singleCommand?.argsArray?.args).toEqual( convertStringArrayToBuffer(["bar1", "bar2"]), ); - const dec_msg2 = redis_request.RedisRequest.decodeDelimited(reader); + const dec_msg2 = command_request.CommandRequest.decodeDelimited(reader); expect(dec_msg2.callbackIdx).toEqual(3); expect(dec_msg2.singleCommand?.requestType).toEqual(4); expect(dec_msg2.singleCommand?.argsArray?.args).toEqual( diff --git a/node/tests/RedisClientInternals.test.ts b/node/tests/RedisClientInternals.test.ts index c910b3bb1d..8883667c45 100644 --- a/node/tests/RedisClientInternals.test.ts +++ b/node/tests/RedisClientInternals.test.ts @@ -33,12 +33,12 @@ import { Transaction, } from ".."; import { + command_request, connection_request, - redis_request, response, } from "../src/ProtobufMessage"; import { convertStringArrayToBuffer } from "./TestUtilities"; -const { RequestType, RedisRequest } = redis_request; +const { RequestType, CommandRequest } = command_request; beforeAll(() => { Logger.init("info"); @@ -236,14 +236,15 @@ async function testWithClusterResources( async function testSentValueMatches(config: { sendRequest: (client: GlideClient | GlideClusterClient) => Promise; - expectedRequestType: redis_request.RequestType | null | undefined; + expectedRequestType: command_request.RequestType | null | undefined; expectedValue: unknown; }) { let counter = 0; await testWithResources(async (connection, socket) => { socket.on("data", (data) => { const reader = Reader.create(data); - const request = redis_request.RedisRequest.decodeDelimited(reader); + const request = + command_request.CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( config.expectedRequestType, ); @@ -288,7 +289,7 @@ describe("SocketConnectionInternals", () => { await testWithResources(async (connection, socket) => { socket.once("data", (data) => { const reader = Reader.create(data); - const request = RedisRequest.decodeDelimited(reader); + const request = CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Get, ); @@ -342,7 +343,7 @@ describe("SocketConnectionInternals", () => { await testWithResources(async (connection, socket) => { socket.once("data", (data) => { const reader = Reader.create(data); - const request = RedisRequest.decodeDelimited(reader); + const request = CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Get, ); @@ -361,7 +362,7 @@ describe("SocketConnectionInternals", () => { await testWithClusterResources(async (connection, socket) => { socket.once("data", (data) => { const reader = Reader.create(data); - const request = RedisRequest.decodeDelimited(reader); + const request = CommandRequest.decodeDelimited(reader); expect( request.transaction?.commands?.at(0)?.requestType, @@ -390,7 +391,7 @@ describe("SocketConnectionInternals", () => { await testWithClusterResources(async (connection, socket) => { socket.once("data", (data) => { const reader = Reader.create(data); - const request = RedisRequest.decodeDelimited(reader); + const request = CommandRequest.decodeDelimited(reader); expect( request.transaction?.commands?.at(0)?.requestType, @@ -400,7 +401,7 @@ describe("SocketConnectionInternals", () => { ?.length, ).toEqual(1); expect(request.route?.simpleRoutes).toEqual( - redis_request.SimpleRoutes.Random, + command_request.SimpleRoutes.Random, ); sendResponse(socket, ResponseType.Value, request.callbackIdx, { @@ -418,7 +419,7 @@ describe("SocketConnectionInternals", () => { await testWithResources(async (connection, socket) => { socket.once("data", (data) => { const reader = Reader.create(data); - const request = RedisRequest.decodeDelimited(reader); + const request = CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Set, ); @@ -438,7 +439,7 @@ describe("SocketConnectionInternals", () => { const error = "check"; socket.once("data", (data) => { const reader = Reader.create(data); - const request = RedisRequest.decodeDelimited(reader); + const request = CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Get, ); @@ -463,7 +464,7 @@ describe("SocketConnectionInternals", () => { const error = "check"; socket.once("data", (data) => { const reader = Reader.create(data); - const request = RedisRequest.decodeDelimited(reader); + const request = CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Get, ); @@ -491,7 +492,7 @@ describe("SocketConnectionInternals", () => { socket.once("data", (data) => { const reader = Reader.create(data); const request = - redis_request.RedisRequest.decodeDelimited(reader); + command_request.CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Get, ); @@ -514,7 +515,7 @@ describe("SocketConnectionInternals", () => { await testWithResources(async (connection, socket) => { socket.once("data", (data) => { const reader = Reader.create(data); - const request = RedisRequest.decodeDelimited(reader); + const request = CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Set, ); @@ -548,7 +549,7 @@ describe("SocketConnectionInternals", () => { socket.once("data", (data) => { const reader = Reader.create(data); const request = - redis_request.RedisRequest.decodeDelimited(reader); + command_request.CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Get, ); @@ -569,7 +570,7 @@ describe("SocketConnectionInternals", () => { socket.once("data", (data) => { const reader = Reader.create(data); const request = - redis_request.RedisRequest.decodeDelimited(reader); + command_request.CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.Get, ); @@ -662,7 +663,7 @@ describe("SocketConnectionInternals", () => { socket.on("data", (data) => { const reader = Reader.create(data); const request = - redis_request.RedisRequest.decodeDelimited(reader); + command_request.CommandRequest.decodeDelimited(reader); expect(request.singleCommand?.requestType).toEqual( RequestType.CustomCommand, ); @@ -673,7 +674,7 @@ describe("SocketConnectionInternals", () => { .toString() === "SET" ) { expect(request.route?.simpleRoutes).toEqual( - redis_request.SimpleRoutes.AllPrimaries, + command_request.SimpleRoutes.AllPrimaries, ); } else if ( request @@ -681,7 +682,7 @@ describe("SocketConnectionInternals", () => { .toString() === "GET" ) { expect(request.route?.slotKeyRoute).toEqual({ - slotType: redis_request.SlotTypes.Replica, + slotType: command_request.SlotTypes.Replica, slotKey: "foo", }); } else { diff --git a/python/python/glide/async_commands/cluster_commands.py b/python/python/glide/async_commands/cluster_commands.py index d6f9f84db6..391485a558 100644 --- a/python/python/glide/async_commands/cluster_commands.py +++ b/python/python/glide/async_commands/cluster_commands.py @@ -22,7 +22,7 @@ TResult, TSingleNodeRoute, ) -from glide.protobuf.redis_request_pb2 import RequestType +from glide.protobuf.command_request_pb2 import RequestType from glide.routes import Route from ..glide import ClusterScanCursor diff --git a/python/python/glide/async_commands/core.py b/python/python/glide/async_commands/core.py index 454c487e71..b291c571d8 100644 --- a/python/python/glide/async_commands/core.py +++ b/python/python/glide/async_commands/core.py @@ -62,7 +62,7 @@ TXInfoStreamFullResponse, TXInfoStreamResponse, ) -from glide.protobuf.redis_request_pb2 import RequestType +from glide.protobuf.command_request_pb2 import RequestType from glide.routes import Route from ..glide import ClusterScanCursor, Script diff --git a/python/python/glide/async_commands/redis_modules/json.py b/python/python/glide/async_commands/redis_modules/json.py index 72667187d9..d75c2c7a4b 100644 --- a/python/python/glide/async_commands/redis_modules/json.py +++ b/python/python/glide/async_commands/redis_modules/json.py @@ -20,7 +20,7 @@ from glide.async_commands.core import ConditionalChange from glide.constants import TOK, TEncodable, TJsonResponse from glide.glide_client import TGlideClient -from glide.protobuf.redis_request_pb2 import RequestType +from glide.protobuf.command_request_pb2 import RequestType class JsonGetOptions: diff --git a/python/python/glide/async_commands/standalone_commands.py b/python/python/glide/async_commands/standalone_commands.py index c02d32db72..3d4ea8459b 100644 --- a/python/python/glide/async_commands/standalone_commands.py +++ b/python/python/glide/async_commands/standalone_commands.py @@ -21,7 +21,7 @@ TFunctionStatsResponse, TResult, ) -from glide.protobuf.redis_request_pb2 import RequestType +from glide.protobuf.command_request_pb2 import RequestType class StandaloneCommands(CoreCommands): diff --git a/python/python/glide/async_commands/transaction.py b/python/python/glide/async_commands/transaction.py index 14404b4880..5fec2d50eb 100644 --- a/python/python/glide/async_commands/transaction.py +++ b/python/python/glide/async_commands/transaction.py @@ -55,7 +55,7 @@ _create_xpending_range_args, ) from glide.constants import TEncodable -from glide.protobuf.redis_request_pb2 import RequestType +from glide.protobuf.command_request_pb2 import RequestType TTransaction = TypeVar("TTransaction", bound="BaseTransaction") diff --git a/python/python/glide/constants.py b/python/python/glide/constants.py index 33a9c7830a..24c30d8de7 100644 --- a/python/python/glide/constants.py +++ b/python/python/glide/constants.py @@ -2,8 +2,8 @@ from typing import Dict, List, Literal, Mapping, Optional, Set, TypeVar, Union +from glide.protobuf.command_request_pb2 import CommandRequest from glide.protobuf.connection_request_pb2 import ConnectionRequest -from glide.protobuf.redis_request_pb2 import RedisRequest from glide.routes import ByAddressRoute, RandomNode, SlotIdRoute, SlotKeyRoute OK: str = "OK" @@ -26,7 +26,7 @@ Dict[bytes, "TResult"], Mapping[bytes, "TResult"], ] -TRequest = Union[RedisRequest, ConnectionRequest] +TRequest = Union[CommandRequest, ConnectionRequest] # When routing to a single node, response will be T # Otherwise, response will be : {Address : response , ... } with type of Dict[str, T]. TClusterResponse = Union[T, Dict[bytes, T]] diff --git a/python/python/glide/glide_client.py b/python/python/glide/glide_client.py index 2ee030c555..8f54eced07 100644 --- a/python/python/glide/glide_client.py +++ b/python/python/glide/glide_client.py @@ -22,8 +22,8 @@ ) from glide.logger import Level as LogLevel from glide.logger import Logger as ClientLogger +from glide.protobuf.command_request_pb2 import Command, CommandRequest, RequestType from glide.protobuf.connection_request_pb2 import ConnectionRequest -from glide.protobuf.redis_request_pb2 import Command, RedisRequest, RequestType from glide.protobuf.response_pb2 import RequestErrorType, Response from glide.protobuf_codec import PartialMessageException, ProtobufCodec from glide.routes import Route, set_protobuf_route @@ -248,7 +248,7 @@ async def _execute_command( raise ClosingError( "Unable to execute requests; the client is closed. Please create a new client." ) - request = RedisRequest() + request = CommandRequest() request.callback_idx = self._get_callback_index() request.single_command.request_type = request_type request.single_command.args_array.args[:] = [ @@ -274,7 +274,7 @@ async def _execute_transaction( raise ClosingError( "Unable to execute requests; the client is closed. Please create a new client." ) - request = RedisRequest() + request = CommandRequest() request.callback_idx = self._get_callback_index() transaction_commands = [] for requst_type, args in commands: @@ -303,7 +303,7 @@ async def _execute_script( raise ClosingError( "Unable to execute requests; the client is closed. Please create a new client." ) - request = RedisRequest() + request = CommandRequest() request.callback_idx = self._get_callback_index() (encoded_keys, keys_size) = self._encode_and_sum_size(keys) (encoded_args, args_size) = self._encode_and_sum_size(args) @@ -438,7 +438,7 @@ def _complete_pubsub_futures_safe(self): if pubsub_message: self._pubsub_futures.pop(0).set_result(pubsub_message) - async def _write_request_await_response(self, request: RedisRequest): + async def _write_request_await_response(self, request: CommandRequest): # Create a response future for this request and add it to the available # futures map response_future = self._get_future(request.callback_idx) @@ -546,7 +546,7 @@ async def _cluster_scan( raise ClosingError( "Unable to execute requests; the client is closed. Please create a new client." ) - request = RedisRequest() + request = CommandRequest() request.callback_idx = self._get_callback_index() # Take out the id string from the wrapping object cursor_string = cursor.get_cursor() diff --git a/python/python/glide/routes.py b/python/python/glide/routes.py index a0c62cb70e..580f85beb0 100644 --- a/python/python/glide/routes.py +++ b/python/python/glide/routes.py @@ -4,8 +4,8 @@ from typing import Optional from glide.exceptions import RequestError -from glide.protobuf.redis_request_pb2 import RedisRequest, SimpleRoutes -from glide.protobuf.redis_request_pb2 import SlotTypes as ProtoSlotTypes +from glide.protobuf.command_request_pb2 import CommandRequest, SimpleRoutes +from glide.protobuf.command_request_pb2 import SlotTypes as ProtoSlotTypes class SlotType(Enum): @@ -92,7 +92,7 @@ def to_protobuf_slot_type(slot_type: SlotType) -> ProtoSlotTypes.ValueType: ) -def set_protobuf_route(request: RedisRequest, route: Optional[Route]) -> None: +def set_protobuf_route(request: CommandRequest, route: Optional[Route]) -> None: if route is None: return elif isinstance(route, AllNodes): diff --git a/python/python/tests/test_proto_coded.py b/python/python/tests/test_proto_coded.py index 2c0a248a1f..3834e5d1dc 100644 --- a/python/python/tests/test_proto_coded.py +++ b/python/python/tests/test_proto_coded.py @@ -1,14 +1,14 @@ # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 import pytest -from glide.protobuf.redis_request_pb2 import RedisRequest, RequestType +from glide.protobuf.command_request_pb2 import CommandRequest, RequestType from glide.protobuf.response_pb2 import Response from glide.protobuf_codec import PartialMessageException, ProtobufCodec class TestProtobufCodec: def test_encode_decode_delimited(self): - request = RedisRequest() + request = CommandRequest() request.callback_idx = 1 request.single_command.request_type = RequestType.Set args = [ @@ -26,7 +26,7 @@ def test_encode_decode_delimited(self): offset = 0 b_arr_view = memoryview(b_arr) parsed_request, new_offset = ProtobufCodec.decode_delimited( - b_arr, b_arr_view, offset, RedisRequest + b_arr, b_arr_view, offset, CommandRequest ) assert new_offset == len(b_arr) assert parsed_request.callback_idx == 1