Files
spark/src/DataStreamSuite/PubSub/ManagedTCP/RemoteMessage.cs
T
John Colvin 7d6e4efa4f cleanup: Fix numerous build warnings in DataStreamSuite
Nearly all warnings were due to nullability issues, since the concept of
nullable reference types did not exist when the DataStream code was
originally written.

* Compression related files
  - BZip2InputStream  (disable nullability warnings)
  - BZip2OutputStream (disable nullability warnings)
  - DeflaterHuffman   (disable nullability warnings)
  - Inflater          (disable nullability warnings)
  - InflaterDynHeader (disable nullability warnings)
  - ParallelJoinTest  (disable nullability warnings)
  - TarHeader
  - TarInputStream    (disable nullability warnings)
  - ZipEntry
  - ZipFile
  - ZipInputStream

* AsyncTCPConnection_APM
* AsyncTCPConnection_APM
* InflaterHuffmanTree
* ManagedSubscriber
* ManagedTCPMessageHub
* MapStream
* PubSubClientMessage
  - Normalize indentation/whitespace
  - Fix some typos
  - Address nullability issues to fix build warnings
  - Modernize code
* PubSubMessageReactor
* PubSubServerManagedTCPConnection
* PubSubSingleTagStateEvent
* PubSubState
* PublisherCore
* PubsubDeserializationController
* RemoteMessage
  - make 'message' nullable to resolve warnings elsewhere (in calling code)
* SharedStreamConfig
* SingleTagData
* SubscriberCore
* SuperMapStream
* SystemHeartbeatPublisher
* SystemStatsPublisher
* SystemSubscriptionMapPublisher
* ThreadSafeQueue
* TradeBarsStream

Only use Registry on windows.
2025-12-30 11:38:20 -05:00

56 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace BCG
{
/// <summary>
/// Type of messages that can be sent over the transport.
/// </summary>
public enum RemoteMessageType
{
Heartbeat, Data, Connection, Disconnection
}
/// <summary>
/// Every message from a remote peer, is represented as a RemoteMessage.
/// This can be a transport generated message (heartbeat) or user generated
/// message (data)
/// </summary>
public class RemoteMessage
{
private byte[]? myMsg;
private RemoteMessageType myMsgType;
private RemoteConnectionInfo myConnInfo;
public RemoteMessage(byte[]? message, RemoteMessageType messageType, RemoteConnectionInfo connInfo)
{
myMsg = message;
myMsgType = messageType;
myConnInfo = connInfo;
}
public byte[]? message
{
get { return myMsg; }
}
public RemoteMessageType messageType
{
get { return myMsgType; }
}
public RemoteConnectionInfo remoteConnectionInfo
{
get { return myConnInfo; }
}
override public string ToString()
{
Func<byte[], int> len = (byte[] m) => { return m == null ? 0 : m.Length; };
return $"type: {myMsgType} conn: {myConnInfo} msg: {len(myMsg)}";
}
}
}