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

Add support for blocking command BZMPOP #233

Closed
Tracked by #231
chayim opened this issue Jan 1, 2024 · 0 comments
Closed
Tracked by #231

Add support for blocking command BZMPOP #233

chayim opened this issue Jan 1, 2024 · 0 comments
Assignees
Milestone

Comments

@chayim
Copy link
Contributor

chayim commented Jan 1, 2024

No description provided.

@gerzse gerzse self-assigned this Jan 24, 2024
@gerzse gerzse changed the title Add support for blocking command BZPOP Add support for blocking command BZMPOP Jan 25, 2024
gerzse added a commit to gerzse/NRedisStack that referenced this issue Jan 25, 2024
Add support for the BZMPOP command.

This command is blocking on the server, so it goes against the current
policy of the StackExchange.Redis library. Therefore make it obvious in
the code documentation that attention must be given to the timeout in
the connection multiplexer.

The StackExchange.Redis library already defines a type for the payload
returned by BZMPOP (which is the same as for ZMPOP), namely the
SortedSetPopResult class. However, the constructor of that class is
internal in the library, so we can't create instances of it. Therefore
roll our out type for a <value, score> pair, and use Tuple to pair a key
with a list of such <value, score> pairs.
@chayim chayim added this to the commands milestone Jan 30, 2024
gerzse added a commit to gerzse/NRedisStack that referenced this issue Feb 5, 2024
Add support for the BZMPOP command.

This command is blocking on the server, so it goes against the current
policy of the StackExchange.Redis library. Therefore make it obvious in
the code documentation that attention must be given to the timeout in
the connection multiplexer.

The StackExchange.Redis library already defines a type for the payload
returned by BZMPOP (which is the same as for ZMPOP), namely the
SortedSetPopResult class. However, the constructor of that class is
internal in the library, so we can't create instances of it. Therefore
roll our out type for a <value, score> pair, and use Tuple to pair a key
with a list of such <value, score> pairs.
gerzse added a commit to gerzse/NRedisStack that referenced this issue Feb 5, 2024
Add support for the BZMPOP command.

This command is blocking on the server, so it goes against the current
policy of the StackExchange.Redis library. Therefore make it obvious in
the code documentation that attention must be given to the timeout in
the connection multiplexer.

The StackExchange.Redis library already defines a type for the payload
returned by BZMPOP (which is the same as for ZMPOP), namely the
SortedSetPopResult class. However, the constructor of that class is
internal in the library, so we can't create instances of it. Therefore
roll our out type for a <value, score> pair, and use Tuple to pair a key
with a list of such <value, score> pairs.
gerzse added a commit to gerzse/NRedisStack that referenced this issue Feb 5, 2024
Add support for the BZMPOP command.

This command is blocking on the server, so it goes against the current
policy of the StackExchange.Redis library. Therefore make it obvious in
the code documentation that attention must be given to the timeout in
the connection multiplexer.

The StackExchange.Redis library already defines a type for the payload
returned by BZMPOP (which is the same as for ZMPOP), namely the
SortedSetPopResult class. However, the constructor of that class is
internal in the library, so we can't create instances of it. Therefore
roll our out type for a <value, score> pair, and use Tuple to pair a key
with a list of such <value, score> pairs.
gerzse added a commit to gerzse/NRedisStack that referenced this issue Feb 6, 2024
Add support for the BZMPOP, BZPOPMIN, BZPOPMAX commands.

Issues redis#232, redis#233 and redis#234.

These commands are blocking on the server, so they go against the current
policy of the StackExchange.Redis library. Therefore make it obvious in
the code documentation that attention must be given to the timeout in
the connection multiplexer, client-side.

The StackExchange.Redis library already defines a type for the payload
returned by BZMPOP (which is the same as for ZMPOP), namely the
SortedSetPopResult class. However, the constructor of that class is
internal in the library, so we can't create instances of it. Therefore
roll our out type for a <value, score> pair, and use Tuple to pair a key
with a list of such <value, score> pairs.

Instead of using Order to signal from which end of the sorted set to
pop, define a MinMaxModifier enum, which more clearly expresses the
intention and maps directly to the Redis command being executed.
gerzse added a commit to gerzse/NRedisStack that referenced this issue Feb 6, 2024
Add support for the BZMPOP, BZPOPMIN, BZPOPMAX commands.

Issues redis#232, redis#233 and redis#234.

