cleanup: Remove unused pubsub tag handler code
* Removed 'IPubSubServerTagHandler.register' - All implementations of this function were empty * Removed 'IPubSubServerTagHandler.supportedTagTypes' - This property wasn't referenced anywhere * Remove IWorker inheritance from IPubSubServerTagHandler - No reason these interfaces have to be tied together
This commit is contained in:
1 parent
ec1e657687
commit
475bf1effc
6 files changed
+7
-53
No files matched your search
+1
-15
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Triplet<string, string, byte[]>> pubData);
|
||||
/// <summary>
|
||||
/// The Pubsub holds an instance of this for every tag
|
||||
/// type. this interface holds the state of each tag
|
||||
/// in the pubsub.
|
||||
/// </summary>
|
||||
public interface IPubSubServerTagHandler : IWorker {
|
||||
public interface IPubSubServerTagHandler {
|
||||
/// <summary>
|
||||
/// 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 {
|
||||
/// <param name="tag"></param>
|
||||
/// <returns></returns>
|
||||
byte[] get_content(string tag);
|
||||
/// <summary>
|
||||
/// list of tagTypes this interface supports
|
||||
/// </summary>
|
||||
string[] supportedTagTypes { get; }
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <param name="callback"></param>
|
||||
void register(InternalPublishDelegate callback);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
+2
-8
@@ -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
|
||||
/// </summary>
|
||||
class SystemSubscriptionMapPublisher : IPubSubServerTagHandler {
|
||||
class SystemSubscriptionMapPublisher : IPubSubServerTagHandler, IWorker {
|
||||
private PubSubState _state;
|
||||
private HashSet<string> _dirty_tags = new HashSet<string>();
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user