pongwire

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package pongwire is the friend pong's table wire, generated by the schema compiler from schemas/pong/pong.schema: the Pong, a friend's answer to a liveness challenge (friend, nonce, queue, working, width, sent_ms). Every other .go file here is generated: edit the .schema and run go generate ./pkg/pongwire, never the output. pkg/schemaread reads it strictly: binary wire, padded standard base64 of the wire, or JSON text, each refused by name when damaged.

Index

Constants

View Source
const (
	TableFixedReasonPreviousForm         = "previous_form"
	TableFixedReasonMessageFormAsFile    = "message_form_as_file"
	TableFixedReasonNewerForm            = "newer_form"
	TableFixedReasonLayoutMalformed      = "layout_malformed"
	TableFixedReasonLayoutUnknown        = "layout_unknown"
	TableFixedReasonLayoutNewer          = "layout_newer"
	TableFixedReasonLayoutUnsupported    = "layout_unsupported"
	TableFixedReasonLayoutRecordTooLarge = "layout_record_too_large"
	TableFixedReasonPlanTooLarge         = "plan_too_large"
	TableFixedReasonBatchTooLarge        = "batch_too_large"
	TableFixedReasonNoLayout             = "no_layout"
	TableFixedReasonTextIllFormed        = "text_ill_formed"
	TableFixedReasonTruncated            = "truncated"
	TableFixedReasonReservedNotZero      = "reserved_not_zero"
)

THE FIXED LOAD'S REFUSAL NAMES — EXPORTED (mas-bandwidth/schema docs/FIXED-FORM-ALGORITHM.md §5.3, mas-bandwidth/schema docs/SPEC-TABLES.md §3.4). Every refusal of the fixed load has a name, the framing-damage returns included, so an adopter's existing report.Reason == "layout_newer" comparisons keep compiling against these constants; the emitted <T>FixedLoad names every reason constant in place of a string literal.

TableFixedReasonLayoutUnknown is the Reason of a file whose header hash no entry of this build's lineage holds (mas-bandwidth/schema docs/SPEC-TABLES.md §21.3, algorithm §5.3 step 5). It says what the reader knows and not which way the file lies: a newer writer's layout, an older one nobody locked and a damaged hash byte read the same.

TableFixedReasonLayoutNewer ("ship the reader") is RESERVED (SPEC-TABLES §21.3) for a hash the lock lineage proves newer, which nothing on the wire or in the lock does today, so no Go fixed load answers it; it stays exported so an adopter's existing comparisons keep compiling.

View Source
const BuildVersion uint64 = 0xa54502168749e4bb

BuildVersion is the unit's build version (mas-bandwidth/schema docs/SPEC-TABLES.md §20): the one digest a block carries and BlockOpen compares, and the fact §3.3's announcement carries before the first body so a peer's build is knowable.

View Source
const PongLoadRetainBuilder = "Pong: retention requires a region round trip through the VARIABLE form"
View Source
const PongSaveRetainMessages = "Pong: retention requires a region round trip through the VARIABLE form"
View Source
const ProtocolId uint64 = 0xbd87f00808f8f8e8

The unit's protocol id — the hash of its wire shape (SPEC §3.1). Two sides at the same id speak identical bits; there is no other versioning.

View Source
const TableCookHeaderBytes int64 = 64

TableCookHeaderBytes is §7.1's header: 64 bytes of u64 words. The DATA part begins at align_up(64, alignment) — DERIVED and not a header field, because a fact a reader computes is a fact two writers cannot disagree about.

View Source
const TableCookMagic uint64 = 0x4b4f4f434d484353

TableCookMagic is the cook's magic (mas-bandwidth/schema docs/SPEC-TABLES.md §7.1), read before anything else: it is what establishes the byte order every other header word is written in, and it is also what separates a COOK from a BLOCK — the two accelerators carry the same build version and different magics, because a form's identity belongs in its magic rather than in a second digest.

The value is "SCHMCOOK" read as ASCII in the byte order a little-endian store produces, so a hex dump of a little-endian cook is legible.

View Source
const TableCookMaxAlign int64 = 64

TableCookMaxAlign is the ceiling on the header's alignment word: the same sixty-four a block's base takes (§19.1), past which the derived data offset would no longer be the 64 every unit this language can declare produces.

View Source
const TableDocNone = ""

THE SHARED EMPTY DOC (mas-bandwidth/schema docs/SPEC-TABLES.md §8.1): a declaration with no /// block carries a doc column naming this one definition, so absence costs a unit no string data and a printer concatenates doc columns with no nil test. Go gives a string no address identity, so what the rule is READ OFF here is the emitted text: the generated file defines the empty doc once and every unannotated row names that definition, rather than each row carrying an inline "" of its own.

View Source
const TableFixedForm uint8 = 3
View Source
const TableFixedHashAt = 8
View Source
const TableFixedHeaderBytes = 16
View Source
const TableMessageBatchMax = 256
View Source
const TableMessageEntriesHere = 11
View Source
const TableMessageRefBitsHere = 4

Variables

View Source
var ErrValidation = errors.New("pongwire: wire validation failed")

ErrValidation is returned when a read rejects the wire: a wrong constant, nonzero reserved bits, or an interior null in a string (SPEC §4.3, §4.7).

