namespace AyCode.Services.SignalRs;
///
/// Controls how the binary protocol serializes and transports data over the network.
///
/// Bytes: Serialize via ArrayBinaryOutput → single contiguous byte[],
/// written to the pipe as a raw blob. Deserialize via SequenceReader.ToArray() →
/// ArrayBinaryInput (single buffer, TryAdvanceSegment always false → JIT-eliminated).
/// Fastest individual ser/deser, no zerocopy, no pipeline overlap.
///
///
/// Segment: Serialize via BufferWriterBinaryOutput directly to the PipeWriter,
/// chunk-by-chunk with a single Flush at the end. Deserialize via SequenceBinaryInput
/// from multi-segment ReadOnlySequence<byte> (lazy TryGet iteration, cross-boundary scratch).
/// Zerocopy write, but no pipeline overlap.
///
///
/// AsyncSegment: Serialize via AsyncPipeWriterOutput directly to the PipeWriter,
/// per-chunk FlushAsync sends data to the network during serialization. Deserialize via
/// PipeReaderBinaryInput with on-demand ReadAsync (processes chunks as they arrive).
/// Zerocopy write + pipeline parallelism (ser/network/deser overlap), highest roundtrip potential
/// for large payloads.
///
///
public enum BinaryProtocolMode
{
///
/// ArrayBinaryOutput → byte[] → pipe. Deser: ToArray() → ArrayBinaryInput.
/// Fastest ser/deser, no zerocopy, no pipeline overlap.
///
Bytes = 0,
///
/// BufferWriterBinaryOutput → PipeWriter, single Flush at end. Deser: SequenceBinaryInput (multi-segment).
/// Zerocopy write, no pipeline overlap.
///
Segment = 1,
///
/// AsyncPipeWriterOutput → PipeWriter, per-chunk FlushAsync. Deser: PipeReaderBinaryInput (on-demand ReadAsync).
/// Zerocopy write + pipeline parallelism (ser/network/deser overlap).
///
AsyncSegment = 2,
}