Skip to content

Commit

Permalink
change the name of the execute functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Adan committed Feb 1, 2024
1 parent 987d430 commit dac826c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion python/python/glide/async_commands/cluster_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def exec(
If the transaction failed due to a WATCH command, `exec` will return `None`.
"""
commands = transaction.commands[:]
return await self.execute_transaction(commands, route)
return await self._execute_transaction(commands, route)

async def config_resetstat(
self,
Expand Down
9 changes: 4 additions & 5 deletions python/python/glide/async_commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,19 @@ async def _execute_command(
route: Optional[Route] = ...,
) -> TResult: ...

async def execute_transaction(
async def _execute_transaction(
self,
commands: List[Tuple[RequestType.ValueType, List[str]]],
route: Optional[Route] = None,
) -> List[TResult]: ...

async def execute_script(
async def _execute_script(
self,
hash: str,
keys: Optional[List[str]] = None,
args: Optional[List[str]] = None,
route: Optional[Route] = None,
) -> TResult:
...
) -> TResult: ...

async def set(
self,
Expand Down Expand Up @@ -1272,4 +1271,4 @@ async def invoke_script(
>>> await invoke_script(lua_script, keys=["foo"], args=["bar"] );
["foo", "bar"]
"""
return await self.execute_script(script.get_hash(), keys, args)
return await self._execute_script(script.get_hash(), keys, args)
2 changes: 1 addition & 1 deletion python/python/glide/async_commands/standalone_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def exec(
If the transaction failed due to a WATCH command, `exec` will return `None`.
"""
commands = transaction.commands[:]
return await self.execute_transaction(commands)
return await self._execute_transaction(commands)

async def select(self, index: int) -> TOK:
"""Change the currently selected Redis database.
Expand Down
21 changes: 7 additions & 14 deletions python/python/glide/redis_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,9 @@ async def _execute_command(
request.single_command.request_type = request_type
request.single_command.args_array.args[:] = args # TODO - use arg pointer
set_protobuf_route(request, route)
# Create a response future for this request and add it to the available
# futures map
response_future = self._get_future(request.callback_idx)
self._create_write_task(request)
await response_future
return response_future.result()
return await self._write_request_await_response(request)

async def execute_transaction(
async def _execute_transaction(
self,
commands: List[Tuple[RequestType.ValueType, List[str]]],
route: Optional[Route] = None,
Expand All @@ -223,14 +218,9 @@ async def execute_transaction(
transaction_commands.append(command)
request.transaction.commands.extend(transaction_commands)
set_protobuf_route(request, route)
# Create a response future for this request and add it to the available
# futures map
response_future = self._get_future(request.callback_idx)
self._create_write_task(request)
await response_future
return response_future.result()
return await self._write_request_await_response(request)

async def execute_script(
async def _execute_script(
self,
hash: str,
keys: Optional[List[str]] = None,
Expand All @@ -247,6 +237,9 @@ async def execute_script(
request.script_invocation.args[:] = args if args is not None else []
request.script_invocation.keys[:] = keys if keys is not None else []
set_protobuf_route(request, route)
return await self._write_request_await_response(request)

async def _write_request_await_response(self, request: RedisRequest):
# Create a response future for this request and add it to the available
# futures map
response_future = self._get_future(request.callback_idx)
Expand Down

0 comments on commit dac826c

Please sign in to comment.