View Source
var PongTableFields = []TableFieldInfo{
	{Name: "friend_name", Json: "friend_name", TypeName: "string", DeclaredTypeName: "string", Id: 0x2bcee2fac7bb6eb5, Kind: 12, IsArray: false, Counted: true, Optional: false,
		ArrayBound: 64, Offset: uint32(unsafe.Offsetof(Pong{}.FriendName)), ElemSize: uint32(unsafe.Sizeof(Pong{}.FriendName)), CountOffset: uint32(unsafe.Offsetof(Pong{}.FriendNameLength)), PresentOffset: 0xffffffff,
		CookOffset: 0, CookElemSize: 1, CookCountOffset: 68, CookPresentOffset: 4294967295,
		HasRange: false, RangeMin: 0.0, RangeMax: 0.0, EnumMax: -1,
		FracBits: 0, Pointer: false, TargetId: 0x0000000000000000,
		EnumName:    nil,
		VariantId:   nil,
		KeyTypeName: "", KeyName: nil, KeyId: nil,
		Arms:  nil,
		Guard: "", Table: nil,
		Doc: TableDocNone, NumTags: 0, Tags: nil},
	{Name: "nonce", Json: "nonce", TypeName: "string", DeclaredTypeName: "string", Id: 0x73a94c71d60dc0d8, Kind: 12, IsArray: false, Counted: true, Optional: false,
		ArrayBound: 32, Offset: uint32(unsafe.Offsetof(Pong{}.Nonce)), ElemSize: uint32(unsafe.Sizeof(Pong{}.Nonce)), CountOffset: uint32(unsafe.Offsetof(Pong{}.NonceLength)), PresentOffset: 0xffffffff,
		CookOffset: 72, CookElemSize: 1, CookCountOffset: 108, CookPresentOffset: 4294967295,
		HasRange: false, RangeMin: 0.0, RangeMax: 0.0, EnumMax: -1,
		FracBits: 0, Pointer: false, TargetId: 0x0000000000000000,
		EnumName:    nil,
		VariantId:   nil,
		KeyTypeName: "", KeyName: nil, KeyId: nil,
		Arms:  nil,
		Guard: "", Table: nil,
		Doc: TableDocNone, NumTags: 0, Tags: nil},
	{Name: "queue", Json: "queue", TypeName: "uint32", DeclaredTypeName: "uint32", Id: 0xb11e8b146c5a21d8, Kind: 8, IsArray: false, Counted: false, Optional: true,
		ArrayBound: 0, Offset: uint32(unsafe.Offsetof(Pong{}.Queue)), ElemSize: uint32(unsafe.Sizeof(Pong{}.Queue)), CountOffset: 0xffffffff, PresentOffset: uint32(unsafe.Offsetof(Pong{}.QueuePresent)),
		CookOffset: 112, CookElemSize: 4, CookCountOffset: 4294967295, CookPresentOffset: 116,
		HasRange: true, RangeMin: 0.0, RangeMax: 100000.0, EnumMax: -1,
		FracBits: 0, Pointer: false, TargetId: 0x0000000000000000,
		EnumName:    nil,
		VariantId:   nil,
		KeyTypeName: "", KeyName: nil, KeyId: nil,
		Arms:  nil,
		Guard: "", Table: nil,
		Doc: TableDocNone, NumTags: 0, Tags: nil},
	{Name: "working", Json: "working", TypeName: "uint32", DeclaredTypeName: "uint32", Id: 0x8879e024cb91288, Kind: 8, IsArray: false, Counted: false, Optional: true,
		ArrayBound: 0, Offset: uint32(unsafe.Offsetof(Pong{}.Working)), ElemSize: uint32(unsafe.Sizeof(Pong{}.Working)), CountOffset: 0xffffffff, PresentOffset: uint32(unsafe.Offsetof(Pong{}.WorkingPresent)),
		CookOffset: 120, CookElemSize: 4, CookCountOffset: 4294967295, CookPresentOffset: 124,
		HasRange: true, RangeMin: 0.0, RangeMax: 10000.0, EnumMax: -1,
		FracBits: 0, Pointer: false, TargetId: 0x0000000000000000,
		EnumName:    nil,
		VariantId:   nil,
		KeyTypeName: "", KeyName: nil, KeyId: nil,
		Arms:  nil,
		Guard: "", Table: nil,
		Doc: TableDocNone, NumTags: 0, Tags: nil},
	{Name: "width", Json: "width", TypeName: "uint32", DeclaredTypeName: "uint32", Id: 0xdbdacd932fd1e9bf, Kind: 8, IsArray: false, Counted: false, Optional: true,
		ArrayBound: 0, Offset: uint32(unsafe.Offsetof(Pong{}.Width)), ElemSize: uint32(unsafe.Sizeof(Pong{}.Width)), CountOffset: 0xffffffff, PresentOffset: uint32(unsafe.Offsetof(Pong{}.WidthPresent)),
		CookOffset: 128, CookElemSize: 4, CookCountOffset: 4294967295, CookPresentOffset: 132,
		HasRange: true, RangeMin: 0.0, RangeMax: 1024.0, EnumMax: -1,
		FracBits: 0, Pointer: false, TargetId: 0x0000000000000000,
		EnumName:    nil,
		VariantId:   nil,
		KeyTypeName: "", KeyName: nil, KeyId: nil,
		Arms:  nil,
		Guard: "", Table: nil,
		Doc: TableDocNone, NumTags: 0, Tags: nil},
	{Name: "sent_ms", Json: "sent_ms", TypeName: "int64", DeclaredTypeName: "int64", Id: 0x4a47f5b32c1c056c, Kind: 5, IsArray: false, Counted: false, Optional: true,
		ArrayBound: 0, Offset: uint32(unsafe.Offsetof(Pong{}.SentMs)), ElemSize: uint32(unsafe.Sizeof(Pong{}.SentMs)), CountOffset: 0xffffffff, PresentOffset: uint32(unsafe.Offsetof(Pong{}.SentMsPresent)),
		CookOffset: 136, CookElemSize: 8, CookCountOffset: 4294967295, CookPresentOffset: 144,
		HasRange: false, RangeMin: 0.0, RangeMax: 0.0, EnumMax: -1,
		FracBits: 0, Pointer: false, TargetId: 0x0000000000000000,
		EnumName:    nil,
		VariantId:   nil,
		KeyTypeName: "", KeyName: nil, KeyId: nil,
		Arms:  nil,
		Guard: "", Table: nil,
		Doc: TableDocNone, NumTags: 0, Tags: nil},
}

PongTableFields is Pong's per-field reflection data (mas-bandwidth/schema docs/SPEC-TABLES.md §8).

View Source
var TableCookByteOrder = tableCookNativeOrder()

TableCookByteOrder is THIS BUILD's byte order, as §7.1's order word records it. The byte order is settled AT COOK TIME for the target build, so a matching build version already means a matching order and Open never fixes anything up; a cook whose recorded order is not this build's is simply not this build's file.

Functions

func Announce

func Announce(buffer []byte) int64

func AnnounceMeasure

func AnnounceMeasure() int64

func AnnounceRead

func AnnounceRead(v *TableVocabulary, data []byte, report *TableReport) bool

func PongCookFrom

func PongCookFrom(value *Pong, buffer []byte, order TableByteOrder, context ...TableWriteContext) bool

func PongCookMeasure

func PongCookMeasure(value *Pong, context ...TableWriteContext) int64

func PongCookMeasureReason

func PongCookMeasureReason(value *Pong, context ...TableWriteContext) (int64, error)

func PongFromJson

func PongFromJson(builder *PongBuilder, text []byte, report *TableReport) bool

func PongLoadBody

func PongLoadBody(r *TableReader, value *Pong) bool

func PongLoadBodyRetain

func PongLoadBodyRetain(r *TableRetainReader, value *Pong) bool

func PongLoadBuilder

func PongLoadBuilder(b *PongBuilder, wire []byte, report *TableReport) bool

func PongLoadMeasure

func PongLoadMeasure(wire []byte) int64

func PongLoadMeasureReason

func PongLoadMeasureReason(wire []byte) (int64, error)

func PongLoadMessageBody

func PongLoadMessageBody(r *TableMessageReader, value *Pong) bool

func PongLoadMessageBodyRetain

func PongLoadMessageBodyRetain(r *TableRetainMessageReader, value *Pong) bool

func PongMeasure

func PongMeasure(value *Pong, context ...TableWriteContext) int64

func PongMeasureBody

