Streams can be published and subscribed now
This commit is contained in:
1 parent
8035255868
commit
061481419e
20 files changed
+450
-698
No files matched your search
@@ -15,9 +15,9 @@ namespace BCG {
|
||||
public class ViewStreamDatabase : IWorker, IDisposable {
|
||||
internal delegate void TagFireDelegate(string tag);
|
||||
public delegate void DoWorkDelegate();
|
||||
public event DoWorkDelegate onDoWorkStart,
|
||||
private event DoWorkDelegate onDoWorkStart,
|
||||
onDoWorkEnd;
|
||||
internal event TagFireDelegate onTagFireStart,
|
||||
private event TagFireDelegate onTagFireStart,
|
||||
onTagFireEnd;
|
||||
//currently onTagUpdate is usd by the DataStreamPerfRecorder to keep track of how often the updates for various streams come in
|
||||
//and how big they are.
|
||||
@@ -82,28 +82,19 @@ namespace BCG {
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<string> getCachedTables() {
|
||||
List<string> result = new List<string>();
|
||||
|
||||
|
||||
foreach (string s in _table_accumulator_map.Keys)
|
||||
if (((ITableAccumulator)_table_accumulator_map[s]).isActive())
|
||||
result.Add(s);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public ISubscriberCore subscriber { get { return mySubscriberCore; } }
|
||||
|
||||
|
||||
public ITableAccumulator getITableAccumulator(string tableName) {
|
||||
public ITableAccumulator getITableAccumulator(string table_name) {
|
||||
// If theres a ITableAccumulator for the tableName its returned (to share subscriptions), otherwise
|
||||
// a new one is obtained from the Subscriber factory
|
||||
|
||||
_table_accumulator_map[tableName] = _table_accumulator_map[tableName] == null ?
|
||||
AccumulatorFactory.getAccumulator(tableName, mySubscriberCore) : _table_accumulator_map[tableName];
|
||||
|
||||
return _table_accumulator_map[tableName] as ITableAccumulator;
|
||||
ITableAccumulator rv = null;
|
||||
var table_tag_name = DSTagManager.get_stream_tag(table_name);
|
||||
if (!_table_accumulator_map.TryGetValue(table_tag_name, out rv)) {
|
||||
rv = AccumulatorFactory.getAccumulator(table_tag_name, mySubscriberCore);
|
||||
_table_accumulator_map.Add(table_tag_name, rv);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
public void doWork() {
|
||||
@@ -136,7 +127,7 @@ namespace BCG {
|
||||
|
||||
if (onTagFireStart != null)
|
||||
onTagFireStart(tag);
|
||||
table_accumulator.update(tag_updates.Select(t => new MemoryStream(t)).ToArray());
|
||||
table_accumulator.handle_updates(tag_updates);
|
||||
if (onTagFireEnd != null)
|
||||
onTagFireEnd(tag);
|
||||
_timer.stop();
|
||||
@@ -253,27 +244,4 @@ namespace BCG {
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Returns a subscriber based on the name of the tag. Hardcoded right now, will change to config
|
||||
/// later
|
||||
/// </summary>
|
||||
public class SubscriberFactory
|
||||
{
|
||||
public static ITableAccumulator getITableAccumulator (string tag, SubscriberCore subCore)
|
||||
{
|
||||
string tableName = tag.Substring (3);
|
||||
if (!DataStreamGatewaySettings.instance.isSerializableUnderNewScheme (tableName))
|
||||
return new TableSubscriber (tag, subCore);
|
||||
else
|
||||
{
|
||||
string subName = DataStreamGatewaySettings.instance.getSubscriber (tableName);
|
||||
if (subName.Equals ("BCG.NonIncrementalTableSubscriber"))
|
||||
return new NonIncrementalTableSubscriber (tag, subCore);
|
||||
else
|
||||
return new TableSubscriber (tag, subCore);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
Reference in new issue
Block a user