Files
spark/src/DataStreamSuite/PubSub/ManagedTCP/RemoteMessage.cs
T
John Colvin 7ebafd8246 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.

* PubSubClientMessage
  - Normalize indentation/whitespace
  - Fix some typos
  - Address nullability issues to fix build warnings
  - Modernize code

* Compression related files
  - ZipEntry
  - ZipFile
  - ZipInputStream
  - TarHeader

* RemoteMessage
  - make 'message' nullable to resolve warnings elsewhere (in calling code)

* PubSubSingleTagStateEvent.cs
* PubSubMessageReactor
* PubSubState
* SystemHeartbeatPublisher
* SystemStatsPublisher
* SingleTagData
* ManagedTCPMessageHub
* PubsubDeserializationController
* PublisherCore
* InflaterHuffmanTree
* AsyncTCPConnection_APM
* ThreadSafeQueue
* ManagedSubscriber
* SubscriberCore
* PubSubServerManagedTCPConnection
* AsyncTCPConnection_APM
* SuperMapStream
* MapStream
* TradeBarsStream
2024-11-25 15:26:57 +00: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)}";
}
}
}