func PongMeasureBody(value *Pong, ids *TableIds) int64

func PongMeasureBodyRetain

func PongMeasureBodyRetain(value *Pong, ids *TableRetainIds) int64

func PongMeasureReason

func PongMeasureReason(value *Pong, context ...TableWriteContext) (int64, error)

func PongMeasureRetain

func PongMeasureRetain(value *Pong, retain *TableRetain, allocator ...TableAllocator) int64

func PongOpen

func PongOpen(cook *PongCook, base unsafe.Pointer, length int64) bool

PongOpen is the bool convenience for the typed Open error on the handle.

func PongReset

func PongReset(value *Pong)

PongReset restores Pong's declared defaults in place, reusing the storage the value already holds. The reader calls it before overlaying.

func PongSave

func PongSave(value *Pong, buffer []byte, context ...TableWriteContext) int64

func PongSaveBody

func PongSaveBody(w *TableWriter, value *Pong) bool

func PongSaveBodyFields

func PongSaveBodyFields(w *TableWriter, value *Pong) bool

func PongSaveBodyFieldsRetain

func PongSaveBodyFieldsRetain(w *TableRetainWriter, value *Pong) bool

func PongSaveBodyRetain

func PongSaveBodyRetain(w *TableRetainWriter, value *Pong) bool

func PongSaveMessageBody

func PongSaveMessageBody(w *TableMessageWriter, value *Pong) bool

func PongSaveRetain

func PongSaveRetain(value *Pong, retain *TableRetain, buffer []byte, report *TableReport, allocator ...TableAllocator) int64

func PongSaveText

func PongSaveText(value *Pong, context ...TableWriteContext) (string, error)

PongSaveText returns the base64 of Pong's binary wire (mas-bandwidth/schema docs/SPEC-TABLES.md §16.8): the whole file, form byte first, so the text keeps the form byte, the framing check and every versioning guarantee and is opaque. It takes the write context PongSave takes.

func PongToJson

func PongToJson(value *Pong, buffer []byte, allocator ...TableAllocator) int64

func PongToJsonMeasure

func PongToJsonMeasure(value *Pong, allocator ...TableAllocator) int64

func TableBytesEmplace

func TableBytesEmplace(worker *TableWorker, slot *TableRef, length int64) []byte

func TableStringEmplace

func TableStringEmplace(worker *TableWorker, slot *TableRef, text []byte) []byte

Types

type Pong

type Pong = PongRow

func PongLoad

func PongLoad(region, wire []byte, report *TableReport) *Pong

func PongLoadRetain

func PongLoadRetain(region, wire []byte, retain *TableRetain, report *TableReport) *Pong

func PongLoadText

func PongLoadText(text string, report *TableReport) (*Pong, error)

PongLoadText reads one Pong from a base64 wire text (mas-bandwidth/schema docs/SPEC-TABLES.md §16.8) into a builder of its own and returns the locked root, as PongReadStrict does: it is the STRICT read (§6.5) and refuses whenever the read's report holds an error (TableReport.Err), whatever the tolerant LoadBuilder answered, so a recovered value never comes back. It refuses by name: base64_damaged when the body does not decode, unknown_form when the decoded wire's form byte is not one this build carries, wire_damaged for framing damage, and the report's own reason (malformed, clamped, kind_mismatch, ...) otherwise. A nil report is allowed; a supplied one receives THIS read's report, so earlier counts in it never decide.

func PongReadStrict

func PongReadStrict(wire []byte) (*Pong, error)

PongReadStrict is the STRICT read (mas-bandwidth/schema docs/SPEC-TABLES.md §6.5): one call, its own builder, one typed reason.

type PongBuilder

type PongBuilder struct {
	Arena TableArena
	Main  TableWorker
	// contains filtered or unexported fields
}

func (*PongBuilder) AsConst

func (b *PongBuilder) AsConst() *Pong

func (*PongBuilder) GetRoot

func (b *PongBuilder) GetRoot() *Pong

func (*PongBuilder) Init

func (b *PongBuilder) Init(allocator ...TableAllocator) bool

func (*PongBuilder) Lock

func (b *PongBuilder) Lock() bool

func (*PongBuilder) PackMeasure

func (b *PongBuilder) PackMeasure() int64

func (*PongBuilder) PackMeasureReason

func (b *PongBuilder) PackMeasureReason() (int64, error)

func (*PongBuilder) Region

func (b *PongBuilder) Region() []byte

func (*PongBuilder) Shutdown

func (b *PongBuilder) Shutdown()

type PongCook

type PongCook struct {
	Region       unsafe.Pointer // the DATA part's base: the root sits at offset zero
	RegionLength int64          // data_length, as the header framed it
}

PongCook is Pong's cook: a pointer and a length, and then the root where it lies. Opening one is a HEADER MATCH and no copy; a reference is one add (mas-bandwidth/schema docs/SPEC-TABLES.md §7).

`Cook` is a CLAIMED suffix (§11). C++ spells the same claimed verbs as free functions — PongOpen, PongAt — and so does Go, because Go has free functions; what is a MEMBER here is only what §11 leaves a language free to make one.

THE MEMORY IS THE CONSUMER'S. Nothing here allocates, nothing here copies and nothing here pins: the region must stay put and stay aligned for as long as this handle or anything reached through it is used.

func (*PongCook) Open

func (cook *PongCook) Open(base unsafe.Pointer, length int64) error

Open checks the header in SPEC §7 order, bytewise until base alignment is established. A successful match points at the region and allocates nothing.

func (PongCook) RegionAlignment

func (c PongCook) RegionAlignment() int64

§7.1's constants, so a consumer reading this file has the facts and not a description of them. They are METHODS because §11 leaves a language whose accessors are members free to spell them that way, and a package constant per table per fact would claim names §11 does not.

func (PongCook) Root

func (c PongCook) Root() *PongRow

Root is the root record at the region's base. It is a POINTER and not a copy: a cooked graph is walked by adding deltas to slot addresses.

func (PongCook) RootAlign

func (c PongCook) RootAlign() int64

func (PongCook) RootSize

func (c PongCook) RootSize() int64

func (PongCook) Type

func (c PongCook) Type() *TableCookInfo

Type is Pong's cooked-record descriptor, the head of the graph a reflective walk follows (mas-bandwidth/schema docs/SPEC-TABLES.md §8).

type PongRow

type PongRow struct {
	FriendName [65]byte // string(64): buffer, used length beside it

	FriendNameLength int32
	Nonce            [33]byte // string(32): buffer, used length beside it

	NonceLength  int32
	Queue        uint32
	QueuePresent bool // ?: one byte, in Go's model as in C++

	Working        uint32
	WorkingPresent bool // ?: one byte, in Go's model as in C++

	Width        uint32
	WidthPresent bool // ?: one byte, in Go's model as in C++

	SentMs        int64
	SentMsPresent bool // ?: one byte, in Go's model as in C++
	// contains filtered or unexported fields
}

