From cb5fcee2ce64c252d2a04af0ccb788698cfdc9e5 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Fri, 12 Jul 2024 23:22:22 -0400 Subject: [PATCH] Remove unused PubSubConfig props --- .../PubSub/Config/PubSubConfig.cs | 66 ------------------ .../PubSub/Config/PubSubPortRange.cs | 67 ------------------- 2 files changed, 133 deletions(-) delete mode 100644 src/DataStreamSuite/PubSub/Config/PubSubPortRange.cs diff --git a/src/DataStreamSuite/PubSub/Config/PubSubConfig.cs b/src/DataStreamSuite/PubSub/Config/PubSubConfig.cs index b87ed3c1e..1b512fcdb 100644 --- a/src/DataStreamSuite/PubSub/Config/PubSubConfig.cs +++ b/src/DataStreamSuite/PubSub/Config/PubSubConfig.cs @@ -26,80 +26,27 @@ public class PubSubConfig { public bool? SimpleEchoServer { get; set; } - // unused - public int? MillisecondsBetweenSubInfoUpdates { get; set; } = 1000; - - // unused - public int? MillisecondsBetweenTimeSliceUpdates { get; set; } = 5000; - - // unused - public int? MillisecondsBetweenNoBufferRetries { get; set; } = 100; - - // unused - public int? RetriesOnNoBufferSpace { get; set; } = 1; - - // unused - public int? DoItAllSecondsBetweenLog { get; set; } = 0; - // Used by the PubSubMessageReactor to pass to the ManagedTCPMessageHb (but unsed within it) public int? HeartbeatInterval { get; set; } = 15000; public int? MissingHeartbeatsBeforeGc { get; set; } = 50; - // unused - // Milliseconds - public int? StateUpdatePeriod { get; set; } = 5000; - - // unused - // Milliseconds - public int? StatisticsUpdatePeriod { get; set; } = 5000; - - // Milliseconds - public int? DisposedConnectionCheckPeriod { get; set; } = 1000; - public TagTypeToAssembly? TagTypeToAssemblyMap { get; set; } public PubSubTagHandlerFactoryConfig? TagHandlerFactory { get; set; } - // unused - public int? LatencyReportThresholdMs { get; set; } - - // unused - public bool? InternallyPublishSubInfo { get; set; } - - public string? CompressedTags { get; set; } - - public int? GcActivationThreshold { get; set; } - - // Milliseconds - public int? WaitPeriodAfterGc { get; set; } - public PubSubRouterConfig? Routing { get; set; } public List? PublisherRoutes => Routing?.PublisherRoutes; public List? SubscriberRoutes => Routing?.SubscriberRoutes; public static PubSubConfig Default() { - const string NOTAGS = "^NOTAGS$"; var rv = new PubSubConfig() { - MillisecondsBetweenSubInfoUpdates = 1000, - MillisecondsBetweenTimeSliceUpdates = 5000, - MillisecondsBetweenNoBufferRetries = 100, - RetriesOnNoBufferSpace = 1, - DoItAllSecondsBetweenLog = 0, HeartbeatInterval = 15000, MissingHeartbeatsBeforeGc = 50, - StateUpdatePeriod = 5000, - StatisticsUpdatePeriod = 5000, - DisposedConnectionCheckPeriod = 1000, ServerPort = 12345, TagTypeToAssemblyMap = new(), TagHandlerFactory = PubSubTagHandlerFactoryConfig.Default(), - LatencyReportThresholdMs = 1500, - InternallyPublishSubInfo = true, - CompressedTags = NOTAGS, - GcActivationThreshold = 0, - WaitPeriodAfterGc = 1000, SimpleEchoServer = false, Routing = new() { PublisherRoutes = new() { @@ -114,24 +61,11 @@ public class PubSubConfig { } public void MergeWith(PubSubConfig other) { - MillisecondsBetweenSubInfoUpdates ??= other.MillisecondsBetweenSubInfoUpdates; - MillisecondsBetweenTimeSliceUpdates ??= other.MillisecondsBetweenTimeSliceUpdates; - MillisecondsBetweenNoBufferRetries ??= other.MillisecondsBetweenNoBufferRetries; - RetriesOnNoBufferSpace ??= other.RetriesOnNoBufferSpace; - DoItAllSecondsBetweenLog ??= other.DoItAllSecondsBetweenLog; HeartbeatInterval ??= other.HeartbeatInterval; MissingHeartbeatsBeforeGc ??= other.MissingHeartbeatsBeforeGc; - StateUpdatePeriod ??= other.StateUpdatePeriod; - StatisticsUpdatePeriod ??= other.StatisticsUpdatePeriod; - DisposedConnectionCheckPeriod ??= other.DisposedConnectionCheckPeriod; ServerPort ??= other.ServerPort; TagTypeToAssemblyMap ??= other.TagTypeToAssemblyMap; TagHandlerFactory ??= other.TagHandlerFactory; - LatencyReportThresholdMs ??= other.LatencyReportThresholdMs; - InternallyPublishSubInfo ??= other.InternallyPublishSubInfo; - CompressedTags ??= other.CompressedTags; - GcActivationThreshold ??= other.GcActivationThreshold; - WaitPeriodAfterGc ??= other.WaitPeriodAfterGc; SimpleEchoServer ??= other.SimpleEchoServer; if (other.Routing is not null) { if (Routing is null) { diff --git a/src/DataStreamSuite/PubSub/Config/PubSubPortRange.cs b/src/DataStreamSuite/PubSub/Config/PubSubPortRange.cs deleted file mode 100644 index 845234db3..000000000 --- a/src/DataStreamSuite/PubSub/Config/PubSubPortRange.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Text.Json; -using System.Text.Json.Nodes; -using System.Text.Json.Serialization; - -namespace BCG -{ - /* - * PubSubPortRange.cs - * - * This class represents a range of ports that could be used by a server. - * Servers that wish to provide services ask the blue pages for a port they can use, - * and blue pages replies with a port. - * - * */ - [JsonConverter(typeof(PubSubPortRangeJsonConverter))] - public class PubSubPortRange - { - - public PubSubPortRange() - { - - } - - public PubSubPortRange(int min, int max) - { - minPort = min; - maxPort = max; - - } - - public int minPort; - public int maxPort; - - } - - public class PubSubPortRangeJsonConverter : JsonConverter { - public override PubSubPortRange? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - var rv = new PubSubPortRange(); - var jsonObj = JsonSerializer.Deserialize(ref reader, options); - if (jsonObj is null) { - return null; - } - ReadPrimitive("min_port", ref rv.minPort); - ReadPrimitive("max_port", ref rv.maxPort); - return rv; - - void ReadPrimitive(string key, ref T valueOut) where T : struct { - if (jsonObj.TryGetPropertyValue(key, out var valueJson)) { - var valueInt = valueJson?.GetValue(); - // Only (over)write valueOut if non-null - if (valueInt.HasValue) { - valueOut = valueInt.Value; - } - } - } - } - - public override void Write(Utf8JsonWriter writer, PubSubPortRange value, JsonSerializerOptions options) { - var jsonObj = new JsonObject { - ["min_port"] = value.minPort, - ["max_port"] = value.maxPort, - }; - JsonSerializer.Serialize(writer, jsonObj, options); - } - } -}