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

LPOS feature #2080

Merged
merged 15 commits into from
Apr 12, 2022
Merged

LPOS feature #2080

merged 15 commits into from
Apr 12, 2022

Conversation

slorello89
Copy link
Collaborator

@slorello89 slorello89 commented Apr 11, 2022

Implements the LPOS command for #2055

Had to add a new Message type to accommodate.

@NickCraver, one thing that might be slightly controversial, I set rank to 1 and maxlen to 0 by default, this is operationally equivalent to not adding them at all but very much simplifies the message creation without having to do any other array/list allocations. LMK what you think of this.

Also is there a better way to extract an array of expected Value-types? maybe a new ResultsProcessor?

@slorello89
Copy link
Collaborator Author

Appveyor doesn't care for me 😆

@slorello89 slorello89 requested a review from NickCraver April 12, 2022 01:21
Copy link
Collaborator

@NickCraver NickCraver left a comment

Choose a reason for hiding this comment

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

Added comments on code so far (looking good, mostly formatting) - will check out tests in the AM with fresh eyes :)

src/StackExchange.Redis/Interfaces/IDatabase.cs Outdated Show resolved Hide resolved
src/StackExchange.Redis/Interfaces/IDatabase.cs Outdated Show resolved Hide resolved
src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs Outdated Show resolved Hide resolved
src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs Outdated Show resolved Hide resolved
src/StackExchange.Redis/KeyspaceIsolation/WrapperBase.cs Outdated Show resolved Hide resolved
src/StackExchange.Redis/RedisDatabase.cs Outdated Show resolved Hide resolved
src/StackExchange.Redis/RedisDatabase.cs Outdated Show resolved Hide resolved
src/StackExchange.Redis/RedisDatabase.cs Outdated Show resolved Hide resolved
src/StackExchange.Redis/ResultProcessor.cs Outdated Show resolved Hide resolved
slorello89 and others added 2 commits April 11, 2022 21:39
Co-authored-by: Nick Craver <nrcraver@gmail.com>
@slorello89
Copy link
Collaborator Author

slorello89 commented Apr 12, 2022

@NickCraver - FYI I needed to add another ResultProcessor for handling a default value type since the ExecuteAsync method demands a reference type, not sure if that's meant to be.

Also, this line is redundant, maybe it should be nixed?

Copy link
Collaborator

@NickCraver NickCraver left a comment

Choose a reason for hiding this comment

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

I think this is looking good - added a few more thoughts, mainly around:

  • Using regions like a heathen!
  • ...and restricting the result processor more to the specific nil case :)

src/StackExchange.Redis/RedisDatabase.cs Outdated Show resolved Hide resolved
public Task<long> ListPositionAsync(RedisKey key, RedisValue element, long rank = 1, long maxLength = 0, CommandFlags flags = CommandFlags.None)
{
var msg = CreateListPositionMessage(Database, flags, key, element, rank, maxLength);
return ExecuteAsync(msg, ResultProcessor.Int64DefaultNegativeOne);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same on default

src/StackExchange.Redis/ResultProcessor.cs Outdated Show resolved Hide resolved
tests/StackExchange.Redis.Tests/Lists.cs Outdated Show resolved Hide resolved
@NickCraver
Copy link
Collaborator

@slorello89 Yep I gotcha - added thoughts on there, and yeah we can nuke that line - feel free to throw in there since it'll be gone from history and is discussed here.

@slorello89 slorello89 requested a review from NickCraver April 12, 2022 12:28
Copy link
Collaborator

@NickCraver NickCraver left a comment

Choose a reason for hiding this comment

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

Your fantastic region-free artisanal code is looking awesome, thanks for this!

@NickCraver
Copy link
Collaborator

@slorello89 Just adding release notes - will merge once builds are good :)

@slorello89
Copy link
Collaborator Author

Isn't a lack of preprocessor directives one of the pillars of "clean code"? 😆

@NickCraver NickCraver merged commit fffb5c1 into main Apr 12, 2022
@NickCraver NickCraver deleted the feature/LPOS branch April 12, 2022 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants