Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: adds XADD, XTRIM commands #1320

Merged
merged 6 commits into from
May 2, 2024

Conversation

shohamazon
Copy link
Collaborator

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Yury-Fridlyand
Copy link
Collaborator

@acarbonetto please sync docs with your PRs

str(self.threshold),
]
if self.limit is not None:
option_args.extend(["LIMIT", str(self.limit)])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make LIMIT, MINID and other keywords constants

self,
key: str,
values: List[Tuple[str, str]],
options: StreamAddOptions = StreamAddOptions(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make options optional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that necessary, since we are giving it a default value

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to set it as optional - we don't need to pass the make_stream value if the user doesn't want to send it.

)
is not None
)
assert await redis_client.custom_command(["XLEN", key]) == 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a TODO to replace with XLEN implementation

)

assert id is not None
assert await redis_client.custom_command(["XLEN", key]) == 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add TODO to replace with XLEN implementation

@shohamazon shohamazon requested a review from ikolomi April 24, 2024 14:49
threshold (int): Threshold for trimming by maximum length.
limit (Optional[int], optional): Max number of entries to be trimmed. Defaults to None.
"""
super().__init__(exact, threshold, "MAXLEN", limit)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

limit cannot be set when exact is set to true. We should consider a builder that sets either exact OR limit - not both.

threshold (str): Threshold for trimming by minimum ID.
limit (Optional[int], optional): Max number of entries to be trimmed. Defaults to None.
"""
super().__init__(exact, threshold, "MINID", limit)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

limit cannot be set when exact is set to true. We should consider a builder that sets either exact OR limit - not both.

self,
key: str,
values: List[Tuple[str, str]],
options: StreamAddOptions = StreamAddOptions(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to set it as optional - we don't need to pass the make_stream value if the user doesn't want to send it.

@shohamazon shohamazon force-pushed the python/streams branch 3 times, most recently from 16624d3 to 04b8ba3 Compare May 1, 2024 10:17
@shohamazon shohamazon merged commit b27fb7b into valkey-io:main May 2, 2024
6 checks passed
@shohamazon shohamazon deleted the python/streams branch May 2, 2024 16:01
tjzhang-BQ pushed a commit to Bit-Quill/valkey-glide that referenced this pull request May 8, 2024
cyip10 pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants