TimeSeries and TimeBucketStreams, Stream offloading etc
This commit is contained in:
1 parent
33030b1212
commit
88bf04e5f1
31 files changed
+1823
-836
No files matched your search
+31
-33
@@ -3,16 +3,15 @@ using System.IO;
|
||||
using System.Collections;
|
||||
using BCG.Utilities;
|
||||
|
||||
namespace BCG
|
||||
{
|
||||
namespace BCG {
|
||||
/// <summary>
|
||||
/// Controls (ie creates dynamically) an IClientDeserializer and then passes data to it.
|
||||
/// </summary>
|
||||
public class ClientDeserializationController : IClientDeserializer
|
||||
{
|
||||
public class ClientDeserializationController : IClientDeserializer {
|
||||
private IClientDeserializer myDeserializer;
|
||||
|
||||
public ClientDeserializationController () {}
|
||||
private int _n_desers = 0;
|
||||
|
||||
public ClientDeserializationController() { }
|
||||
|
||||
#region IClientDeserializer Members
|
||||
|
||||
@@ -23,42 +22,41 @@ namespace BCG
|
||||
/// <param name="streams"></param>
|
||||
/// <param name="theOps"></param>
|
||||
/// <param name="theRows"></param>
|
||||
public void deserialize (Stream[] streams, out byte[] theOps, out Array theRows)
|
||||
{
|
||||
if (myDeserializer != null)
|
||||
{
|
||||
myDeserializer.deserialize (streams, out theOps, out theRows);
|
||||
}
|
||||
else
|
||||
{
|
||||
Stream totalStream = UtilityMethods.getAggregatedStream (streams);
|
||||
public void deserialize(Stream[] streams, out byte[] theOps, out Array theRows) {
|
||||
bts.Log.Gen.info($"ClientDeserializationController.deserialize len: {streams[0].Length - streams[0].Position}");
|
||||
if (myDeserializer != null) {
|
||||
myDeserializer.deserialize(streams, out theOps, out theRows);
|
||||
} else {
|
||||
Stream totalStream = UtilityMethods.getAggregatedStream(streams);
|
||||
long initialPos = totalStream.Position;
|
||||
BinaryReader br = new BinaryReader (totalStream);
|
||||
BinaryReader br = new BinaryReader(totalStream);
|
||||
byte op;
|
||||
try
|
||||
{
|
||||
op = br.ReadByte ();
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
{
|
||||
try {
|
||||
op = br.ReadByte();
|
||||
} catch (EndOfStreamException) {
|
||||
op = Byte.MaxValue;
|
||||
}
|
||||
if (op == StreamOpCode.create)
|
||||
{
|
||||
br.ReadString (); //pubsubclientdeserializer
|
||||
string deserName = br.ReadString ();
|
||||
myDeserializer = Activator.CreateInstance (Type.GetType (deserName))
|
||||
if (op == StreamOpCode.create) {
|
||||
br.ReadString(); //pubsubclientdeserializer
|
||||
string deserName = br.ReadString();
|
||||
myDeserializer = Activator.CreateInstance(Type.GetType(deserName))
|
||||
as IClientDeserializer;
|
||||
totalStream.Position = initialPos;
|
||||
myDeserializer.deserialize (new Stream[] {totalStream}, out theOps, out theRows);
|
||||
}
|
||||
else
|
||||
{
|
||||
myDeserializer.deserialize(new Stream[] { totalStream }, out theOps, out theRows);
|
||||
} else {
|
||||
// BlueEventLog.logEvent ("Received a non create before a create", BlueEventLevel.Warning);
|
||||
theOps = new byte[]{};
|
||||
theRows = new object[]{};
|
||||
theOps = new byte[] { };
|
||||
theRows = new object[] { };
|
||||
}
|
||||
}
|
||||
var msgs = StreamIOMessage.assemble_msgs(theOps, theRows);
|
||||
int i = 0;
|
||||
foreach (var m in msgs) {
|
||||
bts.Log.Gen.info($"ClientDeserializationController n_desers: {_n_desers} msg no: {i++}: {m}");
|
||||
}
|
||||
_n_desers++;
|
||||
// log it here
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user