54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
// using BCG;
|
|
|
|
// using bts;
|
|
|
|
// using System.Linq;
|
|
|
|
// namespace BCG {
|
|
// // used on the client
|
|
// public class StreamOffloadRequestor {
|
|
// public class OffloadOp {
|
|
// string name;
|
|
// string stream_exp;
|
|
// }
|
|
// private IBlueTableSchema _schema;
|
|
// private IBlueRowCollection _rows;
|
|
// private PubTableBroker _broker = new PubTableBroker();
|
|
// ViewStream _existing_offloads_vs = new TableStream("cloud_streams");
|
|
// public StreamOffloadRequestor() {
|
|
// _schema = new BlueTableSchema("cloud_streams",
|
|
// new ColumnInfo("id", 0, typeof(int)),
|
|
// new ColumnInfo("name", 1, typeof(string)),
|
|
// new ColumnInfo("persist", 2, typeof(bool)),
|
|
// new ColumnInfo("stream_exp", 3, typeof(string)));
|
|
// _existing_offloads_vs.onChange += _on_str;
|
|
// }
|
|
// 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.create_table(_rows);
|
|
// }
|
|
// public void add_to_cloud(string name, string stream_exp, bool persist) {
|
|
// // check if it exists
|
|
// if (_rows == null) {
|
|
// BlueTable table = new BlueTable(_schema);
|
|
// IBlueRow nr = new BlueRow(_schema, 0, name, persist, stream_exp);
|
|
// table.addRow(nr);
|
|
// _broker.create_table(table);
|
|
// // create table
|
|
// } else {
|
|
// if (exists(name))
|
|
// return;
|
|
// IBlueRow nr = new BlueRow(_schema, _rows.Count, name, persist, stream_exp);
|
|
// // TODO: use make_batch_changes instead
|
|
// Log.assert(false, "Fix addRow");
|
|
// //_broker.addRow(nr);
|
|
// }
|
|
// }
|
|
|
|
// bool exists(string name) {
|
|
// return _rows.to_ienum().Where(r => name == r.get<string>("name")).Count() > 0;
|
|
// }
|
|
// }
|
|
// } |