Table of Contents

Class CellFrameCodec

Namespace
KernLab.Cell.Contracts
Assembly
KernLab.Cell.Contracts.dll

CellFrame 消息族线编码——[WireMessage] 派生。

public static class CellFrameCodec
Inheritance
CellFrameCodec
Inherited Members

Fields

TagByeFrame

ByeFrame 的 tag。

public const byte TagByeFrame = 5

Field Value

byte

TagCallbackFrame

CallbackFrame 的 tag。

public const byte TagCallbackFrame = 32

Field Value

byte

TagCallbackResultFrame

CallbackResultFrame 的 tag。

public const byte TagCallbackResultFrame = 33

Field Value

byte

TagCancelFrame

CancelFrame 的 tag。

public const byte TagCancelFrame = 64

Field Value

byte

TagChunkBeginFrame

ChunkBeginFrame 的 tag。

public const byte TagChunkBeginFrame = 18

Field Value

byte

TagChunkDataFrame

ChunkDataFrame 的 tag。

public const byte TagChunkDataFrame = 19

Field Value

byte

TagChunkEndFrame

ChunkEndFrame 的 tag。

public const byte TagChunkEndFrame = 20

Field Value

byte

TagDrainFrame

DrainFrame 的 tag。

public const byte TagDrainFrame = 4

Field Value

byte

TagHelloAckFrame

HelloAckFrame 的 tag。

public const byte TagHelloAckFrame = 2

Field Value

byte

TagHelloFrame

HelloFrame 的 tag。

public const byte TagHelloFrame = 1

Field Value

byte

TagInvokeFrame

InvokeFrame 的 tag。

public const byte TagInvokeFrame = 16

Field Value

byte

TagNotifyFrame

NotifyFrame 的 tag。

public const byte TagNotifyFrame = 80

Field Value

byte

TagReadyFrame

ReadyFrame 的 tag。

public const byte TagReadyFrame = 3

Field Value

byte

TagResultFrame

ResultFrame 的 tag。

public const byte TagResultFrame = 17

Field Value

byte

TagTelemetryBatchFrame

TelemetryBatchFrame 的 tag。

public const byte TagTelemetryBatchFrame = 48

Field Value

byte

Methods

ComputeLength(CellFrame)

总长(单趟遍历——变长成员计数;池化/直写形态的长度预算口)。

public static int ComputeLength(CellFrame message)

Parameters

message CellFrame

Returns

int

Encode(CellFrame)

编码(tag 判别 + 根前缀 + 子类字段)。返回新数组。

public static byte[] Encode(CellFrame message)

Parameters

message CellFrame

Returns

byte[]

Encode(IBufferWriter<byte>, CellFrame)

编码到 IBufferWriter<T>(零拷贝汇——PipeWriter 直写形态)。

public static void Encode(IBufferWriter<byte> writer, CellFrame message)

Parameters

writer IBufferWriter<byte>
message CellFrame

EncodeInto(Span<byte>, CellFrame)

写入调用方缓冲(零拷贝一等形态——长度须先经 ComputeLength)。

public static void EncodeInto(Span<byte> dest, CellFrame message)

Parameters

dest Span<byte>
message CellFrame

EncodePooled(CellFrame, out byte[])

编码到池化租借缓冲(零分配热路径——返回写入长度;缓冲由调用方 ArrayPool<byte>.Shared.Return(rented) 归还。载荷经传输同步拷贝入帧后即可归还)。

public static int EncodePooled(CellFrame message, out byte[] rented)

Parameters

message CellFrame
rented byte[]

Returns

int

TryDecode(ReadOnlySpan<byte>, out CellFrame?)

解码(未知 tag/截断/Count 超上限 = false——畸形报文拦截;逐字段防御)。

public static bool TryDecode(ReadOnlySpan<byte> source, out CellFrame? message)

Parameters

source ReadOnlySpan<byte>
message CellFrame

Returns

bool