Skip to content

Commit 1410d55

Browse files
Akka.IO.Tcp: cleaning up TBDs and API junk (#7621)
* Akka.IO.Tcp: cleaning up `TBD`s and API junk * fixed compilation error * made `Tcp.For` `internal` * `sealed` a ton of `Tcp` classes that can't be inherited * resolved PR feedback
1 parent 0401563 commit 1410d55

File tree

5 files changed

+249
-482
lines changed

5 files changed

+249
-482
lines changed

src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.DotNet.verified.txt

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3977,10 +3977,9 @@ namespace Akka.IO
39773977
protected override void PostStop() { }
39783978
protected override bool Receive(object message) { }
39793979
}
3980-
public class Tcp : Akka.Actor.ExtensionIdProvider<Akka.IO.TcpExt>
3980+
public sealed class Tcp : Akka.Actor.ExtensionIdProvider<Akka.IO.TcpExt>
39813981
{
39823982
public static readonly Akka.Actor.SupervisorStrategy ConnectionSupervisorStrategy;
3983-
public static readonly Akka.IO.Tcp Instance;
39843983
public Tcp() { }
39853984
public override Akka.IO.TcpExt CreateExtension(Akka.Actor.ExtendedActorSystem system) { }
39863985
public static Akka.Actor.IActorRef Manager(Akka.Actor.ActorSystem system) { }
@@ -3989,7 +3988,7 @@ namespace Akka.IO
39893988
public static readonly Akka.IO.Tcp.Abort Instance;
39903989
public override Akka.IO.Tcp.ConnectionClosed Event { get; }
39913990
}
3992-
public class Aborted : Akka.IO.Tcp.ConnectionClosed
3991+
public sealed class Aborted : Akka.IO.Tcp.ConnectionClosed
39933992
{
39943993
public static readonly Akka.IO.Tcp.Aborted Instance;
39953994
public override bool IsAborted { get; }
@@ -4004,13 +4003,13 @@ namespace Akka.IO
40044003
public bool PullMode { get; }
40054004
public override string ToString() { }
40064005
}
4007-
public class Bound : Akka.IO.Tcp.Event
4006+
public sealed class Bound : Akka.IO.Tcp.Event
40084007
{
40094008
public Bound(System.Net.EndPoint localAddress) { }
40104009
public System.Net.EndPoint LocalAddress { get; }
40114010
public override string ToString() { }
40124011
}
4013-
public class Close : Akka.IO.Tcp.CloseCommand
4012+
public sealed class Close : Akka.IO.Tcp.CloseCommand
40144013
{
40154014
public static readonly Akka.IO.Tcp.Close Instance;
40164015
public override Akka.IO.Tcp.ConnectionClosed Event { get; }
@@ -4020,7 +4019,7 @@ namespace Akka.IO
40204019
protected CloseCommand() { }
40214020
public abstract Akka.IO.Tcp.ConnectionClosed Event { get; }
40224021
}
4023-
public class Closed : Akka.IO.Tcp.ConnectionClosed
4022+
public sealed class Closed : Akka.IO.Tcp.ConnectionClosed
40244023
{
40254024
public static readonly Akka.IO.Tcp.Closed Instance;
40264025
}
@@ -4031,6 +4030,7 @@ namespace Akka.IO
40314030
}
40324031
public sealed class CommandFailed : Akka.IO.Tcp.Event
40334032
{
4033+
public CommandFailed(Akka.IO.Tcp.Command cmd, Akka.Util.Option<System.Exception> ex) { }
40344034
public CommandFailed(Akka.IO.Tcp.Command cmd) { }
40354035
public Akka.Util.Option<System.Exception> Cause { get; }
40364036
[Akka.Annotations.InternalApiAttribute()]
@@ -4040,25 +4040,25 @@ namespace Akka.IO
40404040
[Akka.Annotations.InternalApiAttribute()]
40414041
public Akka.IO.Tcp.CommandFailed WithCause(System.Exception cause) { }
40424042
}
4043-
public class CompoundWrite : Akka.IO.Tcp.WriteCommand, System.Collections.Generic.IEnumerable<Akka.IO.Tcp.SimpleWriteCommand>, System.Collections.IEnumerable
4043+
public sealed class CompoundWrite : Akka.IO.Tcp.WriteCommand, System.Collections.Generic.IEnumerable<Akka.IO.Tcp.SimpleWriteCommand>, System.Collections.IEnumerable
40444044
{
40454045
public CompoundWrite(Akka.IO.Tcp.SimpleWriteCommand head, Akka.IO.Tcp.WriteCommand tailCommand) { }
40464046
public Akka.IO.Tcp.SimpleWriteCommand Head { get; }
40474047
public Akka.IO.Tcp.WriteCommand TailCommand { get; }
40484048
public System.Collections.Generic.IEnumerator<Akka.IO.Tcp.SimpleWriteCommand> GetEnumerator() { }
40494049
public override string ToString() { }
40504050
}
4051-
public class ConfirmedClose : Akka.IO.Tcp.CloseCommand
4051+
public sealed class ConfirmedClose : Akka.IO.Tcp.CloseCommand
40524052
{
40534053
public static readonly Akka.IO.Tcp.ConfirmedClose Instance;
40544054
public override Akka.IO.Tcp.ConnectionClosed Event { get; }
40554055
}
4056-
public class ConfirmedClosed : Akka.IO.Tcp.ConnectionClosed
4056+
public sealed class ConfirmedClosed : Akka.IO.Tcp.ConnectionClosed
40574057
{
40584058
public static readonly Akka.IO.Tcp.ConfirmedClosed Instance;
40594059
public override bool IsConfirmed { get; }
40604060
}
4061-
public class Connect : Akka.IO.Tcp.Command
4061+
public sealed class Connect : Akka.IO.Tcp.Command
40624062
{
40634063
public Connect(System.Net.EndPoint remoteAddress, System.Net.EndPoint localAddress = null, System.Collections.Generic.IEnumerable<Akka.IO.Inet.SocketOption> options = null, System.Nullable<System.TimeSpan> timeout = null, bool pullMode = False) { }
40644064
public System.Net.EndPoint LocalAddress { get; }
@@ -4078,12 +4078,14 @@ namespace Akka.IO
40784078
public class ConnectionClosed : Akka.IO.Tcp.Event, Akka.Event.IDeadLetterSuppression
40794079
{
40804080
public ConnectionClosed() { }
4081+
[System.Runtime.CompilerServices.NullableAttribute(2)]
40814082
public virtual string Cause { get; }
40824083
public virtual bool IsAborted { get; }
40834084
public virtual bool IsConfirmed { get; }
40844085
public virtual bool IsErrorClosed { get; }
40854086
public virtual bool IsPeerClosed { get; }
40864087
}
4088+
[System.Runtime.CompilerServices.NullableAttribute(0)]
40874089
public sealed class ErrorClosed : Akka.IO.Tcp.ConnectionClosed
40884090
{
40894091
public ErrorClosed(string cause) { }
@@ -4106,7 +4108,7 @@ namespace Akka.IO
41064108
public object Token { get; }
41074109
public override string ToString() { }
41084110
}
4109-
public class PeerClosed : Akka.IO.Tcp.ConnectionClosed
4111+
public sealed class PeerClosed : Akka.IO.Tcp.ConnectionClosed
41104112
{
41114113
public static readonly Akka.IO.Tcp.PeerClosed Instance;
41124114
public override bool IsPeerClosed { get; }
@@ -4125,17 +4127,17 @@ namespace Akka.IO
41254127
public bool UseResumeWriting { get; }
41264128
public override string ToString() { }
41274129
}
4128-
public class ResumeAccepting : Akka.IO.Tcp.Command
4130+
public sealed class ResumeAccepting : Akka.IO.Tcp.Command
41294131
{
41304132
public ResumeAccepting(int batchSize) { }
41314133
public int BatchSize { get; }
41324134
public override string ToString() { }
41334135
}
4134-
public class ResumeReading : Akka.IO.Tcp.Command
4136+
public sealed class ResumeReading : Akka.IO.Tcp.Command
41354137
{
41364138
public static readonly Akka.IO.Tcp.ResumeReading Instance;
41374139
}
4138-
public class ResumeWriting : Akka.IO.Tcp.Command
4140+
public sealed class ResumeWriting : Akka.IO.Tcp.Command
41394141
{
41404142
public static readonly Akka.IO.Tcp.ResumeWriting Instance;
41414143
}
@@ -4146,19 +4148,19 @@ namespace Akka.IO
41464148
public bool WantsAck { get; }
41474149
public Akka.IO.Tcp.CompoundWrite Append(Akka.IO.Tcp.WriteCommand that) { }
41484150
}
4149-
public class SuspendReading : Akka.IO.Tcp.Command
4151+
public sealed class SuspendReading : Akka.IO.Tcp.Command
41504152
{
41514153
public static readonly Akka.IO.Tcp.SuspendReading Instance;
41524154
}
41534155
public class Unbind : Akka.IO.Tcp.Command
41544156
{
41554157
public static readonly Akka.IO.Tcp.Unbind Instance;
41564158
}
4157-
public class Unbound : Akka.IO.Tcp.Event
4159+
public sealed class Unbound : Akka.IO.Tcp.Event
41584160
{
41594161
public static readonly Akka.IO.Tcp.Unbound Instance;
41604162
}
4161-
public class Write : Akka.IO.Tcp.SimpleWriteCommand
4163+
public sealed class Write : Akka.IO.Tcp.SimpleWriteCommand
41624164
{
41634165
public static readonly Akka.IO.Tcp.Write Empty;
41644166
public override Akka.IO.Tcp.Event Ack { get; }
@@ -4175,7 +4177,7 @@ namespace Akka.IO
41754177
public Akka.IO.Tcp.CompoundWrite Prepend(Akka.IO.Tcp.SimpleWriteCommand other) { }
41764178
public Akka.IO.Tcp.WriteCommand Prepend(System.Collections.Generic.IEnumerable<Akka.IO.Tcp.WriteCommand> writes) { }
41774179
}
4178-
public class WritingResumed : Akka.IO.Tcp.Event
4180+
public sealed class WritingResumed : Akka.IO.Tcp.Event
41794181
{
41804182
public static readonly Akka.IO.Tcp.WritingResumed Instance;
41814183
}
@@ -4191,15 +4193,14 @@ namespace Akka.IO
41914193
{
41924194
public static Akka.Actor.IActorRef Tcp(this Akka.Actor.ActorSystem system) { }
41934195
}
4194-
public class TcpMessage
4196+
public class static TcpMessage
41954197
{
4196-
public TcpMessage() { }
41974198
public static Akka.IO.Tcp.Command Abort() { }
41984199
public static Akka.IO.Tcp.Command Bind(Akka.Actor.IActorRef handler, System.Net.EndPoint endpoint, int backlog, System.Collections.Generic.IEnumerable<Akka.IO.Inet.SocketOption> options, bool pullMode) { }
41994200
public static Akka.IO.Tcp.Command Bind(Akka.Actor.IActorRef handler, System.Net.EndPoint endpoint, int backlog) { }
42004201
public static Akka.IO.Tcp.Command Close() { }
42014202
public static Akka.IO.Tcp.Command ConfirmedClose() { }
4202-
public static Akka.IO.Tcp.Command Connect(System.Net.EndPoint remoteAddress, System.Net.EndPoint localAddress, System.Collections.Generic.IEnumerable<Akka.IO.Inet.SocketOption> options, System.Nullable<System.TimeSpan> timeout, bool pullMode) { }
4203+
public static Akka.IO.Tcp.Command Connect(System.Net.EndPoint remoteAddress, [System.Runtime.CompilerServices.NullableAttribute(2)] System.Net.EndPoint localAddress, System.Collections.Generic.IEnumerable<Akka.IO.Inet.SocketOption> options, System.Nullable<System.TimeSpan> timeout, bool pullMode) { }
42034204
public static Akka.IO.Tcp.Command Connect(System.Net.EndPoint remoteAddress) { }
42044205
public static Akka.IO.Tcp.NoAck NoAck(object token = null) { }
42054206
public static Akka.IO.Tcp.Command Register(Akka.Actor.IActorRef handler, bool keepOpenOnPeerClosed = False, bool useResumeWriting = True) { }

src/core/Akka.API.Tests/verify/CoreAPISpec.ApproveCore.Net.verified.txt

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3967,10 +3967,9 @@ namespace Akka.IO
39673967
protected override void PostStop() { }
39683968
protected override bool Receive(object message) { }
39693969
}
3970-
public class Tcp : Akka.Actor.ExtensionIdProvider<Akka.IO.TcpExt>
3970+
public sealed class Tcp : Akka.Actor.ExtensionIdProvider<Akka.IO.TcpExt>
39713971
{
39723972
public static readonly Akka.Actor.SupervisorStrategy ConnectionSupervisorStrategy;
3973-
public static readonly Akka.IO.Tcp Instance;
39743973
public Tcp() { }
39753974
public override Akka.IO.TcpExt CreateExtension(Akka.Actor.ExtendedActorSystem system) { }
39763975
public static Akka.Actor.IActorRef Manager(Akka.Actor.ActorSystem system) { }
@@ -3979,7 +3978,7 @@ namespace Akka.IO
39793978
public static readonly Akka.IO.Tcp.Abort Instance;
39803979
public override Akka.IO.Tcp.ConnectionClosed Event { get; }
39813980
}
3982-
public class Aborted : Akka.IO.Tcp.ConnectionClosed
3981+
public sealed class Aborted : Akka.IO.Tcp.ConnectionClosed
39833982
{
39843983
public static readonly Akka.IO.Tcp.Aborted Instance;
39853984
public override bool IsAborted { get; }
@@ -3994,13 +3993,13 @@ namespace Akka.IO
39943993
public bool PullMode { get; }
39953994
public override string ToString() { }
39963995
}
3997-
public class Bound : Akka.IO.Tcp.Event
3996+
public sealed class Bound : Akka.IO.Tcp.Event
39983997
{
39993998
public Bound(System.Net.EndPoint localAddress) { }
40003999
public System.Net.EndPoint LocalAddress { get; }
40014000
public override string ToString() { }
40024001
}
4003-
public class Close : Akka.IO.Tcp.CloseCommand
4002+
public sealed class Close : Akka.IO.Tcp.CloseCommand
40044003
{
40054004
public static readonly Akka.IO.Tcp.Close Instance;
40064005
public override Akka.IO.Tcp.ConnectionClosed Event { get; }
@@ -4010,7 +4009,7 @@ namespace Akka.IO
40104009
protected CloseCommand() { }
40114010
public abstract Akka.IO.Tcp.ConnectionClosed Event { get; }
40124011
}
4013-
public class Closed : Akka.IO.Tcp.ConnectionClosed
4012+
public sealed class Closed : Akka.IO.Tcp.ConnectionClosed
40144013
{
40154014
public static readonly Akka.IO.Tcp.Closed Instance;
40164015
}
@@ -4021,6 +4020,7 @@ namespace Akka.IO
40214020
}
40224021
public sealed class CommandFailed : Akka.IO.Tcp.Event
40234022
{
4023+
public CommandFailed(Akka.IO.Tcp.Command cmd, Akka.Util.Option<System.Exception> ex) { }
40244024
public CommandFailed(Akka.IO.Tcp.Command cmd) { }
40254025
public Akka.Util.Option<System.Exception> Cause { get; }
40264026
[Akka.Annotations.InternalApiAttribute()]
@@ -4030,25 +4030,25 @@ namespace Akka.IO
40304030
[Akka.Annotations.InternalApiAttribute()]
40314031
public Akka.IO.Tcp.CommandFailed WithCause(System.Exception cause) { }
40324032
}
4033-
public class CompoundWrite : Akka.IO.Tcp.WriteCommand, System.Collections.Generic.IEnumerable<Akka.IO.Tcp.SimpleWriteCommand>, System.Collections.IEnumerable
4033+
public sealed class CompoundWrite : Akka.IO.Tcp.WriteCommand, System.Collections.Generic.IEnumerable<Akka.IO.Tcp.SimpleWriteCommand>, System.Collections.IEnumerable
40344034
{
40354035
public CompoundWrite(Akka.IO.Tcp.SimpleWriteCommand head, Akka.IO.Tcp.WriteCommand tailCommand) { }
40364036
public Akka.IO.Tcp.SimpleWriteCommand Head { get; }
40374037
public Akka.IO.Tcp.WriteCommand TailCommand { get; }
40384038
public System.Collections.Generic.IEnumerator<Akka.IO.Tcp.SimpleWriteCommand> GetEnumerator() { }
40394039
public override string ToString() { }
40404040
}
4041-
public class ConfirmedClose : Akka.IO.Tcp.CloseCommand
4041+
public sealed class ConfirmedClose : Akka.IO.Tcp.CloseCommand
40424042
{
40434043
public static readonly Akka.IO.Tcp.ConfirmedClose Instance;
40444044
public override Akka.IO.Tcp.ConnectionClosed Event { get; }
40454045
}
4046-
public class ConfirmedClosed : Akka.IO.Tcp.ConnectionClosed
4046+
public sealed class ConfirmedClosed : Akka.IO.Tcp.ConnectionClosed
40474047
{
40484048
public static readonly Akka.IO.Tcp.ConfirmedClosed Instance;
40494049
public override bool IsConfirmed { get; }
40504050
}
4051-
public class Connect : Akka.IO.Tcp.Command
4051+
public sealed class Connect : Akka.IO.Tcp.Command
40524052
{
40534053
public Connect(System.Net.EndPoint remoteAddress, System.Net.EndPoint localAddress = null, System.Collections.Generic.IEnumerable<Akka.IO.Inet.SocketOption> options = null, System.Nullable<System.TimeSpan> timeout = null, bool pullMode = False) { }
40544054
public System.Net.EndPoint LocalAddress { get; }
@@ -4068,12 +4068,14 @@ namespace Akka.IO
40684068
public class ConnectionClosed : Akka.IO.Tcp.Event, Akka.Event.IDeadLetterSuppression
40694069
{
40704070
public ConnectionClosed() { }
4071+
[System.Runtime.CompilerServices.NullableAttribute(2)]
40714072
public virtual string Cause { get; }
40724073
public virtual bool IsAborted { get; }
40734074
public virtual bool IsConfirmed { get; }
40744075
public virtual bool IsErrorClosed { get; }
40754076
public virtual bool IsPeerClosed { get; }
40764077
}
4078+
[System.Runtime.CompilerServices.NullableAttribute(0)]
40774079
public sealed class ErrorClosed : Akka.IO.Tcp.ConnectionClosed
40784080
{
40794081
public ErrorClosed(string cause) { }
@@ -4096,7 +4098,7 @@ namespace Akka.IO
40964098
public object Token { get; }
40974099
public override string ToString() { }
40984100
}
4099-
public class PeerClosed : Akka.IO.Tcp.ConnectionClosed
4101+
public sealed class PeerClosed : Akka.IO.Tcp.ConnectionClosed
41004102
{
41014103
public static readonly Akka.IO.Tcp.PeerClosed Instance;
41024104
public override bool IsPeerClosed { get; }
@@ -4115,17 +4117,17 @@ namespace Akka.IO
41154117
public bool UseResumeWriting { get; }
41164118
public override string ToString() { }
41174119
}
4118-
public class ResumeAccepting : Akka.IO.Tcp.Command
4120+
public sealed class ResumeAccepting : Akka.IO.Tcp.Command
41194121
{
41204122
public ResumeAccepting(int batchSize) { }
41214123
public int BatchSize { get; }
41224124
public override string ToString() { }
41234125
}
4124-
public class ResumeReading : Akka.IO.Tcp.Command
4126+
public sealed class ResumeReading : Akka.IO.Tcp.Command
41254127
{
41264128
public static readonly Akka.IO.Tcp.ResumeReading Instance;
41274129
}
4128-
public class ResumeWriting : Akka.IO.Tcp.Command
4130+
public sealed class ResumeWriting : Akka.IO.Tcp.Command
41294131
{
41304132
public static readonly Akka.IO.Tcp.ResumeWriting Instance;
41314133
}
@@ -4136,19 +4138,19 @@ namespace Akka.IO
41364138
public bool WantsAck { get; }
41374139
public Akka.IO.Tcp.CompoundWrite Append(Akka.IO.Tcp.WriteCommand that) { }
41384140
}
4139-
public class SuspendReading : Akka.IO.Tcp.Command
4141+
public sealed class SuspendReading : Akka.IO.Tcp.Command
41404142
{
41414143
public static readonly Akka.IO.Tcp.SuspendReading Instance;
41424144
}
41434145
public class Unbind : Akka.IO.Tcp.Command
41444146
{
41454147
public static readonly Akka.IO.Tcp.Unbind Instance;
41464148
}
4147-
public class Unbound : Akka.IO.Tcp.Event
4149+
public sealed class Unbound : Akka.IO.Tcp.Event
41484150
{
41494151
public static readonly Akka.IO.Tcp.Unbound Instance;
41504152
}
4151-
public class Write : Akka.IO.Tcp.SimpleWriteCommand
4153+
public sealed class Write : Akka.IO.Tcp.SimpleWriteCommand
41524154
{
41534155
public static readonly Akka.IO.Tcp.Write Empty;
41544156
public override Akka.IO.Tcp.Event Ack { get; }
@@ -4165,7 +4167,7 @@ namespace Akka.IO
41654167
public Akka.IO.Tcp.CompoundWrite Prepend(Akka.IO.Tcp.SimpleWriteCommand other) { }
41664168
public Akka.IO.Tcp.WriteCommand Prepend(System.Collections.Generic.IEnumerable<Akka.IO.Tcp.WriteCommand> writes) { }
41674169
}
4168-
public class WritingResumed : Akka.IO.Tcp.Event
4170+
public sealed class WritingResumed : Akka.IO.Tcp.Event
41694171
{
41704172
public static readonly Akka.IO.Tcp.WritingResumed Instance;
41714173
}
@@ -4181,15 +4183,14 @@ namespace Akka.IO
41814183
{
41824184
public static Akka.Actor.IActorRef Tcp(this Akka.Actor.ActorSystem system) { }
41834185
}
4184-
public class TcpMessage
4186+
public class static TcpMessage
41854187
{
4186-
public TcpMessage() { }
41874188
public static Akka.IO.Tcp.Command Abort() { }
41884189
public static Akka.IO.Tcp.Command Bind(Akka.Actor.IActorRef handler, System.Net.EndPoint endpoint, int backlog, System.Collections.Generic.IEnumerable<Akka.IO.Inet.SocketOption> options, bool pullMode) { }
41894190
public static Akka.IO.Tcp.Command Bind(Akka.Actor.IActorRef handler, System.Net.EndPoint endpoint, int backlog) { }
41904191
public static Akka.IO.Tcp.Command Close() { }
41914192
public static Akka.IO.Tcp.Command ConfirmedClose() { }
4192-
public static Akka.IO.Tcp.Command Connect(System.Net.EndPoint remoteAddress, System.Net.EndPoint localAddress, System.Collections.Generic.IEnumerable<Akka.IO.Inet.SocketOption> options, System.Nullable<System.TimeSpan> timeout, bool pullMode) { }
4193+
public static Akka.IO.Tcp.Command Connect(System.Net.EndPoint remoteAddress, [System.Runtime.CompilerServices.NullableAttribute(2)] System.Net.EndPoint localAddress, System.Collections.Generic.IEnumerable<Akka.IO.Inet.SocketOption> options, System.Nullable<System.TimeSpan> timeout, bool pullMode) { }
41934194
public static Akka.IO.Tcp.Command Connect(System.Net.EndPoint remoteAddress) { }
41944195
public static Akka.IO.Tcp.NoAck NoAck(object token = null) { }
41954196
public static Akka.IO.Tcp.Command Register(Akka.Actor.IActorRef handler, bool keepOpenOnPeerClosed = False, bool useResumeWriting = True) { }

src/core/Akka.Tests/IO/TcpListenerSpec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public ListenerParent(TestSetup test, bool pullMode)
143143

144144
_listener = Context.ActorOf(Props.Create(() =>
145145
new TcpListener(
146-
Tcp.Instance.Apply(Context.System),
146+
Tcp.For(Context.System),
147147
test._bindCommander.Ref,
148148
new Tcp.Bind(
149149
_test._handler.Ref,

0 commit comments

Comments
 (0)