PongRow — a cooked record. `Row` is a CLAIMED suffix (mas-bandwidth/schema docs/SPEC-TABLES.md §11), so no declaration in the unit can take it.

func PongAt

func PongAt(slot *int64, arena ...*TableArena) *PongRow

PongAt dereferences a reference, and it is the same call in a locked region and an opened cook because they are the same encoding (§6.3): the slot is eight bytes, SIGNED, self-relative from the SLOT'S OWN ADDRESS, so a deref needs no base pointer and no bounds test, and NULL IS A DELTA OF ZERO. Nothing about this call is the cook's: it is what a region reference is, and a cook is a region written verbatim.

It takes the SLOT and not its value, because a self-relative delta means nothing without the address it is relative to.

type TableAllocator

type TableAllocator struct {
	Alloc func(int64) []byte
	Free  func([]byte)
}

TableAllocator owns authoring and temporary writer storage. Both callbacks are required together; an empty pair uses Go-owned storage. Alloc supplies zeroed bytes aligned to tableRegionAlign and may return more than requested. Free always receives the original slice, with its original length and base. Load and LoadMeasure use caller buffers and never call this pair.

type TableArena

type TableArena struct {
	Allocator TableAllocator
	Locked    bool
	// contains filtered or unexported fields
}

func (*TableArena) At

func (a *TableArena) At(ref TableRef) unsafe.Pointer

func (*TableArena) Init

func (a *TableArena) Init(allocator ...TableAllocator) bool

func (*TableArena) Shutdown

func (a *TableArena) Shutdown()

type TableBitReader

type TableBitReader struct {
	Buffer []byte
	Offset int64
}

func (*TableBitReader) Align

func (r *TableBitReader) Align() bool

func (*TableBitReader) Get

func (r *TableBitReader) Get(n int64) (uint64, bool)

func (*TableBitReader) Skip

func (r *TableBitReader) Skip(n int64) bool

type TableBitWriter

type TableBitWriter struct {
	Buffer              []byte
	Bits                int64
	Measuring, Overflow bool
}

TableBitWriter uses the packet wire's low-bit-first order. Measuring walks the identical stream, including alignment, without touching a buffer.

func (*TableBitWriter) Align

func (w *TableBitWriter) Align()

func (*TableBitWriter) Put

func (w *TableBitWriter) Put(value uint64, n int64)

func (*TableBitWriter) Raw

func (w *TableBitWriter) Raw(data []byte)

type TableBlob

type TableBlob struct {
	Length uint32
	Zero   uint32
}

Blob ABI follows the established tool and C++ byte contract: u32 length, u32 zero. SPEC-TABLES §7.2 currently labels this u64; the big-endian fixtures distinguish them.

func TableBlobAt

func TableBlobAt(slot *TableRef, arena ...*TableArena) *TableBlob

type TableBuildVersionMismatch

type TableBuildVersionMismatch struct{ Peer, Own uint64 }

TableBuildVersionMismatch is the typed error a strict announcement refusal reports (mas-bandwidth/schema docs/SPEC-TABLES.md §3.3): the peer's build version and the reader's own, each a 64-bit number.

func (TableBuildVersionMismatch) Error

type TableByteOrder

type TableByteOrder uint8

TableByteOrder selects the target order, independently of the writing host.

const (
	TableByteOrderLittle TableByteOrder = 1
	TableByteOrderBig    TableByteOrder = 2
)

type TableBytesView

type TableBytesView struct {
	Data   []byte
	Length int64
}

TableBytesView borrows its backing region or arena. Keep that storage alive and do not free, reuse, or shut it down while using the view.

func TableBytesAt

func TableBytesAt(slot *TableRef, arena ...*TableArena) TableBytesView

type TableCookFieldInfo

type TableCookFieldInfo struct {
	Name          string
	Offset        int32 // the field's offset in the record this descriptor describes
	Size          int32 // its whole storage there, companions included
	ElemSize      int32 // one element's size, for an array; the field's own otherwise
	IsArray       bool
	ArrayBound    int32 // the DECLARED bound: a counted array's N, a string's or bytes' length
	IsPointer     bool  // an eight-byte SIGNED SELF-RELATIVE delta slot (§6.3)
	CountOffset   int32 // the count companion's offset, or -1 when the field has none
	PresentOffset int32 // an optional's presence bool, or -1
	Storage       TableCookStorage
	// Record is the record this field NAMES, behind a function so the table
	// stays constructible in any order — Go refuses an initialisation cycle
	// among package-level variables, and the DESCRIPTOR graph is cyclic by
	// design: a record's field column can name its own record. A cooked REGION
	// is never cyclic; schema cook refuses one by name (§3.1).
	// nil when the field is a scalar. Following it is how a walker DESCENDS: a
	// pointer's target, a by-value nesting, and an array's element are all
	// reached through this one column.
	Record func() *TableCookInfo
}

TableCookFieldInfo is one record's field as DATA — the mechanism behind a reflective read of a cooked region, and what a gate walks a whole graph with. A field carries the facts a region actually has: where it sits, how big it is, whether it is a POINTER EDGE, the bound its COUNT COMPANION is checked against, and the record it names.

type TableCookInfo

type TableCookInfo struct {
	Name      string
	Size      int32
	Align     int32
	NumFields int32
	Fields    []TableCookFieldInfo
}

TableCookInfo is one cooked record's layout as DATA.

type TableCookStorage

type TableCookStorage uint8

TableCookStorage is what a cooked SLOT holds, which is not always what the WIRE carries: an ENUM slot holds the ORDINAL at the enum's own derived storage width (mas-bandwidth/schema docs/SPEC-TABLES.md §7.2), where the wire rides the variant-name hash. A walker reads a slot with the width ElemSize gives and the signedness this names.

