Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeAtomicState(sessionID string, epoch, sequence uint64, format string, payload []byte) ([]byte, error)
- 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 DecodedAtomicState
- 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 = protocol.DirectionClientToHost DirectionHostToClient = protocol.DirectionHostToClient KindInput = protocol.KindInput KindOutput = protocol.KindOutput // KindAtomicState carries one opaque terminal-emulator snapshot. It is a // distinct kind so clients can never feed snapshot bytes through their VT // output parser by mistake. KindAtomicState = protocol.KindAtomicState MaxHeader = protocol.MaxHeader MaxPayload = protocol.MaxPayload MaxAtomicStatePayload = protocol.MaxAtomicStatePayload )
Variables ¶
var ( BinaryMagic = protocol.BinaryMagic Version = protocol.BinaryWireVersion )
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.
The constants live in protocol/warren.schema.json and are generated into internal/protocol/wire.go. The aliases below preserve the existing output.* API for callers in this module.
Functions ¶
func EncodeAtomicState ¶ added in v0.10.0
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 checkpoint replay can be sequenced into valid frames.
Types ¶
type DecodedAtomicState ¶ added in v0.10.0
type DecodedAtomicState struct {
SessionID string
Epoch uint64
Sequence uint64
Format string
Payload []byte
}
func DecodeAtomicState ¶ added in v0.10.0
func DecodeAtomicState(data []byte) (DecodedAtomicState, error)
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 Ghostline output 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.