diff --git a/benchmarks/AutoClusterBenchmark/Configuration.cs b/benchmarks/AutoClusterBenchmark/Configuration.cs index 09a230a538..de35b2f80e 100644 --- a/benchmarks/AutoClusterBenchmark/Configuration.cs +++ b/benchmarks/AutoClusterBenchmark/Configuration.cs @@ -8,20 +8,15 @@ using ClusterExperiment1.Messages; using Grpc.Net.Client; using Grpc.Net.Compression; -using Microsoft.Extensions.Logging; using Proto; using Proto.Cluster; -using Proto.Cluster.Consul; using Proto.Cluster.Identity; using Proto.Cluster.Partition; using Proto.Cluster.Testing; using Proto.OpenTelemetry; using Proto.Remote; using Proto.Remote.GrpcNet; -using Serilog; -using Serilog.Events; using CompressionLevel = System.IO.Compression.CompressionLevel; -using Log = Serilog.Log; namespace ClusterExperiment1; diff --git a/benchmarks/AutoClusterBenchmark/Runner.cs b/benchmarks/AutoClusterBenchmark/Runner.cs index cc099278a2..3d921b2204 100644 --- a/benchmarks/AutoClusterBenchmark/Runner.cs +++ b/benchmarks/AutoClusterBenchmark/Runner.cs @@ -3,8 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System; -using System.Diagnostics; using System.Threading.Tasks; using Proto.Cluster; diff --git a/benchmarks/ClusterBenchmark/Configuration.cs b/benchmarks/ClusterBenchmark/Configuration.cs index 38e6cbf13e..96f54779f2 100644 --- a/benchmarks/ClusterBenchmark/Configuration.cs +++ b/benchmarks/ClusterBenchmark/Configuration.cs @@ -6,10 +6,8 @@ using System; using System.Threading.Tasks; using ClusterExperiment1.Messages; -using Grpc.Core; using Grpc.Net.Client; using Grpc.Net.Compression; -using k8s; using Microsoft.Extensions.Logging; using MongoDB.Driver; using OpenTelemetry.Resources; diff --git a/benchmarks/RemoteBenchmark/Messages/Messages.cs b/benchmarks/RemoteBenchmark/Messages/Messages.cs index 0aec4f0bd2..40fc347bd2 100644 --- a/benchmarks/RemoteBenchmark/Messages/Messages.cs +++ b/benchmarks/RemoteBenchmark/Messages/Messages.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using Google.Protobuf; using Proto.Remote; namespace Messages; diff --git a/examples/ActorMetrics/Startup.cs b/examples/ActorMetrics/Startup.cs index faff4e3432..dcfe1323fe 100644 --- a/examples/ActorMetrics/Startup.cs +++ b/examples/ActorMetrics/Startup.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; using OpenTelemetry.Metrics; -using Proto.Metrics; using Proto.OpenTelemetry; namespace WebApplication1; diff --git a/examples/Proto.Cluster.Dashboard.Host/ActorSystemHostedService.cs b/examples/Proto.Cluster.Dashboard.Host/ActorSystemHostedService.cs index 6ab92dc051..1057f58858 100644 --- a/examples/Proto.Cluster.Dashboard.Host/ActorSystemHostedService.cs +++ b/examples/Proto.Cluster.Dashboard.Host/ActorSystemHostedService.cs @@ -1,7 +1,4 @@ -using Proto.Cluster.Seed; -using Proto.Utils; - -namespace Proto.Cluster.Dashboard +namespace Proto.Cluster.Dashboard { public class ActorSystemHostedService : IHostedService diff --git a/src/Proto.Actor/Extensions/ActorSystemExtensions.cs b/src/Proto.Actor/Extensions/ActorSystemExtensions.cs index db542a7e47..93dbb40b7e 100644 --- a/src/Proto.Actor/Extensions/ActorSystemExtensions.cs +++ b/src/Proto.Actor/Extensions/ActorSystemExtensions.cs @@ -4,7 +4,6 @@ // // ----------------------------------------------------------------------- using System; -using System.Collections.Generic; namespace Proto.Extensions; diff --git a/src/Proto.Actor/Mailbox/LockingUnboundedMailboxQueue.cs b/src/Proto.Actor/Mailbox/LockingUnboundedMailboxQueue.cs index 85e838fb4f..e5c93ffcc6 100644 --- a/src/Proto.Actor/Mailbox/LockingUnboundedMailboxQueue.cs +++ b/src/Proto.Actor/Mailbox/LockingUnboundedMailboxQueue.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System; using System.Collections.Generic; using System.Threading; diff --git a/src/Proto.Actor/Router/Routers/ConsistentHashRouterState.cs b/src/Proto.Actor/Router/Routers/ConsistentHashRouterState.cs index 8f659f7c54..e6ccecf09e 100644 --- a/src/Proto.Actor/Router/Routers/ConsistentHashRouterState.cs +++ b/src/Proto.Actor/Router/Routers/ConsistentHashRouterState.cs @@ -4,9 +4,6 @@ // // ----------------------------------------------------------------------- using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; namespace Proto.Router.Routers; diff --git a/src/Proto.Actor/Supervision/RestartStatistics.cs b/src/Proto.Actor/Supervision/RestartStatistics.cs index 63088b2099..376bf1e01c 100644 --- a/src/Proto.Actor/Supervision/RestartStatistics.cs +++ b/src/Proto.Actor/Supervision/RestartStatistics.cs @@ -5,7 +5,6 @@ // ----------------------------------------------------------------------- using System; using System.Collections.Generic; -using System.Linq; // ReSharper disable once CheckNamespace namespace Proto; diff --git a/src/Proto.Actor/Utils/HashedConcurrentDictionary.cs b/src/Proto.Actor/Utils/HashedConcurrentDictionary.cs deleted file mode 100644 index 4e9d53a211..0000000000 --- a/src/Proto.Actor/Utils/HashedConcurrentDictionary.cs +++ /dev/null @@ -1,98 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (C) 2015-2022 Asynkron AB All rights reserved -// -// ----------------------------------------------------------------------- -using System; -using System.Collections; -using System.Collections.Generic; -using System.Threading; - -namespace Proto; - -class HashedConcurrentDictionary : HashedConcurrentDictionary -{ -} - -class HashedConcurrentDictionary :IEnumerable<(TKey key,TValue value)> -{ - //power of two - private const int HashSize = 1024; - private const int HashMask = HashSize-1; - private readonly Dictionary[] _partitions = new Dictionary[HashSize]; - - private long _count; - - internal HashedConcurrentDictionary() - { - for (var i = 0; i < _partitions.Length; i++) - { - _partitions[i] = new Dictionary(); - } - } - - public int Count => (int)Interlocked.Read(ref _count); - - private Dictionary GetPartition(TKey key) - { - if (key == null) throw new ArgumentNullException(nameof(key)); - - var hash = key.GetHashCode() & HashMask; - - var p = _partitions[hash]; - return p; - } - - public bool TryAdd(TKey key, TValue value) - { - var p = GetPartition(key); - - lock (p) - { - if (p.ContainsKey(key)) return false; - - p.Add(key, value); - Interlocked.Increment(ref _count); - return true; - } - } - - public bool TryGetValue(TKey key, out TValue value) - { - var p = GetPartition(key); - lock (p) return p.TryGetValue(key, out value!); - } - - public void Remove(TKey key) - { - var p = GetPartition(key); - - lock (p) - { - if (p.Remove(key)) - { - Interlocked.Decrement(ref _count); - } - } - } - - public IEnumerator<(TKey key, TValue value)> GetEnumerator() - { - foreach (var p in _partitions) - { - Dictionary copy; - //Not a great solution but works for the intended use-case, do not enumerate over lock - lock (p) - { - copy = new Dictionary(p); - } - - foreach (var (key, value) in copy) - { - yield return (key, value); - } - } - } - - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); -} \ No newline at end of file diff --git a/src/Proto.Cluster.CodeGen/OutputFileName.cs b/src/Proto.Cluster.CodeGen/OutputFileName.cs index 5c17620da3..fd7607b280 100644 --- a/src/Proto.Cluster.CodeGen/OutputFileName.cs +++ b/src/Proto.Cluster.CodeGen/OutputFileName.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System; using System.Globalization; using System.IO; using System.Linq; diff --git a/src/Proto.Cluster.CodeGen/ProtoGenTask.cs b/src/Proto.Cluster.CodeGen/ProtoGenTask.cs index d4d64bd749..6017c8c5f4 100644 --- a/src/Proto.Cluster.CodeGen/ProtoGenTask.cs +++ b/src/Proto.Cluster.CodeGen/ProtoGenTask.cs @@ -1,5 +1,4 @@ using System; -using System.Globalization; using System.IO; using System.Linq; using System.Text; diff --git a/src/Proto.Cluster.Dashboard/Shared/MainLayout.razor b/src/Proto.Cluster.Dashboard/Shared/MainLayout.razor index 6e6ae96352..eada0d71c5 100644 --- a/src/Proto.Cluster.Dashboard/Shared/MainLayout.razor +++ b/src/Proto.Cluster.Dashboard/Shared/MainLayout.razor @@ -1,5 +1,4 @@ -@using MudBlazor -@using MudBlazor.Utilities +@using MudBlazor.Utilities @inherits LayoutComponentBase Proto.Cluster.Dashboard diff --git a/src/Proto.Cluster/ClusterExtension.cs b/src/Proto.Cluster/ClusterExtension.cs index 7358f8db39..902676d74d 100644 --- a/src/Proto.Cluster/ClusterExtension.cs +++ b/src/Proto.Cluster/ClusterExtension.cs @@ -7,7 +7,6 @@ using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; -using Proto.Cluster.Metrics; using Proto.Deduplication; namespace Proto.Cluster; diff --git a/src/Proto.Cluster/Grain/GrainRequestMessage.cs b/src/Proto.Cluster/Grain/GrainRequestMessage.cs index f0f25e4b42..2efa2e1cb8 100644 --- a/src/Proto.Cluster/Grain/GrainRequestMessage.cs +++ b/src/Proto.Cluster/Grain/GrainRequestMessage.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System; using Google.Protobuf; using Proto.Remote; diff --git a/src/Proto.Cluster/Grain/GrainResponseMessage.cs b/src/Proto.Cluster/Grain/GrainResponseMessage.cs index ffd881d03e..40be99bf52 100644 --- a/src/Proto.Cluster/Grain/GrainResponseMessage.cs +++ b/src/Proto.Cluster/Grain/GrainResponseMessage.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System; using Google.Protobuf; using Proto.Remote; diff --git a/src/Proto.Cluster/Member/LocalAffinityStrategy.cs b/src/Proto.Cluster/Member/LocalAffinityStrategy.cs index fffb8c735d..a2cff8e383 100644 --- a/src/Proto.Cluster/Member/LocalAffinityStrategy.cs +++ b/src/Proto.Cluster/Member/LocalAffinityStrategy.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Immutable; using System.Linq; -using Proto.Cluster.Partition; namespace Proto.Cluster; diff --git a/src/Proto.Cluster/Member/MemberStrategy.cs b/src/Proto.Cluster/Member/MemberStrategy.cs index a821746307..58e4e3c43a 100644 --- a/src/Proto.Cluster/Member/MemberStrategy.cs +++ b/src/Proto.Cluster/Member/MemberStrategy.cs @@ -5,7 +5,6 @@ // ----------------------------------------------------------------------- using System.Collections.Immutable; using System.Linq; -using Proto.Cluster.Partition; namespace Proto.Cluster; diff --git a/src/Proto.Cluster/Partition/PartitionMemberSelector.cs b/src/Proto.Cluster/Partition/PartitionMemberSelector.cs index d789f56106..a59f071bb8 100644 --- a/src/Proto.Cluster/Partition/PartitionMemberSelector.cs +++ b/src/Proto.Cluster/Partition/PartitionMemberSelector.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System; using System.Collections.Immutable; using System.Threading; diff --git a/src/Proto.Cluster/PartitionActivator/PartitionActivatorManager.cs b/src/Proto.Cluster/PartitionActivator/PartitionActivatorManager.cs index 664331ceea..bb036ded70 100644 --- a/src/Proto.Cluster/PartitionActivator/PartitionActivatorManager.cs +++ b/src/Proto.Cluster/PartitionActivator/PartitionActivatorManager.cs @@ -5,7 +5,6 @@ // ----------------------------------------------------------------------- using System.Linq; using System.Threading.Tasks; -using Proto.Cluster.Partition; namespace Proto.Cluster.PartitionActivator; diff --git a/src/Proto.Cluster/PartitionActivator/RendezvousFast.cs b/src/Proto.Cluster/PartitionActivator/RendezvousFast.cs index 22bbb81b7d..261dbb16dd 100644 --- a/src/Proto.Cluster/PartitionActivator/RendezvousFast.cs +++ b/src/Proto.Cluster/PartitionActivator/RendezvousFast.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Proto.Cluster/PubSub/IPublisher.cs b/src/Proto.Cluster/PubSub/IPublisher.cs index 589e905460..48d4eb01d8 100644 --- a/src/Proto.Cluster/PubSub/IPublisher.cs +++ b/src/Proto.Cluster/PubSub/IPublisher.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; diff --git a/src/Proto.Cluster/Seed/SeedNodeClusterProvider.cs b/src/Proto.Cluster/Seed/SeedNodeClusterProvider.cs index 409255bb03..c434d7ff7f 100644 --- a/src/Proto.Cluster/Seed/SeedNodeClusterProvider.cs +++ b/src/Proto.Cluster/Seed/SeedNodeClusterProvider.cs @@ -4,7 +4,6 @@ // // ----------------------------------------------------------------------- using System; -using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; diff --git a/src/Proto.Cluster/Seed/SeedNodeClusterProviderOptions.cs b/src/Proto.Cluster/Seed/SeedNodeClusterProviderOptions.cs index dbc18c6f02..e1f54bf8c5 100644 --- a/src/Proto.Cluster/Seed/SeedNodeClusterProviderOptions.cs +++ b/src/Proto.Cluster/Seed/SeedNodeClusterProviderOptions.cs @@ -3,7 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using System; using System.Collections.Immutable; namespace Proto.Cluster.Seed; diff --git a/src/Proto.Remote/Endpoints/EndpointReader.cs b/src/Proto.Remote/Endpoints/EndpointReader.cs index 864b91222d..5e9ac6aee9 100644 --- a/src/Proto.Remote/Endpoints/EndpointReader.cs +++ b/src/Proto.Remote/Endpoints/EndpointReader.cs @@ -5,7 +5,6 @@ // ----------------------------------------------------------------------- using System; -using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading; @@ -13,7 +12,6 @@ using Grpc.Core; using Microsoft.Extensions.Logging; using Proto.Diagnostics; -using Proto.Remote.Metrics; namespace Proto.Remote; diff --git a/src/Proto.Remote/Endpoints/IEndpoint.cs b/src/Proto.Remote/Endpoints/IEndpoint.cs index 1ef8f23c55..c4eecd8847 100644 --- a/src/Proto.Remote/Endpoints/IEndpoint.cs +++ b/src/Proto.Remote/Endpoints/IEndpoint.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Concurrent; -using System.Threading; using System.Threading.Channels; namespace Proto.Remote; diff --git a/src/Proto.Remote/Endpoints/RemoteMessageHandler.cs b/src/Proto.Remote/Endpoints/RemoteMessageHandler.cs index 08d3b8552d..3e0f9b92e1 100644 --- a/src/Proto.Remote/Endpoints/RemoteMessageHandler.cs +++ b/src/Proto.Remote/Endpoints/RemoteMessageHandler.cs @@ -5,7 +5,6 @@ // ----------------------------------------------------------------------- using System; -using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Logging; using Proto.Mailbox; diff --git a/src/Proto.Remote/GrpcNet/GrpcNetClientRemote.cs b/src/Proto.Remote/GrpcNet/GrpcNetClientRemote.cs index dad3cecb4f..54f0d23072 100644 --- a/src/Proto.Remote/GrpcNet/GrpcNetClientRemote.cs +++ b/src/Proto.Remote/GrpcNet/GrpcNetClientRemote.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Proto.Remote.Metrics; namespace Proto.Remote.GrpcNet; diff --git a/src/Proto.Remote/GrpcNet/GrpcNetRemote.cs b/src/Proto.Remote/GrpcNet/GrpcNetRemote.cs index 2b0f4e2aab..b2cdde06d9 100644 --- a/src/Proto.Remote/GrpcNet/GrpcNetRemote.cs +++ b/src/Proto.Remote/GrpcNet/GrpcNetRemote.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Proto.Remote.Metrics; namespace Proto.Remote.GrpcNet; diff --git a/src/Proto.Remote/Messages.cs b/src/Proto.Remote/Messages.cs index 924c881df7..116c684f12 100644 --- a/src/Proto.Remote/Messages.cs +++ b/src/Proto.Remote/Messages.cs @@ -4,8 +4,6 @@ // // ----------------------------------------------------------------------- -using System; - namespace Proto.Remote; public sealed record EndpointTerminatedEvent(bool OnError, string? Address, string? ActorSystemId) diff --git a/src/Proto.Remote/RemoteProcess.cs b/src/Proto.Remote/RemoteProcess.cs index e4f1f74863..3d780847ca 100644 --- a/src/Proto.Remote/RemoteProcess.cs +++ b/src/Proto.Remote/RemoteProcess.cs @@ -4,7 +4,6 @@ // // ----------------------------------------------------------------------- -using System; using System.Diagnostics; using Proto.Mailbox; diff --git a/src/Proto.Remote/Serialization/ICachedSerialization.cs b/src/Proto.Remote/Serialization/ICachedSerialization.cs index 9a566158fe..b613980ea7 100644 --- a/src/Proto.Remote/Serialization/ICachedSerialization.cs +++ b/src/Proto.Remote/Serialization/ICachedSerialization.cs @@ -3,8 +3,6 @@ // Copyright (C) 2015-2022 Asynkron AB All rights reserved // // ----------------------------------------------------------------------- -using Google.Protobuf; - namespace Proto.Remote; public interface ICachedSerialization diff --git a/tests/Proto.Cluster.Tests/Extensions.cs b/tests/Proto.Cluster.Tests/Extensions.cs index 804fe73171..bb6a87a6ea 100644 --- a/tests/Proto.Cluster.Tests/Extensions.cs +++ b/tests/Proto.Cluster.Tests/Extensions.cs @@ -1,12 +1,10 @@ using System; -using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using ClusterTest.Messages; using Proto.Cluster.Gossip; -using Xunit.Abstractions; namespace Proto.Cluster.Tests; diff --git a/tests/Proto.Cluster.Tests/GossipCoreTests.cs b/tests/Proto.Cluster.Tests/GossipCoreTests.cs index eb35ad6290..2df8f24b31 100644 --- a/tests/Proto.Cluster.Tests/GossipCoreTests.cs +++ b/tests/Proto.Cluster.Tests/GossipCoreTests.cs @@ -4,13 +4,11 @@ // // ----------------------------------------------------------------------- using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using FluentAssertions; -using Google.Protobuf; using Proto.Cluster.Gossip; using Proto.Logging; using Xunit;