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

Refactor the gRPC enumerators #3998

Merged

Conversation

dhingrak
Copy link
Contributor

@dhingrak dhingrak commented Oct 16, 2023

Added: Refactor gRPC enumerators

Fixes https://linear.app/eventstore/issue/DB-392/refactor-the-grpc-enumerators

Decouple all the enumerators from gRPC so they can work directly with connectors.

@linear
Copy link

linear bot commented Oct 16, 2023

DB-392 Refactor the grpc enumerators

So that they aren't coupled to grpc and can be used by the connectors plugin hosting mechanism in the node

@dhingrak dhingrak force-pushed the kunaldhingra/db-392-refactor-the-grpc-enumerators branch from 48b5ea9 to f25b832 Compare October 16, 2023 17:38
_expiryStrategy = expiryStrategy;
_subscriptionId = Guid.NewGuid();
_bus = bus;
_bus = bus ?? throw new ArgumentNullException(nameof(bus));
Copy link
Contributor

Choose a reason for hiding this comment

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

i could be persuaded, but i think i'd be tempted to leave these tidyups for another PR, so that this one can be as minimal and obviously correct as possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure I will update this.


private void Fail(Exception exception) {
Interlocked.Exchange(ref _subscriptionStarted, 1);
_channel.Writer.TryComplete(exception);
Copy link
Contributor

Choose a reason for hiding this comment

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

this closes the channel with an exception but most of that places that used to call this now close the channel cleanly or dont close it at all, is that an intentional change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, I am writing an item to the channel (ReadResponse) rather than exception (grpc) so that's why I just close the channel without an exception. While enumerating through the channel in Stream.Read.cs I used the grpc exception based on the case.

In case of UnknownResponseException, I have closed the channel with exception.


}

public class ResolvedEventWrapper: ReadResponse {
Copy link
Contributor

Choose a reason for hiding this comment

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

it might be nice if these were nested in the abstract base class, its a pattern we often do with the message classes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay

@dhingrak dhingrak force-pushed the kunaldhingra/db-392-refactor-the-grpc-enumerators branch from 9ee31d7 to 969a539 Compare October 19, 2023 21:46
@dhingrak dhingrak self-assigned this Oct 19, 2023
@timothycoleman timothycoleman force-pushed the kunaldhingra/db-392-refactor-the-grpc-enumerators branch from 969a539 to bccea05 Compare November 13, 2023 15:02
dhingrak and others added 4 commits November 13, 2023 16:29
Co-Authored-By: shaan1337 <sniper111@gmail.com>
…mespace

Co-Authored-By: shaan1337 <sniper111@gmail.com>
Co-Authored-By: shaan1337 <sniper111@gmail.com>
@timothycoleman timothycoleman force-pushed the kunaldhingra/db-392-refactor-the-grpc-enumerators branch from 1f36dac to 9162585 Compare November 13, 2023 16:40
Copy link
Contributor

@timothycoleman timothycoleman left a comment

Choose a reason for hiding this comment

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

thanks! 👍

@timothycoleman timothycoleman merged commit bc7f3bd into master Nov 14, 2023
8 checks passed
@timothycoleman timothycoleman deleted the kunaldhingra/db-392-refactor-the-grpc-enumerators branch November 14, 2023 06:33
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

Successfully merging this pull request may close these issues.

3 participants