These commands are blocking on the server, so they go against the current
policy of the StackExchange.Redis library. Therefore make it obvious in
the code documentation that attention must be given to the timeout in
the connection multiplexer, client-side.

The StackExchange.Redis library already defines a type for the payload
returned by BZMPOP (which is the same as for ZMPOP), namely the
SortedSetPopResult class. However, the constructor of that class is
internal in the library, so we can't create instances of it. Therefore
roll our out type for a <value, score> pair, and use Tuple to pair a key
with a list of such <value, score> pairs.

Instead of using Order to signal from which end of the sorted set to
pop, define a MinMaxModifier enum, which more clearly expresses the
intention and maps directly to the Redis command being executed.
shacharPash pushed a commit that referenced this issue Feb 13, 2024
* Formatting and typos

Fix some typos in the markdown files and run `dotnet format` on existing
code.

* Include documentation in the build

Change the settings so that documentation is included in the build.

* Add support for BZMPOP, BZPOPMIN and BZPOPMAX

Add support for the BZMPOP, BZPOPMIN, BZPOPMAX commands.

Issues #232, #233 and #234.

These commands are blocking on the server, so they go against the current
policy of the StackExchange.Redis library. Therefore make it obvious in
the code documentation that attention must be given to the timeout in
the connection multiplexer, client-side.

The StackExchange.Redis library already defines a type for the payload
returned by BZMPOP (which is the same as for ZMPOP), namely the
SortedSetPopResult class. However, the constructor of that class is
internal in the library, so we can't create instances of it. Therefore
roll our out type for a <value, score> pair, and use Tuple to pair a key
with a list of such <value, score> pairs.

Instead of using Order to signal from which end of the sorted set to
pop, define a MinMaxModifier enum, which more clearly expresses the
intention and maps directly to the Redis command being executed.

---------

Co-authored-by: Gabriel Erzse <[email protected]>
@gerzse gerzse closed this as completed Feb 13, 2024
gerzse added a commit to gerzse/NRedisStack that referenced this issue Feb 26, 2024
Issues redis#232, redis#233, redis#234, redis#235, redis#237, redis#248, redis#249, redis#250, redis#251, redis#255

Add the async versions for the blocking commands: BZPOPMIN, BZPOPMAX,
BZMPOP, BLMOVE, BLMPOP, BLPOP, BRPOP, BRPOPLPUSH, XREAD and XREADGROUP.
shacharPash added a commit that referenced this issue Mar 6, 2024
* Add support for blocking XREAD and XREADGROUP

Issues #237 and #255.

* Extend unit test coverage

* Async blocking commands

Issues #232, #233, #234, #235, #237, #248, #249, #250, #251, #255

Add the async versions for the blocking commands: BZPOPMIN, BZPOPMAX,
BZMPOP, BLMOVE, BLMPOP, BLPOP, BRPOP, BRPOPLPUSH, XREAD and XREADGROUP.

---------

Co-authored-by: Gabriel Erzse <[email protected]>
Co-authored-by: shacharPash <[email protected]>
shacharPash added a commit that referenced this issue Mar 19, 2024
* Formatting and typos

Fix some typos in the markdown files and run `dotnet format` on existing
code.

* Include documentation in the build

Change the settings so that documentation is included in the build.

* Add support for BZMPOP (#233)

Add support for the BZMPOP command.

This command is blocking on the server, so it goes against the current
policy of the StackExchange.Redis library. Therefore make it obvious in
the code documentation that attention must be given to the timeout in
the connection multiplexer.

The StackExchange.Redis library already defines a type for the payload
returned by BZMPOP (which is the same as for ZMPOP), namely the
SortedSetPopResult class. However, the constructor of that class is
internal in the library, so we can't create instances of it. Therefore
roll our out type for a <value, score> pair, and use Tuple to pair a key
with a list of such <value, score> pairs.

* Skip new tests for Redis Cluster

* Refactor and Change the List Collection to ICollection for better performance and memory usage

* Change NameSpace to Scoped

* Add Db to xml summary doc

* Fix Typo problem

* Change constructor to primary constructor based on new feature in .net 8

* Fix Type for previously

* refactor and Use Collection Expression for list initializing and change foreach to linq expression

* use primary constructor in CmsCommands.cs

* use primary constructor in CmsCommands.cs

* Refactor and change constructor to primary

* Fix Typo and indent in CommandArgs.cs and  IJsonCommands.cs

* Fix Typo in ExampleTests.cs and IJsonCommandsAsync.cs and JsonCommandsAsync.cs and JsonTests.cs

* Use Linq and List Expression

* Refactor

* Improve the signatures of the new methods

Improve the signatures of the new methods, to transparently replicate
the structure of the Redis command, i.e. timeout is mandatory and the
first argument, order is mandatory.

Add a version of the method that works for a single argument, in the
spirit of the StackExchange.Redis library.

* Add test for BzmPop without keys

* Add dedicated enum for MIN/MAX

Add a dedicated enum for the MIN and MAX arguments. It feels cleaner
than using Order and having to mentally map Ascending to Min and
Descending to Max.

* Remove primary constructor syntax

The primary constructor syntax seems to be not supported by older dotnet
versions, so don't use it. Also switch from `class` to `struct`, to
better reflect the fact that RedisValueWithScore is just a data storage
item.

* Separate concurrency groups for GitHub workflows

It seems that workflows cancel each other out if they are in the same
concurrency group: https://github.com/orgs/community/discussions/41518

Try to separate four workflows that run on PRs into separate concurency
groups. Ideally this will avoid the cancelation.

They should still cancel runs from previous pushes, each in their own
group.

* Fix indent in CuckooInformation.cs

* RollBack to original version of naming NumIncrbyAsync method in JsonCommandsAsync.cs

* Remove use of collection literals

Collection literals are not supported by older dotnet versions, it
seems, so stop using them for now.

* Increase multiplexer timeout in tests

Some tests (for the Gears module) seem flaky, they fails sometime with
RedisTimeoutException. Try to double the timeout in the connection
multiplexer, from 5 to 10 seconds, hopefully this helps.

* Try to fix the linter workflow

* [Fix]
1.I fixed typo problems in this class at first
After that,
2. I used collection expression to better understand the code and avoid additional coding and optimize coding based on c# doc:
 https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/collection-expressions
 3.then Remove unused usings
 4.Then I commented the places that were not Handled for Try Catch
 5.refactor to primary constructor

* Use Linq Expression in JsonCommandBuilder.cs for reduce the amount of code in a file and make the code easier to read, and allow different data sources to have similar query expression

* RollBack to original naming for NumIncrbyAsync

* RollBack to original naming

* Refactored C# code using collection expressions and the :? operator for improved clarity and efficiency.

* Used Inverted If technique and removed redundant else for code optimization and improved clarity.

* Used Invert If technique and removed redundant else for code optimization and improved clarity

* Sync Namespace and use scoped namespace and use operator instead if

* ConvertMultiBulkToObject for handle multi-bulk based on your todo in AggregationResult.cs

* Optimized codebase by removing redundant elements for improved efficiency and maintainability

* Sort Modifier and inverting if in Auxiliary.cs
ExecuteAsync Method and RedisResult method and change foreach in MergeArgs to linq expression
I think methods like "ExecuteBroadcastAsync" can be private

* Sync NameSpaces also you can use ITestOutputHelper for output your test results based on xUnit Doc:
https://xunit.net/docs/capturing-output

* fix CoreCommand file

* Fix bug for build Doc Tests and return to orginal version
beacuse the old version of .net doesnt support test console for xunit and its failed

* fix error

* Roleback  ' List<object> args = [key];'
 to previous version becuase the old version of .net does not support the .net 8 syntax

* fix compilation error

* format

* Fix Indent and Solve Problem of old .net version with feature primary constructor in .net 8

* Fix Issues for compiler error in .net 8 error CS8652: The feature 'collection literals'

* Fix Compiler Error in JsonCommandsAsync.cs and JsonCommands.cs for Error : error CS8652: The feature 'collection literals' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version

* return ExampleTests's ctor

* Fix typo for TransactionsTests.cs in method naming TestModulesTransactionWithoutGraph

* Fix Typo and namespace also Set Private Access Modifier RedisFixture.cs for readonly strings

* Fix Typo and set const for readonly key PipelineTests.cs

* Fix Typo and Change Namespace to scoped AbstractNRedisStackTest.cs and Person.cs

* Return to Collection Initializer for collections in ExampleTests.cs

* Return `ExecuteAsync` method in Auxiliary.cs to original version for sole complexity

* Revert ToString() in code snippets

Trying to keep code snippets as short as possible, since they get
published on redis.io as documentation. Hence reverting the addition of
the `ToString()` calls in some places.

---------

Co-authored-by: Gabriel Erzse <[email protected]>
Co-authored-by: shacharPash <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants