Cleaned up the cashe held by PublisherCore

This commit is contained in:
Taha Afzal authored and John Colvin committed 2024-05-25 15:37:33 +00:00
1 parent 7feaf869dc
commit 8035255868
18 files changed
+511 -810

No files matched your search

@@ -4,89 +4,74 @@ using System.Data;
using BCG.Utilities;
namespace BCG
{
public class TableStream : ViewStream
{
namespace BCG {
public class TableStream : ViewStream {
public string tableName;
private ITableAccumulator myTA;
private bool myGotData = false;
public TableStream(string tableName)
:
this(tableName, null, null)
{
this(tableName, null, null) {
}
public TableStream(string tableName, ViewStreamDatabase db)
:
this(tableName, db, null)
{}
this(tableName, db, null) { }
public TableStream(string tableName, string colExp)
:
this(tableName,
null,
colExp)
{}
this(tableName,
null,
colExp) { }
public TableStream(string ttableName, ViewStreamDatabase db, string colExp)
{
tableName = PubStreamPrefixer.prefix (ttableName);
public TableStream(string ttableName, ViewStreamDatabase db, string colExp) {
tableName = DSTagManager.get_stream_tag(ttableName);
// if (colExp != null)
// mySetRealSource (new ProjectStream (new TableStream (tableName, db), colExp));
// else
{
if (db == null)
myTA = ViewStreamDatabase.instance.getITableAccumulator (tableName);
myTA = ViewStreamDatabase.instance.getITableAccumulator(tableName);
else
myTA = db.getITableAccumulator (tableName);
myTA = db.getITableAccumulator(tableName);
}
}
protected override void myOnFirstSubscriber()
{
myTA.onUpdate += new TableUpdateDelegate (myHandleUpdates);
protected override void myOnFirstSubscriber() {
myTA.onUpdate += new TableUpdateDelegate(myHandleUpdates);
}
protected override void myOnLastSubscriber()
{
myTA.onUpdate -= new TableUpdateDelegate (myHandleUpdates);
protected override void myOnLastSubscriber() {
myTA.onUpdate -= new TableUpdateDelegate(myHandleUpdates);
}
protected virtual void myHandleUpdates (IBlueRowCollection newRows, IBlueRowCollection addedRows, IBlueRowCollection deletedRows)
{
if (!myGotData)
{
protected virtual void myHandleUpdates(IBlueRowCollection newRows, IBlueRowCollection addedRows, IBlueRowCollection deletedRows) {
if (!myGotData) {
myGotData = true;
// BlueEventLog.logEvent("Received data for " + tableName + " for the first time", BlueEventLevel.Information);
}
myFireEvent (new DataPacket (newRows, addedRows, deletedRows));
myFireEvent(new DataPacket(newRows, addedRows, deletedRows));
}
public override string ToString()
{
public override string ToString() {
return GetType() + " table = " + tableName;
}
}
public class ThreadedTableStream : TableStream, IExportableDataStream
{
public class ThreadedTableStream : TableStream, IExportableDataStream {
static private Lazy<ViewStreamDatabase> _vsd = new Lazy<ViewStreamDatabase>(() => new ViewStreamDatabase(), true);
public ThreadedTableStream(string table) : base(table, _vsd.Value)
{
public ThreadedTableStream(string table) : base(table, _vsd.Value) {
}
public void begin_subscription()
{
public void begin_subscription() {
this.onChange += _stream_onChange;
}
public event ExportableChangeDelegate on_change;
void _stream_onChange(object newValue)
{
if(on_change != null)
void _stream_onChange(object newValue) {
if (on_change != null)
on_change(newValue);
}
}