Its members are FLAT package-level constants, which is what Go already does with every enum a schema declares (SPEC.md §6.1's Go column) — so all eight spellings are claimed in mas-bandwidth/schema internal/tablenames, exactly as a declared enum's variants are claimed by the checker. C# spells the same vocabulary as one scoped enum and claims one name; the port does not get to have it both ways, and the flat form is the one a Go consumer expects to write.

const (
	TableCookStorageRecord    TableCookStorage = iota // a nested record, or an array of them: descend through it
	TableCookStorageReference                         // an eight-byte SIGNED SELF-RELATIVE delta slot (§6.3)
	TableCookStorageBool
	TableCookStorageSigned
	TableCookStorageUnsigned // an unsigned integer, an enum ordinal, a bits(N), a flags mask
	TableCookStorageFloat
	TableCookStorageString // char[N + 1] with an int32 used length beside it
	TableCookStorageBytes  // uint8[N] with an int32 used length beside it
)

type TableFieldInfo

type TableFieldInfo struct {
	CookOffset, CookElemSize, CookCountOffset, CookPresentOffset uint32
	List, Map                                                    bool // unbounded by-value containers
	ElemAlign                                                    uint32
	Name                                                         string // schema field name, e.g. "health"
	Json                                                         string // the TEXT form's key: the json = "key" attribute, else Name (§16.3)
	TypeName                                                     string // schema element type, e.g. "float32", "Grade"
	DeclaredTypeName                                             string // complete schema spelling including arrays, bounds and pointers
	Id                                                           uint64 // table-wire field id (name hash; the was alias's hash after a rename)
	Pointer                                                      bool
	TargetId                                                     uint64
	Kind                                                         uint8 // table-wire kind; for arrays/strings/bytes, the ELEMENT kind
	IsArray                                                      bool  // fixed or counted array (bytes included)
	Counted                                                      bool  // a <Name>Count/<Name>Length int32 companion exists
	Optional                                                     bool  // a ?T field: a <Name>Present bool decides whether it rides

	ArrayBound    int32  // array capacity / string max length; 0 for plain scalars
	Offset        uint32 // unsafe.Offsetof the storage member
	ElemSize      uint32 // unsafe.Sizeof the member (element size for arrays)
	CountOffset   uint32 // unsafe.Offsetof the count/length companion, or 0xffffffff
	PresentOffset uint32 // unsafe.Offsetof the Present companion, or 0xffffffff

	FracBits         uint8 // fixed-point binary scale
	WideRange        bool
	WideMin, WideMax [2]uint64 // exact two-complement raw bounds, low lane first
	HasRange         bool      // a declared [min, max] (int or float)
	RangeMin         float64   // NOTE: int64 ranges beyond 2^53 lose precision here
	RangeMax         float64

	// EnumMax bounds the vocabulary: enums, the highest valid value (None = 0
	// is always valid); unions, the arm count (tag range [0, EnumMax]); a
	// FLAGS field, the highest declared BIT INDEX; else -1.
	EnumMax int64
	// EnumName is the vocabulary's names, indexed the way EnumMax bounds: an
	// enum's value -> name, a union's tag -> arm name, a FLAGS field's bit
	// index -> variant name. nil for every other kind.
	EnumName func(value uint64) string
	// VariantId is the TABLE-WIRE id of one variant (mas-bandwidth/schema docs/SPEC-TABLES.md §5): for
	// an enum, the hash of the variant's name; for a union, the hash of the
	// arm's name. Hash zero is an ordinary id; ordinal zero is None. nil
	// for every other kind — a FLAGS field's variants have no per-variant wire
	// id (§4), so a nil here beside a non-nil EnumName is what says "flags".
	VariantId func(value uint64) uint64

	// an ENUM-KEYED array (mas-bandwidth/schema docs/SPEC-TABLES.md §2.4, §8): the array has one slot
	// per variant of KeyTypeName, indexed by the variant's value, and its
	// slots ride under variant ids rather than positions. KeyName and KeyId
	// are the key's vocabulary — walk [0, ArrayBound) to print slots by name.
	// All three are nil/"" on every other field.
	KeyTypeName string
	KeyName     func(value uint64) string
	KeyId       func(value uint64) uint64

	// Arms is a union field's shape: the tag and the arms indexed by it, behind
	// a function so a descriptor graph needs no initialization order. nil for
	// every other kind.
	Arms func() *TableUnionInfo

	Guard string // branch guard, e.g. "at_rest" or "!at_rest"; "" if unguarded

	// Table is the nested table's descriptor, or nil. Held as a factory rather
	// than a value so a descriptor graph needs no initialization order: Go
	// refuses an initialization cycle across package-level variables, and a
	// table may name one declared later.
	Table func() *TableTypeInfo

	// what a PERSON wrote about the field (mas-bandwidth/schema docs/SPEC-TABLES.md §8.1): the ///
	// block above it, verbatim (SPEC §4.1). It is TableDocNone when there is
	// none, never nil. Its tags (SPEC §4.2) follow in declared order, and an
	// untagged field is 0 beside a nil list. Static package data, allocating
	// nothing.
	Doc     string
	NumTags int32
	Tags    []string
}

TableFieldInfo is one field's descriptor.

type TableFixedDst

type TableFixedDst struct {
	Dst, Stride, Aux   uint32
	Counted, Arg, Meta uint8
}

type TableFixedEntry

type TableFixedEntry struct {
	Src, Dst, Size, Aux, Guard uint32
	// Arg IS THE GUARD'S ORDINAL AT FULL WIDTH (mas-bandwidth/schema docs/FIXED-FORM-ALGORITHM.md
	// §4.1: arg : u64, "no byte lane anywhere"): a union past 255 arms or an
	// enum past 65535 variants holds its ordinal whole in this lane, and the
	// compare is made against the 64-bit tag load, never a truncation of it.
	Arg uint64
	// Guard2 / Arg2 / ArgW2 ARE THE OUTER TAG AN ARM INSIDE AN ARM ALSO ANSWERS
	// TO (mas-bandwidth/schema docs/FIXED-FORM-ALGORITHM.md §4.1): the entry runs only when BOTH tags
	// hold their ordinal. ArgW2 of zero is "no outer tag", so a plan that never
	// nests a union leaves the lane unset and the read is unchanged.
	Guard2 uint32
	Arg2   uint64
	// GuardIndex / GuardCount ARE THE GUARD CHAIN (mas-bandwidth/schema docs/FIXED-FORM-ALGORITHM.md
	// §4.1): offset+count into a pool of (guard, arg, argw) links, OUTERMOST
	// FIRST. GuardIndex is a BYTE OFFSET from the plan's own base, where the pool
	// is laid behind the entries the way the ordinal remap tables are, so the
	// plan stays one slice and the read loop one signature. Every guarded entry
	// carries its whole chain; the two lanes above stay its innermost two, the
	// special case, so the loop walks the pool only for a chain past two. The
	// only bound on a chain is the layout's 64 (tableFixedMaxDepth).
	GuardIndex, GuardCount               uint32
	Op, ArgW, DstSize, Sign, Meta, ArgW2 uint8
}

Arg is the guard's arm ordinal: tableFixedRun compares src[Guard] against it. Meta is a text entry's flavour (tableFixedTextUtf8/Wide/Bytes). They shared one lane until reference-fix 12; compiling a string under a union arm overwrote the guard with the flavour and the read skipped the string. tableFixedEntryBytes is the FILE layout entry (id+kind+size+children), not this in-memory plan row — Meta does not ride the wire. ArgW IS THE GUARD'S WIDTH IN BYTES (§5.2 THE GUARD'S WIDTH): a union tag is one, two, four or eight bytes, clamped 1..8, and 0 reads as 1. The guard is tested at that FULL width and never at its first byte — a foreign two-byte tag 0x0101 is not arm 1. Arg is the arm ordinal and carries NO BYTE LANE (§5.8 row 5): a 256-arm union's ordinal does not fit a byte.

