Add: metadata to dsl callback
This commit is contained in:
1 parent
1c75f4a53f
commit
4237d58f76
3 files changed
+35
-12
No files matched your search
@@ -52,6 +52,13 @@ namespace BCG {
|
||||
this.addedRows = addedRows;
|
||||
this.deletedRows = deletedRows;
|
||||
}
|
||||
public DataPacket(IBlueRowCollection newRows, IBlueRowCollection addedRows, IBlueRowCollection deletedRows,
|
||||
IDictionary<string, object> meta_data) {
|
||||
this.newRows = newRows;
|
||||
this.addedRows = addedRows;
|
||||
this.deletedRows = deletedRows;
|
||||
this.meta_data = meta_data != null ? new Dictionary<string, object>(meta_data) : null;
|
||||
}
|
||||
|
||||
IBlueRowCollection IDataPacket.newRows => newRows;
|
||||
IBlueRowCollection IDataPacket.addedRows => addedRows;
|
||||
@@ -246,25 +253,35 @@ namespace BCG {
|
||||
return new DataPacket(nt, at, dt);
|
||||
}
|
||||
|
||||
public DataPacket deepCopy() {
|
||||
return new DataPacket(new OrderedBlueTable(newRows),
|
||||
new OrderedBlueTable(newRows),
|
||||
new BlueTable(deletedRows));
|
||||
public object Clone() {
|
||||
var copy = (DataPacket)MemberwiseClone();
|
||||
if (meta_data != null)
|
||||
copy.meta_data = new Dictionary<string, object>(meta_data);
|
||||
return copy;
|
||||
}
|
||||
|
||||
public DataPacket deepCopy() {
|
||||
var copy = new DataPacket(
|
||||
new OrderedBlueTable(newRows),
|
||||
new OrderedBlueTable(addedRows),
|
||||
new BlueTable(deletedRows)
|
||||
);
|
||||
if (meta_data != null)
|
||||
copy.meta_data = new Dictionary<string, object>(meta_data);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
public virtual DataPacket createImmutable() {
|
||||
return
|
||||
new DataPacket(
|
||||
newRows is IImmutableRowCollection ? newRows : new ImmutableBlueTable(newRows),
|
||||
addedRows,
|
||||
deletedRows);
|
||||
deletedRows, meta_data);
|
||||
}
|
||||
#region ICloneable Members
|
||||
|
||||
public object Clone() {
|
||||
return MemberwiseClone();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public string toIncrementalIDString() {
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
|
||||
private void _handle_data_cb(object dp_obj) {
|
||||
var dp = dp_obj as DataPacket;
|
||||
dp.meta_data = new Dictionary<string, object>(_dp_metadata);
|
||||
DataPacket dp_out = BlueDataUtility.build_dp_inc(dp.newRows, myLastValue as DataPacket, true);
|
||||
dp_out.meta_data = new Dictionary<string, object>(_dp_metadata);
|
||||
myFireEvent(dp_out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,8 +115,10 @@ namespace bts.websocket_core {
|
||||
var changedRows = new Dictionary<int, object>();
|
||||
var addedRows = new Dictionary<int, object>();
|
||||
|
||||
hdlr.dis = vs.AsObservable().Subscribe(OnData);
|
||||
|
||||
hdlr.dis = vs.AsObservable().Subscribe(OnData, OnError);
|
||||
void OnError(Exception e) {
|
||||
bts.Log.Gen.error(e.Message);
|
||||
}
|
||||
void OnData(DataPacket dp) {
|
||||
lock (syncRoot) {
|
||||
removedRows.Clear();
|
||||
@@ -138,6 +140,10 @@ namespace bts.websocket_core {
|
||||
added = addedRows.Values,
|
||||
changed = changedRows.Values,
|
||||
removed = removedRows.Values,
|
||||
metaData = new {
|
||||
dsl = dp.meta_data?["dsl"],
|
||||
dp.schema
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user