Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeInput(metadata InputMetadata, payload []byte) ([]byte, error)
- func EncodeOutput(sessionID string, epoch, sequence uint64, payload []byte) ([]byte, error)
- func SplitPayload(payload []byte) [][]byte
- type Anchor
- type DecodedFrame
- type Frame
- type InputMetadata
- type Plan
- type Recovery
- type Ring
- func (r *Ring) Anchor() Anchor
- func (r *Ring) Append(sessionID string, payload []byte) (Frame, error)
- func (r *Ring) Frames() []Frame
- func (r *Ring) Lower() uint64
- func (r *Ring) Plan(anchor *Anchor) Plan
- func (r *Ring) Recovery(anchor *Anchor) Recovery
- func (r *Ring) Reset(epoch, nextSequence uint64)
- func (r *Ring) Upper() uint64
Constants ¶
const ( DirectionClientToHost = byte(1) DirectionHostToClient = byte(2) KindInput = byte(1) KindOutput = byte(2) MaxHeader = 16 * 1024 MaxPayload = 8 * 1024 * 1024 )
Variables ¶
var ( BinaryMagic = []byte{0x44, 0x45, 0x4E, 0x42} Version = byte(1) )
Binary envelope wire format. This is intentionally the same DENB envelope used by the Swift transport: magic "DENB", version 1, direction byte, kind byte, header length (u32 BE), payload length (u32 BE), JSON header, payload.
Functions ¶
func EncodeInput ¶
func EncodeInput(metadata InputMetadata, payload []byte) ([]byte, error)
func EncodeOutput ¶
func SplitPayload ¶
SplitPayload splits one logical payload into MaxPayload-sized chunks so a large spool read or capture snapshot can be sequenced into valid frames.
Types ¶
type DecodedFrame ¶
func DecodeOutput ¶
func DecodeOutput(data []byte) (DecodedFrame, error)
DecodeOutput parses one Host-to-Client output envelope. The returned payload is a copy, so the input buffer can be reused.
type Frame ¶
Frame is one sequenced PTY output chunk. PayloadLength is derived from the payload; the wire codec keeps it explicit in the header.
type InputMetadata ¶
type InputMetadata struct {
Version string
SessionID string
AttachmentID string
PayloadLength int
Sequence uint64
}
func DecodeInput ¶
func DecodeInput(data []byte) (InputMetadata, []byte, error)
type Recovery ¶
type Recovery struct {
Plan Plan
Epoch uint64
Lower uint64
Upper uint64
Frames []Frame
Reanchor bool
}
Recovery is the bounded reply Host sends on attach.
type Ring ¶
type Ring struct {
Capacity int
MaxBytes int
Epoch uint64
// contains filtered or unexported fields
}
Ring is a bounded sequence interval retained by Host for reconnecting clients. Sequence values are byte positions since the epoch start, matching the spool byte stream and the Swift Host OutputRing semantics.
func (*Ring) Append ¶
Append records one frame, evicting the oldest frames to keep both the frame count and the retained byte total bounded.