Skip to content

Commit

Permalink
Sealed uninherited internal classes in Akka.Streams (#6932)
Browse files Browse the repository at this point in the history
Co-authored-by: Lehonti Ramos <lehonti@ramos>
  • Loading branch information
Lehonti and Lehonti Ramos authored Oct 2, 2023
1 parent 9096347 commit 1af82a7
Show file tree
Hide file tree
Showing 21 changed files with 41 additions and 43 deletions.
6 changes: 3 additions & 3 deletions src/core/Akka.Streams.Tests/Implementation/FixedBufferSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ public void FixedSizeBuffer_must_work_when_indexes_wrap_around_at_Int_MaxValue(i
buf.Dequeue().Should().Be(elem);
}
}
private class CheatPowerOfTwoFixedSizeBuffer : PowerOfTwoFixedSizeBuffer<int>

private sealed class CheatPowerOfTwoFixedSizeBuffer : PowerOfTwoFixedSizeBuffer<int>
{
public CheatPowerOfTwoFixedSizeBuffer(int size) : base(size)
{
Expand All @@ -174,7 +174,7 @@ public CheatPowerOfTwoFixedSizeBuffer(int size) : base(size)
}
}

private class CheatModuloFixedSizeBuffer : ModuloFixedSizeBuffer<int>
private sealed class CheatModuloFixedSizeBuffer : ModuloFixedSizeBuffer<int>
{
public CheatModuloFixedSizeBuffer(int size) : base(size)
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Actors/ActorPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ public OnErrorBlock(Exception cause, bool stop)
/// <summary>
/// TBD
/// </summary>
internal class ActorPublisherState : ExtensionIdProvider<ActorPublisherState>, IExtension
internal sealed class ActorPublisherState : ExtensionIdProvider<ActorPublisherState>, IExtension
{
/// <summary>
/// TBD
Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka.Streams/Dsl/Hub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public ProducerFailed(string message, Exception cause) : base(message, cause)
/// INTERNAL API
/// </summary>
/// <typeparam name="T">The type of element emitted by the MergeHub</typeparam>
internal class MergeHub<T> : GraphStageWithMaterializedValue<SourceShape<T>, Sink<T, NotUsed>>
internal sealed class MergeHub<T> : GraphStageWithMaterializedValue<SourceShape<T>, Sink<T, NotUsed>>
{
#region Internal classes

Expand Down Expand Up @@ -526,7 +526,7 @@ public static Sink<T, Source<T, NotUsed>> Sink<T>(int bufferSize)
/// <summary>
/// INTERNAL API
/// </summary>
internal class BroadcastHub<T> : GraphStageWithMaterializedValue<SinkShape<T>, Source<T, NotUsed>>
internal sealed class BroadcastHub<T> : GraphStageWithMaterializedValue<SinkShape<T>, Source<T, NotUsed>>
{
#region internal classes

Expand Down Expand Up @@ -1296,7 +1296,7 @@ public interface IConsumerInfo
/// <summary>
/// INTERNAL API
/// </summary>
internal class PartitionHub<T> : GraphStageWithMaterializedValue<SinkShape<T>, Source<T, NotUsed>>
internal sealed class PartitionHub<T> : GraphStageWithMaterializedValue<SinkShape<T>, Source<T, NotUsed>>
{
#region queue implementation

Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka.Streams/Dsl/Internal/InternalFlowOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ public static SubFlow<T, TMat, TClosed> GroupBy<T, TMat, TKey, TClosed>(
/// <typeparam name="TOut">TBD</typeparam>
/// <typeparam name="TMat">TBD</typeparam>
/// <typeparam name="TKey">TBD</typeparam>
internal class GroupByMergeBack<TOut, TMat, TKey> : IMergeBack<TOut, TMat>
internal sealed class GroupByMergeBack<TOut, TMat, TKey> : IMergeBack<TOut, TMat>
{
private readonly IFlow<TOut, TMat> _self;
private readonly int _maxSubstreams;
Expand Down Expand Up @@ -1539,7 +1539,7 @@ TClosed finish(Sink<T, TMat> s)
/// </summary>
/// <typeparam name="TOut">TBD</typeparam>
/// <typeparam name="TMat">TBD</typeparam>
internal class SplitWhenMergeBack<TOut, TMat> : IMergeBack<TOut, TMat>
internal sealed class SplitWhenMergeBack<TOut, TMat> : IMergeBack<TOut, TMat>
{
private readonly IFlow<TOut, TMat> _self;
private readonly Func<TOut, bool> _predicate;
Expand Down Expand Up @@ -1644,7 +1644,7 @@ TClosed finish(Sink<T, TMat> s)
/// </summary>
/// <typeparam name="TOut">TBD</typeparam>
/// <typeparam name="TMat">TBD</typeparam>
internal class SplitAfterMergeBack<TOut, TMat> : IMergeBack<TOut, TMat>
internal sealed class SplitAfterMergeBack<TOut, TMat> : IMergeBack<TOut, TMat>
{
private readonly IFlow<TOut, TMat> _self;
private readonly Func<TOut, bool> _predicate;
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Streams/Dsl/RestartFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,13 @@ public Delay(TimeSpan duration)
public override string ToString() => $"Duration({Duration})";
}
}

/// <summary>
/// Returns a flow that is almost identical but delays propagation of cancellation from downstream to upstream.
/// Once the down stream is finished calls to onPush are ignored
/// </summary>
/// <typeparam name="T"></typeparam>
internal class DelayCancellationStage<T> : SimpleLinearGraphStage<T>
internal sealed class DelayCancellationStage<T> : SimpleLinearGraphStage<T>
{
private readonly TimeSpan _delay;

Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Dsl/UnfoldFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void OnDownstreamFinish(Exception cause)
}

[InternalApi]
internal class FanOut2UnfoldingStage<TIn, TState, TOut> : GraphStage<FanOutShape<TIn, TState, TOut>>
internal sealed class FanOut2UnfoldingStage<TIn, TState, TOut> : GraphStage<FanOutShape<TIn, TState, TOut>>
{
private readonly Func<FanOutShape<TIn, TState, TOut>, UnfoldFlowGraphStageLogic<TIn, TState, TOut>> _generateGraphStageLogic;

Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Implementation/ActorProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static ActorProcessor<TIn, TOut> Create<TIn, TOut>(IActorRef impl)
/// </summary>
/// <typeparam name="TIn">TBD</typeparam>
/// <typeparam name="TOut">TBD</typeparam>
internal class ActorProcessor<TIn, TOut> : ActorPublisher<TOut>, IProcessor<TIn, TOut>
internal sealed class ActorProcessor<TIn, TOut> : ActorPublisher<TOut>, IProcessor<TIn, TOut>
{
/// <summary>
/// TBD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Akka.Streams.Implementation
/// INTERNAL API
/// </summary>
/// <typeparam name="TIn">TBD</typeparam>
internal class ActorRefBackpressureSinkStage<TIn> : GraphStage<SinkShape<TIn>>
internal sealed class ActorRefBackpressureSinkStage<TIn> : GraphStage<SinkShape<TIn>>
{
#region internal classes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static EnumerableActorName Create(string prefix)
/// <summary>
/// TBD
/// </summary>
internal class EnumerableActorNameImpl : EnumerableActorName
internal sealed class EnumerableActorNameImpl : EnumerableActorName
{
/// <summary>
/// TBD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ internal interface IActorOutputBoundary
/// TBD
/// </summary>
/// <typeparam name="T">TBD</typeparam>
internal class ActorOutputBoundary<T> : DownstreamBoundaryStageLogic, IActorOutputBoundary
internal sealed class ActorOutputBoundary<T> : DownstreamBoundaryStageLogic, IActorOutputBoundary
{
#region InHandler
private sealed class InHandler : Stage.InHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Akka.Annotations;
using Akka.Event;
using Akka.Pattern;
using Akka.Streams.Actors;
Expand Down Expand Up @@ -1000,7 +999,7 @@ internal interface IState
/// <summary>
/// Not yet materialized and no command has been scheduled
/// </summary>
internal class Uninitialized : IState
internal sealed class Uninitialized : IState
{
public static readonly Uninitialized Instance = new();

Expand All @@ -1025,7 +1024,7 @@ protected CommandScheduledBeforeMaterialization(ICommand command)
/// <summary>
/// A RequestOne command was scheduled before materialization
/// </summary>
internal class RequestOneScheduledBeforeMaterialization : CommandScheduledBeforeMaterialization
internal sealed class RequestOneScheduledBeforeMaterialization : CommandScheduledBeforeMaterialization
{
public static readonly RequestOneScheduledBeforeMaterialization Instance = new(RequestOne.Instance);

Expand Down Expand Up @@ -1054,7 +1053,7 @@ internal interface ICommand
{
}

internal class RequestOne : ICommand
internal sealed class RequestOne : ICommand
{
public static readonly RequestOne Instance = new();

Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Implementation/IO/FilePublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Akka.Streams.Implementation.IO
/// <summary>
/// INTERNAL API
/// </summary>
internal class FilePublisher : Actors.ActorPublisher<ByteString>
internal sealed class FilePublisher : Actors.ActorPublisher<ByteString>
{
/// <summary>
/// TBD
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Streams/Implementation/IO/FileSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Akka.Streams.Implementation.IO
/// <summary>
/// INTERNAL API
/// </summary>
internal class FileSubscriber : ActorSubscriber
internal sealed class FileSubscriber : ActorSubscriber
{
/// <summary>
/// TBD
Expand Down Expand Up @@ -208,7 +208,7 @@ private void CloseAndComplete(Try<IOResult> result)
}
}

internal class FlushSignal
internal sealed class FlushSignal
{
public static readonly FlushSignal Instance = new();
private FlushSignal() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
using Akka.IO;
using Akka.Streams.Actors;
using Akka.Streams.IO;
using Akka.Util;

namespace Akka.Streams.Implementation.IO
{
/// <summary>
/// INTERNAL API
/// </summary>
internal class InputStreamPublisher : Actors.ActorPublisher<ByteString>
internal sealed class InputStreamPublisher : Actors.ActorPublisher<ByteString>
{
/// <summary>
/// TBD
Expand Down
12 changes: 6 additions & 6 deletions src/core/Akka.Streams/Implementation/IO/InputStreamSinkStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Akka.Streams.Implementation.IO
/// <summary>
/// INTERNAL API
/// </summary>
internal class InputStreamSinkStage : GraphStageWithMaterializedValue<SinkShape<ByteString>, Stream>
internal sealed class InputStreamSinkStage : GraphStageWithMaterializedValue<SinkShape<ByteString>, Stream>
{
#region internal classes

Expand All @@ -33,7 +33,7 @@ internal interface IAdapterToStageMessage
/// <summary>
/// TBD
/// </summary>
internal class ReadElementAcknowledgement : IAdapterToStageMessage
internal sealed class ReadElementAcknowledgement : IAdapterToStageMessage
{
/// <summary>
/// TBD
Expand All @@ -49,7 +49,7 @@ private ReadElementAcknowledgement()
/// <summary>
/// TBD
/// </summary>
internal class Close : IAdapterToStageMessage
internal sealed class Close : IAdapterToStageMessage
{
/// <summary>
/// TBD
Expand Down Expand Up @@ -92,7 +92,7 @@ public Data(ByteString bytes)
/// <summary>
/// TBD
/// </summary>
internal class Finished : IStreamToAdapterMessage
internal sealed class Finished : IStreamToAdapterMessage
{
/// <summary>
/// TBD
Expand All @@ -108,7 +108,7 @@ private Finished()
/// <summary>
/// TBD
/// </summary>
internal class Initialized : IStreamToAdapterMessage
internal sealed class Initialized : IStreamToAdapterMessage
{
/// <summary>
/// TBD
Expand Down Expand Up @@ -272,7 +272,7 @@ public override ILogicAndMaterializedValue<Stream> CreateLogicAndMaterializedVal
/// INTERNAL API
/// InputStreamAdapter that interacts with InputStreamSinkStage
/// </summary>
internal class InputStreamAdapter : Stream
internal sealed class InputStreamAdapter : Stream
{
#region not supported

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Akka.Streams.Implementation.IO
/// <summary>
/// INTERNAL API
/// </summary>
internal class OutputStreamSourceStage : GraphStageWithMaterializedValue<SourceShape<ByteString>, Stream>
internal sealed class OutputStreamSourceStage : GraphStageWithMaterializedValue<SourceShape<ByteString>, Stream>
{
#region internal classes

Expand All @@ -37,7 +37,7 @@ internal interface IAdapterToStageMessage
/// <summary>
/// TBD
/// </summary>
internal class Flush : IAdapterToStageMessage
internal sealed class Flush : IAdapterToStageMessage
{
/// <summary>
/// TBD
Expand All @@ -52,7 +52,7 @@ private Flush()
/// <summary>
/// TBD
/// </summary>
internal class Close : IAdapterToStageMessage
internal sealed class Close : IAdapterToStageMessage
{
/// <summary>
/// TBD
Expand All @@ -74,7 +74,7 @@ internal interface IDownstreamStatus
/// <summary>
/// TBD
/// </summary>
internal class Ok : IDownstreamStatus
internal sealed class Ok : IDownstreamStatus
{
/// <summary>
/// TBD
Expand All @@ -89,7 +89,7 @@ private Ok()
/// <summary>
/// TBD
/// </summary>
internal class Canceled : IDownstreamStatus
internal sealed class Canceled : IDownstreamStatus
{
/// <summary>
/// TBD
Expand Down Expand Up @@ -315,7 +315,7 @@ public override ILogicAndMaterializedValue<Stream> CreateLogicAndMaterializedVal
/// <summary>
/// TBD
/// </summary>
internal class OutputStreamAdapter : Stream
internal sealed class OutputStreamAdapter : Stream
{
#region not supported

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Akka.Streams.Implementation.IO
/// <summary>
/// INTERNAL API
/// </summary>
internal class OutputStreamSubscriber : ActorSubscriber
internal sealed class OutputStreamSubscriber : ActorSubscriber
{
/// <summary>
/// TBD
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Implementation/Sinks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected SinkShape<TIn> AmendShape(Attributes attrs)
/// </summary>
/// <typeparam name="TIn">TBD</typeparam>
[InternalApi]
internal class PublisherSink<TIn> : SinkModule<TIn, IPublisher<TIn>>
internal sealed class PublisherSink<TIn> : SinkModule<TIn, IPublisher<TIn>>
{
/// <summary>
/// TBD
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Implementation/Transfer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private NotInitialized()
/// <summary>
/// TBD
/// </summary>
internal class WaitingForUpstreamSubscription : TransferState
internal sealed class WaitingForUpstreamSubscription : TransferState
{
/// <summary>
/// TBD
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Stage/AbstractStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Akka.Streams.Stage
/// </summary>
/// <typeparam name="TIn">TBD</typeparam>
/// <typeparam name="TOut">TBD</typeparam>
internal class PushPullGraphLogic<TIn, TOut> : GraphStageLogic, IDetachedContext<TOut>
internal sealed class PushPullGraphLogic<TIn, TOut> : GraphStageLogic, IDetachedContext<TOut>
{
#pragma warning disable CS0618 // Type or member is obsolete
private AbstractStage<TIn, TOut> _currentStage;
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Util/IteratorAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal interface IIterator<out T>
/// TBD
/// </summary>
/// <typeparam name="T">TBD</typeparam>
internal class IteratorAdapter<T> : IIterator<T>
internal sealed class IteratorAdapter<T> : IIterator<T>
{
private readonly IEnumerator<T> _enumerator;
private bool? _hasNext;
Expand Down

0 comments on commit 1af82a7

Please sign in to comment.