type TableFixedGuardLink struct {
	Guard uint32
	Arg   uint64
	ArgW  uint8
}

TableFixedGuardLink is ONE LINK of a guard chain (mas-bandwidth/schema docs/FIXED-FORM-ALGORITHM.md §4.1): the offset of the tag it reads, the ordinal the tag must hold, and the width it is compared at. A chain is a CONJUNCTION — every link must hold.

type TableFixedKnownLayout

type TableFixedKnownLayout struct {
	Hash        uint64
	Layout      []byte
	LayoutBytes int
	Record      int64
}

TableFixedKnownLayout is one locked layout: the wire hash a file is matched on, the layout bytes verbatim with its byte length BESIDE the pointer, and the RECORD SIZE taken from the lock and never from the file. The members are §5.9 #19's: hash, layout, layout_bytes, record_bytes, in that order.

type TableIds

type TableIds struct {
	Numbering *TableNumbering
	Values    [tableIdCapacity]uint64

	Count    int
	Overflow bool
	// contains filtered or unexported fields
}

TableIds interns the writer's ids in first-use order. Bucket links are one-based so its zero value is ready to use, including for hash zero.

func (*TableIds) Ref

func (ids *TableIds) Ref(id uint64) uint64

func (*TableIds) RefAt

func (ids *TableIds) RefAt(ordinal int, id uint64) uint64

RefAt is Ref for a compile-time-constant id. The ordinal is that id's index in TableWireIds. A hit is one load and one compare; first-use order is still append order. Truncate clears the ordinal in O(popped) so a speculative intern does not leak into the next walk. An ordinal outside the slot range falls back to Ref; it does not index slot.

func (*TableIds) Truncate

func (ids *TableIds) Truncate(mark int)

Truncate removes speculative ids when a measured field elides, or before writing the payload whose size was just measured under the same vocabulary.

type TableMessageEntry

type TableMessageEntry struct {
	Id             uint64
	Shape, Element TableMessageShape
}

type TableMessageReader

type TableMessageReader struct {
	Nodes      TableNodeMap
	Bits       TableBitReader
	Vocabulary *TableVocabulary
	Report     TableReport
	IndexBits  int64
}

type TableMessageShape

type TableMessageShape struct {
	Kind, Packing uint8
	Bits          int64
	Base          [2]uint64
	Min, Max      int64
	QMin, QDelta  float32
	QCount        uint32
}

type TableMessageWriter

type TableMessageWriter struct {
	TableBitWriter
	IndexBits int64
	Clamped   int32
	Numbering *TableNumbering
	// contains filtered or unexported fields
}

type TableMissingRequired

type TableMissingRequired struct{ Fields string }

TableMissingRequired is the typed error a strict read reports for a record that lacks a | required field (mas-bandwidth/schema docs/SPEC-TABLES.md §2.3): Fields names the missing fields, comma-separated in declaration order, at whatever depth of the record they were missing, and Error() is the report's own reason.

func (TableMissingRequired) Error

func (m TableMissingRequired) Error() string

type TableNodeDirEntry

type TableNodeDirEntry struct{ Offset, TypeId uint64 }

type TableNodeMap

type TableNodeMap struct {
	Base    unsafe.Pointer
	Entries []TableNodeDirEntry
	Good    bool
	Arena   bool
}

func (TableNodeMap) Resolve

func (m TableNodeMap) Resolve(slot *TableRef, index, target uint64, r *TableReport)

type TableNumbering

type TableNumbering struct {
	// contains filtered or unexported fields
}

The root and arena keep the source storage live while pointer-free backing allocations hold the index and entries. Temporary storage is released by caller.

func (*TableNumbering) Index

func (n *TableNumbering) Index(slot *TableRef) (uint64, bool)

func (*TableNumbering) Release

func (n *TableNumbering) Release()

type TableOpenVerdict

type TableOpenVerdict uint8

TableOpenVerdict distinguishes an unsupported form from framing damage.

const (
	TableOpenOk TableOpenVerdict = iota
	TableOpenRefused
	TableOpenDamaged
	TableOpenBodyStopped
)

type TableReader

type TableReader struct {
	Nodes  TableNodeMap
	Buffer []byte
	Offset int64
	Report *TableReport
	Ids    []byte
	Nested bool
}

TableReader holds one bounded body and a view of the file's id trailer. Sub-readers share the trailer and report, but cannot consume sibling bytes.

func (*TableReader) Body

func (r *TableReader) Body() (TableReader, bool)

func (TableReader) EndsEarly

func (r TableReader) EndsEarly() bool

EndsEarly only recognizes an otherwise walkable body's early terminator. Other damage is decoded normally, preserving the prefix already read.

func (*TableReader) Get8

func (r *TableReader) Get8() uint8

func (*TableReader) Get16

func (r *TableReader) Get16() uint16

func (*TableReader) Get32

func (r *TableReader) Get32() uint32

func (*TableReader) Get64

func (r *TableReader) Get64() uint64

func (*TableReader) Has

func (r *TableReader) Has(n int64) bool

func (*TableReader) Leb

func (r *TableReader) Leb() (uint64, bool)

A rejected integer leaves the cursor unchanged. Its spelling must be minimal and fit in 64 bits, including the tenth byte's single value bit.

func (*TableReader) Resolve

func (r *TableReader) Resolve(ref uint64) (uint64, bool)

func (*TableReader) Room

func (r *TableReader) Room(n uint64) bool

func (*TableReader) Signed

func (r *TableReader) Signed(kind uint8) int64

func (*TableReader) Skip

func (r *TableReader) Skip(kind uint8) bool

func (*TableReader) Sub

func (r *TableReader) Sub(n int64) TableReader

func (*TableReader) Unsigned

func (r *TableReader) Unsigned(kind uint8) uint64

type TableRef

type TableRef = int64

type TableRefuseReason

type TableRefuseReason uint8

TableRefuseReason is the typed error shared by file and accelerator failures. A successful call returns nil; a failure returns its first failing clause.

const (
	TableRefuseOk TableRefuseReason = iota
	TableRefuseNotACook
	TableRefuseForeignOrder
	TableRefuseWrongBuildVersion
	TableRefuseReservedNotZero
	TableRefuseBadAlignment
	TableRefuseTruncated
	TableRefuseUnalignedBase
	TableRefuseBadLayout
	TableRefuseUnknownForm
	TableRefuseCountOverLength
	TableRefuseCountOverExtentCap
	TableRefuseBlobOverSizeCap
	TableRefuseDataCycle
	TableRefuseInvalidValue
	TableRefuseAllocationFailed
	TableRefuseWireDamaged
	TableRefuseMalformed
	TableRefuseClamped
	TableRefuseKindMismatch
	TableRefuseBase64Damaged
)

func (TableRefuseReason) Error

func (r TableRefuseReason) Error() string

type TableReport

