Skip to content

Commit

Permalink
changing transaction method to be under basetransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
TJ Zhang committed Jun 29, 2024
1 parent b7e4684 commit 2f3b564
Showing 1 changed file with 22 additions and 44 deletions.
66 changes: 22 additions & 44 deletions python/python/glide/async_commands/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -3859,6 +3859,28 @@ def lolwut(
args.extend(str(var))
return self.append_command(RequestType.Lolwut, args)

def wait(
self: TTransaction,
numreplicas: int,
timeout: int,
) -> TTransaction:
"""
Blocks the current client until all the previous write commands are successfully transferred
and acknowledged by at least `numreplicas` of replicas. If `timeout` is
reached, the command returns even if the specified number of replicas were not yet reached.
See https://valkey.io/commands/wait for more details.
Args:
numreplicas (int): The number of replicas to reach.
timeout (int): The timeout value specified in milliseconds.
Command Response:
str: The number of replicas reached by all the writes performed in the context of the current connection.
"""
args = [str(numreplicas), str(timeout)]
return self.append_command(RequestType.Wait, args)


class Transaction(BaseTransaction):
"""
Expand Down Expand Up @@ -4040,28 +4062,6 @@ def copy(

return self.append_command(RequestType.Copy, args)

def wait(
self: TTransaction,
numreplicas: int,
timeout: int,
) -> TTransaction:
"""
Blocks the current client until all the previous write commands are successfully transferred
and acknowledged by at least `numreplicas` of replicas. If `timeout` is
reached, the command returns even if the specified number of replicas were not yet reached.
See https://valkey.io/commands/wait for more details.
Args:
numreplicas (int): The number of replicas to reach.
timeout (int): The timeout value specified in milliseconds.
Command Response:
str: The number of replicas reached by all the writes performed in the context of the current connection.
"""
args = [str(numreplicas), str(timeout)]
return self.append_command(RequestType.Wait, args)


class ClusterTransaction(BaseTransaction):
"""
Expand Down Expand Up @@ -4157,26 +4157,4 @@ def copy(

return self.append_command(RequestType.Copy, args)

def wait(
self: TTransaction,
numreplicas: int,
timeout: int,
) -> TTransaction:
"""
Blocks the current client until all the previous write commands are successfully transferred
and acknowledged by at least `numreplicas` of replicas. If `timeout` is
reached, the command returns even if the specified number of replicas were not yet reached.
See https://valkey.io/commands/wait for more details.
Args:
numreplicas (int): The number of replicas to reach.
timeout (int): The timeout value specified in milliseconds.
Command Response:
str: The number of replicas reached by all the writes performed in the context of the current connection.
"""
args = [str(numreplicas), str(timeout)]
return self.append_command(RequestType.Wait, args)

# TODO: add all CLUSTER commands

0 comments on commit 2f3b564

Please sign in to comment.