-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improve type safety for custom graph stages #3237
Conversation
…which are dealing with Inlets or Outlets
src/core/Akka.Streams/KillSwitch.cs
Outdated
|
||
public override BidiShape<TIn1, TOut1, TIn2, TOut2> Shape { get; } | ||
public override BidiShape<TIn, TIn, TOut, TOut> Shape { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure, this is right? It looks like less generic version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, the previous more generic version was actually a „bug“, only prevented from happening due to the fact that the public api already restricts it to two different types.
I got a compilation error at the following line
„Push(killSwitch.Out2, Grab(killSwitch.In2)),“
which makes it obvious that both, the inlets and outlets, have to be of the same type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type names are a bit confusing, T1 instead of TIn and T2 instead of TOut would make more sense, so I’ll update them when if fix the other issue with the performance test project.
src/core/Akka.Streams/KillSwitch.cs
Outdated
@@ -50,7 +50,7 @@ public static class KillSwitches | |||
/// <typeparam name="TOut1">TBD</typeparam> | |||
/// <returns>TBD</returns> | |||
public static IGraph<BidiShape<TIn1, TIn1, TOut1, TOut1>, UniqueKillSwitch> SingleBidi<TIn1, TOut1> | |||
() => UniqueBidiKillSwitchStage<TIn1, TIn1, TOut1, TOut1>.Instance; | |||
() => UniqueBidiKillSwitchStage<TIn1, TOut1>.Instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the public api I’m referring to in the other comment
@marcpiechura looks like we have some merge conflicts with the API approval |
fixed the conflicts |
|
Error was from |
Updating dependencies: Akka.Streams 1.3.5, Confluent.Kafka 0.11.3, MessagePack 1.7.3.4. Also updating stages to support type-safe Akka.Streams API changes akkadotnet/akka.net/pull/3237
In order to make the API consistent I've used
Inlet<T>
andOutlet<T>
on all public methods, even if they doesn't really need it, e.g.IsAvailable
.For those methods which are used internally and where no type argument could be provided, I've created a private version without type argument, e.g.
Pull
.Since this is quite a breaking change we need to decide if we wait for the next major version or release it with the next minor since it would prevent some ugly runtime exceptions.
closes #3231