type TableReport struct {
	Retained, RetainLost int32
	Verdict              TableOpenVerdict // unsupported form is distinct from damage
	Reason               string           // why the form was refused; empty for a file read
	Widened              int32            // a compatible wider kind preserved the value
	Unknown              int32            // unknown field ids skipped (newer data)
	KindMismatch         int32            // known id, changed type — skipped, never misdecoded
	Clamped              int32            // out-of-range values clamped to declared bounds
	// Duplicate counts repeated text keys. Fixed-class wire fields do not raise it.
	// A body carrying an id twice is legal input
	// whose last occurrence wins, silently. A wire read always leaves it zero.
	Duplicate int32
	// MissingRequired counts required fields (mas-bandwidth/schema docs/SPEC-TABLES.md §2.3) the
	// record did not carry: a record an older writer produced before the field
	// became required. The refusal names the field in Reason.
	MissingRequired int32
	Malformed       bool // framing damage; decode stopped, partial result kept
	// BuildVersionPeer and BuildVersionOwn are the two build versions a strict
	// announcement refusal carries (mas-bandwidth/schema docs/SPEC-TABLES.md §3.3): the peer's
	// announcement and this unit's own. They are zero on every other read.
	BuildVersionPeer uint64
	BuildVersionOwn  uint64
	// LayoutHash is THE FILE'S hash, and it is set by ONE refusal:
	// layout_newer reports it "AND NOTHING ELSE" (§5.3). layout_unsupported
	// reports it too — the operator's other answer, a layout this build served
	// and has retired.
	LayoutHash uint64
}

TableReport is the table-wire read report — the permissive contract's ledger. Silence (all zero) means the data matched this reader's schema exactly. Err (mas-bandwidth/schema docs/SPEC-TABLES.md §6.5) is the STRICT read's typed reason for malformed, clamped, kind-mismatched, unknown form, wire-damaged and build-version-mismatched. Unknown, Widened and Retained alone are not one.

func (*TableReport) Err

func (r *TableReport) Err() error

Err is the report's typed error (mas-bandwidth/schema docs/SPEC-TABLES.md §6.5, mas-bandwidth/schema docs/VERSIONING.md The read report). A strict read refuses malformed, clamped, kind-mismatched, unknown form, wire-damaged, build-version-mismatched and missing-required (§2.3, naming the field), each as one typed reason. Unknown, Widened and Retained alone leave it nil, as does a clean read.

type TableRetain

type TableRetain struct {
	Bytes []byte
	Ids   []TableRetainId
	Used  int64
	Count int
	// contains filtered or unexported fields
}

type TableRetainId

type TableRetainId struct {
	Id   uint64
	Slot int
}

type TableRetainIds

type TableRetainIds struct {
	Numbering      *TableNumbering
	Retain         *TableRetain
	Path           tableRetainPath
	Count          int
	Overflow, Lost bool
	// contains filtered or unexported fields
}

func (*TableRetainIds) Ref

func (i *TableRetainIds) Ref(id uint64) uint64

func (*TableRetainIds) RefAt

func (i *TableRetainIds) RefAt(ordinal int, id uint64) uint64

func (*TableRetainIds) Truncate

func (i *TableRetainIds) Truncate(mark int)

type TableRetainMessageReader

type TableRetainMessageReader struct {
	Retain *TableRetain
	Path   tableRetainPath
	// contains filtered or unexported fields
}

type TableRetainReader

type TableRetainReader struct {
	Retain *TableRetain
	Path   tableRetainPath
	// contains filtered or unexported fields
}

func (*TableRetainReader) Body

type TableRetainWriter

type TableRetainWriter struct {
	Buffer    []byte
	Offset    int64
	Overflow  bool
	Measuring bool
	Ids       *TableRetainIds
}

func (*TableRetainWriter) Advance

func (w *TableRetainWriter) Advance(n int64) bool

func (*TableRetainWriter) Header

func (w *TableRetainWriter) Header(ref uint64, kind uint8)

Header writes a field's reference and kind. A reference below 128 is one LEB byte, so the pair is one two-byte store. Larger references still go through PutLeb then Put8. Bytes match that two-call spelling; a pair that does not fit now leaves the buffer alone, and Save answers -1.

func (*TableRetainWriter) Id

func (w *TableRetainWriter) Id(id uint64)

func (*TableRetainWriter) IdAt

func (w *TableRetainWriter) IdAt(ordinal int, id uint64)

func (*TableRetainWriter) Put8

func (w *TableRetainWriter) Put8(v uint8)

func (*TableRetainWriter) Put16

func (w *TableRetainWriter) Put16(v uint16)

func (*TableRetainWriter) Put32

func (w *TableRetainWriter) Put32(v uint32)

func (*TableRetainWriter) Put64

func (w *TableRetainWriter) Put64(v uint64)

func (*TableRetainWriter) Put128

func (w *TableRetainWriter) Put128(lo, hi uint64)

Put128 writes two little-endian lanes, low first, under one Advance.

func (*TableRetainWriter) PutLeb

func (w *TableRetainWriter) PutLeb(v uint64)

func (*TableRetainWriter) Raw

func (w *TableRetainWriter) Raw(data []byte)

func (*TableRetainWriter) Trailer

func (w *TableRetainWriter) Trailer()

type TableStringView

type TableStringView struct {
	Data   []byte
	Length int64
}

TableStringView has the same borrowed lifetime as TableBytesView.

func TableStringAt

func TableStringAt(slot *TableRef, arena ...*TableArena) TableStringView

type TableTimestampError

type TableTimestampError struct {
	Field string
	Time  time.Time
}

TableTimestampError is the refusal of a time.Time that no count names: its nanoseconds since the Unix epoch do not fit an int64, which is Time.UnixNano's own domain, the years 1678 through 2262 (mas-bandwidth/schema docs/SPEC-TABLES.md §2.11).

func (TableTimestampError) Error

func (e TableTimestampError) Error() string

type TableTypeInfo

type TableTypeInfo struct {
	SaveBodyRetain        func(*TableRetainWriter, unsafe.Pointer) bool
	LoadBodyRetain        func(TableRetainReader, unsafe.Pointer) bool
	LoadMessageBodyRetain func(TableRetainMessageReader, unsafe.Pointer) (TableRetainMessageReader, bool)
	CookSize, CookAlign   uint32
	Name                  string // schema type name
	Size                  uint32 // unsafe.Sizeof the storage struct
	Id                    uint64
	Variable              bool
	NodeType              func(uint64) *TableTypeInfo
	SaveBody              func(*TableWriter, unsafe.Pointer) bool
	LoadBody              func(TableReader, unsafe.Pointer) bool
	SaveMessageBody       func(*TableMessageWriter, unsafe.Pointer) bool
	LoadMessageBody       func(TableMessageReader, unsafe.Pointer) (TableMessageReader, bool)
	NumFields             int32
	Fields                []TableFieldInfo
	// Reset puts one instance back at its declared defaults, in place. A
	// generic walker that fills a value has to be able to establish the
	// defaults an absent field takes, and it holds no type to spell — this is
	// the one thing the descriptors could not express without it.
	Reset func(storage unsafe.Pointer)

	// the declaration's own doc and tags, on the same terms as a field's
	// (mas-bandwidth/schema docs/SPEC-TABLES.md §8.1, SPEC §4.1, §4.2)
	Doc     string
	NumTags int32
	Tags    []string
}

