protocol

package
v0.1.5-0...-b5400da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package protocol owns the bounded framing used by the isolated runner.

The package deliberately knows nothing about runner capabilities or guest payloads. It provides only the neutral operation byte, little-endian frame format, and allocation guard shared by the worker and its parent.

Index

Constants

View Source
const MaxFrame = 64 << 20 // 64 MiB; a WASM module fits, frames are far smaller

MaxFrame bounds a single protocol message before any payload allocation.

Variables

View Source
var ErrProtocol = errors.New("runner: protocol error")

ErrProtocol reports malformed, unknown, or oversized protocol data.

Functions

func Write

func Write(w io.Writer, op Op, payload []byte) error

Write writes one framed message: [op][u32 little-endian length][payload].

Types

type Op

type Op byte

Op identifies one message in the lock-step worker protocol.

const (
	OpStart        Op = 1 // parent -> worker: limits + appType + wasm
	OpResp         Op = 2 // parent -> worker: reply to the previous request
	OpRecv         Op = 3 // worker -> parent: next input event
	OpPresent      Op = 4 // worker -> parent: a rendered frame
	OpKVGet        Op = 5
	OpKVSet        Op = 6
	OpKVDel        Op = 7
	OpBusSub       Op = 8
	OpBusPub       Op = 9
	OpAuth         Op = 10
	OpEnv          Op = 11
	OpFetch        Op = 12
	OpDone         Op = 13 // worker -> parent: session finished (err + logs)
	OpOutput       Op = 14
	OpKVList       Op = 15
	OpKVCAS        Op = 16
	OpExec         Op = 17
	OpTimerStart   Op = 18
	OpTimerCancel  Op = 19
	OpOutputStderr Op = 20 // worker -> parent: stderr output
	OpInput        Op = 21 // worker -> parent: request stdin bytes
)

func Read

func Read(r io.Reader) (Op, []byte, error)

Read reads one frame, bounded by MaxFrame.

func ReadBounded

func ReadBounded(r io.Reader, maxFor func(Op) uint32) (Op, []byte, error)

ReadBounded rejects an operation-specific oversized message before allocating its payload. A nil maxFor applies only the global MaxFrame cap.

Directories

Path Synopsis
Package buildprotocol defines the bounded source-build request and result protocol shared by the root-owned HTTP API and the isolated legacy build worker.
Package buildprotocol defines the bounded source-build request and result protocol shared by the root-owned HTTP API and the isolated legacy build worker.
Package control defines the versioned HTTP contract carried over an authenticated plumtree-control-v1 SSH subsystem.
Package control defines the versioned HTTP contract carried over an authenticated plumtree-control-v1 SSH subsystem.
Package gatewayapi is the wire contract between a standalone SSH gateway and the root server: the request/response DTOs, route prefix, auth header, and error codes shared by the root-server HTTP handlers and the gateway's HTTP backend client.
Package gatewayapi is the wire contract between a standalone SSH gateway and the root server: the request/response DTOs, route prefix, auth header, and error codes shared by the root-server HTTP handlers and the gateway's HTTP backend client.
Package pairing defines the bounded, transcript-bound plumtree-pair-v1 protocol contract.
Package pairing defines the bounded, transcript-bound plumtree-pair-v1 protocol contract.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL