Cleaned up the cashe held by PublisherCore
This commit is contained in:
1 parent
7feaf869dc
commit
8035255868
18 files changed
+511
-810
No files matched your search
@@ -1,13 +1,12 @@
|
||||
using BCG;
|
||||
|
||||
using bts;
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace BCG
|
||||
{
|
||||
public class StreamOffloadRequestor
|
||||
{
|
||||
public class OffloadOp
|
||||
{
|
||||
namespace BCG {
|
||||
public class StreamOffloadRequestor {
|
||||
public class OffloadOp {
|
||||
string name;
|
||||
string stream_exp;
|
||||
}
|
||||
@@ -15,8 +14,7 @@ namespace BCG
|
||||
private IBlueRowCollection _rows;
|
||||
private PubTableBroker _broker = new PubTableBroker();
|
||||
ViewStream _existing_offloads_vs = new TableStream("cloud_streams");
|
||||
public StreamOffloadRequestor()
|
||||
{
|
||||
public StreamOffloadRequestor() {
|
||||
_schema = new BlueTableSchema("cloud_streams",
|
||||
new ColumnInfo("id", 0, typeof(int)),
|
||||
new ColumnInfo("name", 1, typeof(string)),
|
||||
@@ -24,35 +22,31 @@ namespace BCG
|
||||
new ColumnInfo("stream_exp", 3, typeof(string)));
|
||||
_existing_offloads_vs.onChange += _on_str;
|
||||
}
|
||||
private void _on_str(object obj)
|
||||
{
|
||||
private void _on_str(object obj) {
|
||||
DataPacket dp = obj as DataPacket;
|
||||
_rows = dp.newRows;
|
||||
// this is needed so the broker knows the state of the table
|
||||
_broker.createTable(_rows);
|
||||
_broker.create_table(_rows);
|
||||
}
|
||||
public void add_to_cloud(string name, string stream_exp, bool persist)
|
||||
{
|
||||
public void add_to_cloud(string name, string stream_exp, bool persist) {
|
||||
// check if it exists
|
||||
if (_rows == null)
|
||||
{
|
||||
if (_rows == null) {
|
||||
BlueTable table = new BlueTable(_schema);
|
||||
IBlueRow nr = new BlueRow(_schema, 0, name, persist, stream_exp);
|
||||
table.addRow(nr);
|
||||
_broker.createTable(table);
|
||||
_broker.create_table(table);
|
||||
// create table
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (exists(name))
|
||||
return;
|
||||
IBlueRow nr = new BlueRow(_schema, _rows.Count, name, persist, stream_exp);
|
||||
_broker.addRow(nr);
|
||||
// TODO: use make_batch_changes instead
|
||||
Log.assert(false, "Fix addRow");
|
||||
//_broker.addRow(nr);
|
||||
}
|
||||
}
|
||||
|
||||
bool exists(string name)
|
||||
{
|
||||
bool exists(string name) {
|
||||
return _rows.to_ienum().Where(r => name == r.get<string>("name")).Count() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user