TableTypeInfo is one type's descriptor.

var PongTableInfo TableTypeInfo

PongTableInfo is Pong's reflection descriptor (mas-bandwidth/schema docs/SPEC-TABLES.md §8).

func PongTableType

func PongTableType() *TableTypeInfo

PongTableType returns Pong's reflection descriptor.

type TableUnionArmInfo

type TableUnionArmInfo struct {
	Field  TableFieldInfo               // arm shape; offsets are relative to union storage
	Void   bool                         // a selected payload-free arm
	Reset  func(storage unsafe.Pointer) // establish selected payload defaults
	Offset uint32                       // unsafe.Offsetof the arm's payload within the union storage
	Table  func() *TableTypeInfo        // the arm payload's descriptor
}

TableUnionArmInfo is one arm of a union field: where its payload sits inside the union's storage and what its payload looks like. The arm's NAME and its table-wire id come from the field's EnumName/VariantId functions at the same tag, so nothing is spelled twice (mas-bandwidth/schema docs/SPEC-TABLES.md §8).

type TableUnionInfo

type TableUnionInfo struct {
	CookTagSize uint32
	TagOffset   uint32 // unsafe.Offsetof the tag within the union storage
	TagSize     uint32 // unsafe.Sizeof the tag
	Arms        []TableUnionArmInfo
}

TableUnionInfo is a union field's shape: the tag, and the arms indexed by it. Arms run [0, EnumMax]; index 0 is the EMPTY arm and carries no payload.

type TableVocabulary

type TableVocabulary struct {
	Entries            []TableMessageEntry
	Count, RefBits     int64
	BuildVersion       uint64
	Announced, Refused bool
	MaxBytes           int64
	Strict             bool
}

Storage belongs to the caller and is resolved once for one connection direction.

func (*TableVocabulary) Entry

func (v *TableVocabulary) Entry(ref uint64) (TableMessageEntry, bool)

func (*TableVocabulary) Init

func (v *TableVocabulary) Init(storage []TableMessageEntry)

func (*TableVocabulary) Name

func (v *TableVocabulary) Name(ref uint64) (uint64, bool)

type TableWorker

type TableWorker struct {
	Arena *TableArena
	// contains filtered or unexported fields
}

func (*TableWorker) Alloc

func (w *TableWorker) Alloc(n int64) (unsafe.Pointer, TableRef)

func (*TableWorker) AllocBytes

func (w *TableWorker) AllocBytes(length int64) ([]byte, TableRef)

func (*TableWorker) AllocString

func (w *TableWorker) AllocString(length int64) ([]byte, TableRef)

type TableWriteContext

type TableWriteContext interface {
	// contains filtered or unexported methods
}

TableWriteContext selects allocation independently from reference addressing. Pass a TableAllocator for a loaded/locked region, or *TableArena for authoring references and that arena's allocation pair. Omit it for Go-owned temporaries.

type TableWriter

type TableWriter struct {
	Buffer    []byte
	Offset    int64
	Overflow  bool
	Measuring bool
	Ids       *TableIds
}

TableWriter writes into the caller's buffer, or counts exactly the same bytes in Measuring mode. Offset and every length are checked before use.

func (*TableWriter) Advance

func (w *TableWriter) Advance(n int64) bool

func (*TableWriter) Header

func (w *TableWriter) Header(ref uint64, kind uint8)

Header writes a field's reference and kind. A reference below 128 is one LEB byte, so the pair is one two-byte store. Larger references still go through PutLeb then Put8. Bytes match that two-call spelling; a pair that does not fit now leaves the buffer alone, and Save answers -1.

func (*TableWriter) Id

func (w *TableWriter) Id(id uint64)

func (*TableWriter) IdAt

func (w *TableWriter) IdAt(ordinal int, id uint64)

func (*TableWriter) Put8

func (w *TableWriter) Put8(v uint8)

func (*TableWriter) Put16

func (w *TableWriter) Put16(v uint16)

func (*TableWriter) Put32

func (w *TableWriter) Put32(v uint32)

func (*TableWriter) Put64

func (w *TableWriter) Put64(v uint64)

func (*TableWriter) Put128

func (w *TableWriter) Put128(lo, hi uint64)

Put128 writes two little-endian lanes, low first, under one Advance.

func (*TableWriter) PutLeb

func (w *TableWriter) PutLeb(v uint64)

func (*TableWriter) Raw

func (w *TableWriter) Raw(data []byte)

func (*TableWriter) Trailer

func (w *TableWriter) Trailer()

type UnitViewInfo

type UnitViewInfo struct {
	Package                                                          string
	ProtocolId                                                       uint64
	NumTypes, NumTables, NumEnums, NumFlags, NumUnions, NumConstants int32
	Types, Tables                                                    []ViewType
	Enums, Flags, Unions                                             []ViewVocabulary
	Constants                                                        []ViewConstant
}

func UnitView

func UnitView() *UnitViewInfo

type ViewConstant

type ViewConstant struct {
	Name, File, TypeName string
	IsFloat              bool
	IntValue             int64
	FloatValue           float64
	Doc                  string
	NumTags              int32
	Tags                 []string
}

UnitView returns this build's registry. Treat its descriptors and slices as immutable; lookups allocate nothing. Packet-only types gain no table codec. A packet dependency can use different storage from its table Row; its descriptor follows that storage, so every offset remains valid for the value.

type ViewType

type ViewType struct {
	Name, File string
	Table      bool
	Type       *TableTypeInfo
	Doc        string
	NumTags    int32
	Tags       []string
}

type ViewVariant

type ViewVariant struct {
	Value       uint64
	Name        string
	Id          uint64
	PayloadName string
	Payload     func() *TableTypeInfo
	Field       func() *TableFieldInfo
	Doc         string
	NumTags     int32
	Tags        []string
}

type ViewVocabulary

type ViewVocabulary struct {
	Name, File               string
	Max                      int64
	StorageBits, NumVariants int32
	PayloadOffset            uint32
	Variants                 []ViewVariant
	Doc                      string
	NumTags                  int32
	Tags                     []string
}

Directories

Path Synopsis
cmd
pong-driver command
Command pong-driver is the Go leg the schema compiler's wire fuzzer drives over the pong unit (make schemawire-conformance).
Command pong-driver is the Go leg the schema compiler's wire fuzzer drives over the pong unit (make schemawire-conformance).

Jump to

Keyboard shortcuts

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