diff --git a/src/DataStreamSuite/DataStreamCore/Messaging/v2/Receive/PubSubServer/PubsubServerStreamTagHandler.cs b/src/DataStreamSuite/DataStreamCore/Messaging/v2/Receive/PubSubServer/PubsubServerStreamTagHandler.cs index 16873194d..db59f851a 100644 --- a/src/DataStreamSuite/DataStreamCore/Messaging/v2/Receive/PubSubServer/PubsubServerStreamTagHandler.cs +++ b/src/DataStreamSuite/DataStreamCore/Messaging/v2/Receive/PubSubServer/PubsubServerStreamTagHandler.cs @@ -26,8 +26,6 @@ namespace bts { return rv; } public string[] supportedTagTypes { get; } - public void register(InternalPublishDelegate callback) { } - public void doWork() { } } // This class is created by the SingleTagData for stream tag_type. Every pub @@ -79,10 +77,6 @@ namespace bts { return new string[] { "DS" }; } } - public void register(InternalPublishDelegate callback) { - - } - public void doWork() { } } public class PubsubServerStreamTagHandler : IPubSubServerTagHandler { @@ -117,13 +111,5 @@ namespace bts { } return rv; } - public void register(InternalPublishDelegate callback) { - foreach (var h in _handler_map.Values) - h.register(callback); - } - public void doWork() { - foreach (var h in _handler_map.Values) - h.doWork(); - } } -} \ No newline at end of file +} diff --git a/src/DataStreamSuite/PubSub/Client/IPubSubServerTagHandler.cs b/src/DataStreamSuite/PubSub/Client/IPubSubServerTagHandler.cs index ed9f9b8c4..278d26da0 100644 --- a/src/DataStreamSuite/PubSub/Client/IPubSubServerTagHandler.cs +++ b/src/DataStreamSuite/PubSub/Client/IPubSubServerTagHandler.cs @@ -1,17 +1,10 @@ -using System; -using System.IO; -using BCG.Utilities.General; -using System.Collections.Generic; -using mbts; - namespace BCG { - public delegate void InternalPublishDelegate(ICollection> pubData); /// /// The Pubsub holds an instance of this for every tag /// type. this interface holds the state of each tag /// in the pubsub. /// - public interface IPubSubServerTagHandler : IWorker { + public interface IPubSubServerTagHandler { /// /// This is called when a new data gets published, so IPubSubServerTagHandler can ///interpret the data and update its state (which it will be asked to return in get_content) @@ -25,17 +18,5 @@ namespace BCG { /// /// byte[] get_content(string tag); - /// - /// list of tagTypes this interface supports - /// - string[] supportedTagTypes { get; } - /// - /// registering a callback gives this interface - /// the extra flexibility to publish its own - /// data back to the pubsub. this function will - /// be ignored executed outside the pubsub server - /// - /// - void register(InternalPublishDelegate callback); } } diff --git a/src/DataStreamSuite/PubSub/Client/PubsubTagHandlerFactory.cs b/src/DataStreamSuite/PubSub/Client/PubsubTagHandlerFactory.cs index bdfdd41ab..5da719b42 100644 --- a/src/DataStreamSuite/PubSub/Client/PubsubTagHandlerFactory.cs +++ b/src/DataStreamSuite/PubSub/Client/PubsubTagHandlerFactory.cs @@ -34,7 +34,7 @@ namespace bts { public static string assembly_location => Assembly.GetExecutingAssembly().Location; - public static BCG.IPubSubServerTagHandler get_handler(string tag_type, bool on_pubsub_server) { + public static IPubSubServerTagHandler get_handler(string tag_type) { TagHandlerEntry handler_entry = _find_config_entry(tag_type); Log.assert(handler_entry != null); return _find_or_build_handler(handler_entry); diff --git a/src/DataStreamSuite/PubSub/Server/InternalTagHandling/SystemStatsPublisher.cs b/src/DataStreamSuite/PubSub/Server/InternalTagHandling/SystemStatsPublisher.cs index efeb633b9..8e7b0fbac 100644 --- a/src/DataStreamSuite/PubSub/Server/InternalTagHandling/SystemStatsPublisher.cs +++ b/src/DataStreamSuite/PubSub/Server/InternalTagHandling/SystemStatsPublisher.cs @@ -13,7 +13,7 @@ namespace BCG { /// but returns the state in get_content (though it could have perhaps used update instead ofth spcialized event, onPublishStats) to /// keep track of publish sizes. /// - internal class SystemStatsPublisher : IPubSubServerTagHandler { + internal class SystemStatsPublisher : IPubSubServerTagHandler, IWorker { public static string tag_type = "System_Stats"; public static string tag_name = "System_AllStatistics"; // these tags have been touched, need to publish in the next doWork @@ -91,12 +91,6 @@ namespace BCG { // return str.ToArray(); } - public string[] supportedTagTypes { - get { return new string[] { SystemStatsPublisher.tag_type }; } - } - - public void register(InternalPublishDelegate callback) { } - #endregion } } diff --git a/src/DataStreamSuite/PubSub/Server/InternalTagHandling/SystemSubscriptionMapPublisher.cs b/src/DataStreamSuite/PubSub/Server/InternalTagHandling/SystemSubscriptionMapPublisher.cs index f68407e05..55c462d6a 100644 --- a/src/DataStreamSuite/PubSub/Server/InternalTagHandling/SystemSubscriptionMapPublisher.cs +++ b/src/DataStreamSuite/PubSub/Server/InternalTagHandling/SystemSubscriptionMapPublisher.cs @@ -20,7 +20,7 @@ namespace BCG { /// It does not have much state except for the dirty state. It builds the state to publish /// as well as return in get_content, from calling into PububState /// - class SystemSubscriptionMapPublisher : IPubSubServerTagHandler { + class SystemSubscriptionMapPublisher : IPubSubServerTagHandler, IWorker { private PubSubState _state; private HashSet _dirty_tags = new HashSet(); private readonly string _ip = SysInfoManager.getIP(); @@ -109,12 +109,6 @@ namespace BCG { return rv; } - public string[] supportedTagTypes { - get { return new string[] { SystemSubscriptionMapPublisher.tag_type }; } - } - - public void register(InternalPublishDelegate callback) { } - #endregion } -} \ No newline at end of file +} diff --git a/src/DataStreamSuite/PubSub/Server/SingleTagData.cs b/src/DataStreamSuite/PubSub/Server/SingleTagData.cs index d96903cc7..1d751c9c1 100644 --- a/src/DataStreamSuite/PubSub/Server/SingleTagData.cs +++ b/src/DataStreamSuite/PubSub/Server/SingleTagData.cs @@ -27,7 +27,6 @@ namespace bts { _tag_handler = get_handler(tag_type); Log.notnull(_tag_handler); Log.Gen.info($"SingleTagData.cons tag: {tag} tag_type: {tag_type} _tag_handler: {_tag_handler}"); - _tag_handler.register(new InternalPublishDelegate(_on_handler_internal_publish)); } public IPubSubServerTagHandler? get_handler(string tag_type) { @@ -35,7 +34,7 @@ namespace bts { return SystemSubscriptionMapPublisher.getInstance(); else if (tag_type == SystemStatsPublisher.tag_type) return SystemStatsPublisher.get_instance(); - return PubsubTagHandlerFactory.get_handler(tag_type, true); + return PubsubTagHandlerFactory.get_handler(tag_type); }