SbeWriteBuffer

StockSharp.Sbe

SBE frame limits and write-buffer growth, so a write path can resize and retry instead of dropping a message that did not fit.

Methods

Grow
public static byte[] Grow(byte[] buffer, int minSize)
result = SbeWriteBuffer.Grow(buffer, minSize)

Returns a buffer at least bytes long. If the existing buffer is already large enough it is returned unchanged; otherwise a new buffer is allocated by doubling capacity until it covers , capped at MaxWriteBufferSize.

buffer
Current buffer (may be null).
minSize
Minimum required size in bytes.

Returns: A buffer whose length is at least .

IsOverflow
public static bool IsOverflow(Exception ex, int currentSize, int requiredSize)
result = SbeWriteBuffer.IsOverflow(ex, currentSize, requiredSize)

Recognizes the span-overflow exceptions thrown by the SBE serializer and computes a target size to grow to. A dedicated SbeBufferTooSmallException supplies an exact size; generic span overflows fall back to doubling.

ex
Exception raised by a serializer write.
currentSize
Size of the buffer the write was attempted into.
requiredSize
Size the buffer must grow to before retrying.

Returns: if the exception means the buffer was too small.

Fields

InitialWriteBufferSize
public const int InitialWriteBufferSize
value = SbeWriteBuffer.InitialWriteBufferSize

Default initial size of a write buffer.

MaxFilePartSize
public const int MaxFilePartSize
value = SbeWriteBuffer.MaxFilePartSize

The most bytes of a file body one frame carries. A longer body goes in several frames; the rest of a frame is left to what says which file it is.

MaxFrameSize
public const int MaxFrameSize
value = SbeWriteBuffer.MaxFrameSize

Hard upper bound for a single SBE frame, enforced identically on the read and write sides. Neither peer may emit a frame larger than the other will accept.

MaxWriteBufferSize
public const int MaxWriteBufferSize
value = SbeWriteBuffer.MaxWriteBufferSize

Hard upper bound for a single SBE frame on the write side. A frame that does not fit even after growing to this size is treated as a genuine error and re-thrown, rather than looping forever on reallocation. Must not exceed MaxFrameSize.