launchrequest

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package launchrequest is the leeway-coded wire form of the app-launch request payload published on `windowhost.open` (ADR-0135 §SD1). The request names a target app and optionally carries a launch config as facts-CBOR bytes produced by the target app's own generated codec (§SD2); the window host validates the claimed kind and the size cap at the boundary before any decode.

Vocabulary:

  • vdd.MembAppId — shared with the task.* / grant DTOs; here the app the launch targets. The caller's identity is deliberately NOT a payload field — the host attributes it from the bus envelope (Msg.Sender) the way capbroker attributes grant requesters.
  • vdd.MembLaunchConfigKind / vdd.MembLaunchConfig — narrow, the claimed config kind and the config bytes.

Index

Constants

This section is empty.

Variables

View Source
var LaunchRequestActiveFields = sync.OnceValue(func() []int {
	active := map[string]bool{"blobArray": true, "stringArray": true, "symbol": true}
	schema := cbdml.CreateSchemaFacts()
	out := make([]int, 0, 4+len(active)*8)
	for i, f := range schema.Fields() {
		name := f.Name
		switch {
		case strings.HasPrefix(name, "id:"),
			strings.HasPrefix(name, "ts:"),
			strings.HasPrefix(name, "lc:"):
			out = append(out, i)
		case strings.HasPrefix(name, "tv:"):
			rest := name[3:]
			colon := strings.IndexByte(rest, ':')
			if colon < 0 {
				continue
			}
			if active[rest[:colon]] {
				out = append(out, i)
			}
		}
	}
	return out
})

LaunchRequestActiveFields is the column-index subset this kind populates in the boxer.facts Arrow schema. Lazily computed once via sync.OnceValue: scans cbdml.CreateSchemaFacts()'s tv:<section>:... field names against this kind's active sections plus the three plain prefixes (id:, ts:, lc:). Driven through RecordBuilder. SetActiveFields to skip per-row emit walks for unused columns.

View Source
var LaunchRequestActiveSections = []int{0, 9, 10}

LaunchRequestActiveSections is the dml_cbor section-index subset this kind populates. Passed to InEntityFacts.SetActiveSections so the builder skips beginSection list-slot work for inactive sections.

View Source
var PackageProps = packageprops.Props{
	WASMWASI:         packageprops.WASMBlocked,
	WASMJS:           packageprops.WASMBlocked,
	WASMFreestanding: packageprops.WASMBlocked,
}

PackageProps records this package's curated properties (ADR-0080). Seeded by `wasmsurvey props generate`; curate by hand, then `wasmsurvey props verify`.

Functions

func LaunchRequestAddSections

func LaunchRequestAddSections[
	StringArrayAttr LaunchRequestStringArrayAttrI,
	StringArraySec LaunchRequestStringArraySecI[StringArrayAttr, Ent],
	SymbolAttr LaunchRequestSymbolAttrI,
	SymbolSec LaunchRequestSymbolSecI[SymbolAttr, Ent],
	BlobArrayAttr LaunchRequestBlobArrayAttrI,
	BlobArraySec LaunchRequestBlobArraySecI[BlobArrayAttr, Ent],
	Ent any,
	DML LaunchRequestEntityI[
		StringArrayAttr, StringArraySec,
		SymbolAttr, SymbolSec,
		BlobArrayAttr, BlobArraySec,
		Ent,
	],
](dml DML, row LaunchRequest) (err error)

LaunchRequestAddSections contributes this kind's tagged sections to the OPEN entity on dml — the BuildEntities body without the entity frame. The caller owns BeginEntity / plain setters / CommitEntity.

func LaunchRequestBuildEntities

func LaunchRequestBuildEntities[
	StringArrayAttr LaunchRequestStringArrayAttrI,
	StringArraySec LaunchRequestStringArraySecI[StringArrayAttr, Ent],
	SymbolAttr LaunchRequestSymbolAttrI,
	SymbolSec LaunchRequestSymbolSecI[SymbolAttr, Ent],
	BlobArrayAttr LaunchRequestBlobArrayAttrI,
	BlobArraySec LaunchRequestBlobArraySecI[BlobArrayAttr, Ent],
	Ent any,
	DML LaunchRequestEntityI[
		StringArrayAttr, StringArraySec,
		SymbolAttr, SymbolSec,
		BlobArrayAttr, BlobArraySec,
		Ent,
	],
](dml DML, c *LaunchRequestColumns) (err error)

LaunchRequestBuildEntities walks c row-by-row, drives dml's entity / section chain, and returns once every row has been committed. The dml argument's concrete type binds every type parameter via Go's type inference at the call site.

func LaunchRequestFillFromArrow

func LaunchRequestFillFromArrow[
	StringArrayAttrs LaunchRequestStringArrayAttrsReadI,
	StringArrayMembs LaunchRequestStringArrayMembsReadI,
	SymbolAttrs LaunchRequestSymbolAttrsReadI,
	SymbolMembs LaunchRequestSymbolMembsReadI,
	BlobArrayAttrs LaunchRequestBlobArrayAttrsReadI,
	BlobArrayMembs LaunchRequestBlobArrayMembsReadI,
](
	c *LaunchRequestColumns,
	n int,
	idCol *array.Uint64,
	nkCol *array.Binary,
	tsCol *array.Timestamp,
	stringArrayAttrs StringArrayAttrs,
	stringArrayMembs StringArrayMembs,
	symbolAttrs SymbolAttrs,
	symbolMembs SymbolMembs,
	blobArrayAttrs BlobArrayAttrs,
	blobArrayMembs BlobArrayMembs,
) (err error)

LaunchRequestFillFromArrow walks rec row-by-row and appends each entity's plain + tagged-section values into c. Plain columns enter as concrete Arrow accessors; per-section Attrs + Membs bind through type-parameter interfaces.

Types

type LaunchRequest

type LaunchRequest struct {

	// FactId is the per-row event id (currently zero from the
	// producer; awaits the per-handle sequencer follow-up flagged in
	// the TaskProgress migration).
	FactId uint64 `lw:",id"`

	// NaturalKey is the entity natural key; the facts SetId is 2-arg.
	// These bus DTOs carry no separate key, so it stays the nil default.
	NaturalKey []byte `lw:",naturalKey"`

	// At is the event timestamp. time.Time matches the facts
	// SetTimestamp signature directly (strict 1:1); the leeway wire
	// truncates to u32 seconds, while the bus preserves full nanos.
	At time.Time `lw:",ts"`

	// TargetAppId names the app to open.
	TargetAppId string `lw:"appId,stringArray"`

	// ConfigKind is the vocabulary kind name Config's bytes claim
	// (e.g. "playLaunch"). Empty for a plain open. The host refuses a
	// mismatch against the target manifest's LaunchKind before any
	// decode reaches the app.
	ConfigKind string `lw:"launchConfigKind,symbol"`

	// Config is the launch config as facts-CBOR bytes produced by the
	// target app's generated codec. Empty means "open plainly". Capped
	// at the host boundary (64 KiB) before any decode.
	Config []byte `lw:"launchConfig,blobArray"`
	// contains filtered or unexported fields
}

LaunchRequest is the flat wire form of an app-launch request.

func LaunchRequestReadRow

func LaunchRequestReadRow[
	StringArrayAttrs LaunchRequestStringArrayAttrsReadI,
	StringArrayMembs LaunchRequestStringArrayMembsReadI,
	SymbolAttrs LaunchRequestSymbolAttrsReadI,
	SymbolMembs LaunchRequestSymbolMembsReadI,
	BlobArrayAttrs LaunchRequestBlobArrayAttrsReadI,
	BlobArrayMembs LaunchRequestBlobArrayMembsReadI,
](
	i int,
	stringArrayAttrs StringArrayAttrs,
	stringArrayMembs StringArrayMembs,
	symbolAttrs SymbolAttrs,
	symbolMembs SymbolMembs,
	blobArrayAttrs BlobArrayAttrs,
	blobArrayMembs BlobArrayMembs,
) (row LaunchRequest, present bool, err error)

LaunchRequestReadRow reads row i as one optional LaunchRequest component: presence- gated (a row carrying none of the kind's memberships yields present=false), membership-matched. A slot carrying more attributes than this kind's shape admits is an error, for every shape including containers. Plain- bound fields stay zero — the caller owns the envelope. The Attrs/Membs readers bind by type inference at the call site, as with FillFromArrow.

type LaunchRequestBlobArrayAttrI

type LaunchRequestBlobArrayAttrI interface {
	dmlruntime.InAttributeMembershipLowCardRefPI
	EndAttributeP()
}

LaunchRequestBlobArrayAttrI is the InAttr-side view of the blobArray section. P-variants only — every method returns void so no F-bounded `[Self]` parameter is needed.

type LaunchRequestBlobArrayAttrsReadI

type LaunchRequestBlobArrayAttrsReadI interface {
	GetAttrValueSingleOrDefault(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) []byte
	GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}

LaunchRequestBlobArrayAttrsReadI is the Attributes-side view of the blobArray section.

type LaunchRequestBlobArrayMembsReadI

type LaunchRequestBlobArrayMembsReadI interface {
	GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}

LaunchRequestBlobArrayMembsReadI is the Memberships-side view of the blobArray section.

type LaunchRequestBlobArraySecI

type LaunchRequestBlobArraySecI[Attr any, Ent any] interface {
	BeginAttributeSingle(value []byte) Attr
	EndSection() Ent
}

LaunchRequestBlobArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.

type LaunchRequestCodec

type LaunchRequestCodec struct{}

LaunchRequestCodec is the buscodec.CodecI bridge for LaunchRequest. Encodes one row through dml_cbor; decodes via cborarrow.Convert + ra-Unmarshal + Row(0). Auto-registered in init() so callers using buscodec.Encode / Decode route through here instead of the CBOR fallback.

func (*LaunchRequestCodec) ContentType

func (inst *LaunchRequestCodec) ContentType() (ct string)

func (*LaunchRequestCodec) Decode

func (inst *LaunchRequestCodec) Decode(b []byte, v any) (err error)

func (*LaunchRequestCodec) Encode

func (inst *LaunchRequestCodec) Encode(v any) (b []byte, err error)

func (*LaunchRequestCodec) Name

func (inst *LaunchRequestCodec) Name() (n string)

type LaunchRequestColumns

type LaunchRequestColumns struct {
	FactId     []uint64
	NaturalKey [][]byte
	At         []time.Time

	TargetAppId []string
	ConfigKind  []string
	Config      [][]byte
}

LaunchRequestColumns is the SoA storage for batches of LaunchRequest rows. All slices grow in lockstep — Len returns the row count.

func (*LaunchRequestColumns) Append

func (c *LaunchRequestColumns) Append(row LaunchRequest)

Append pushes one AoS record into the SoA buffers.

Aliasing: slice and pointer fields (`[]T`, `*roaring.Bitmap`) are stored by reference, not copied. Callers must not mutate row.<F> after Append unless they want Marshal to read the mutation. Scalar fields (T, Option[T]) are copied by value.

func (*LaunchRequestColumns) Len

func (c *LaunchRequestColumns) Len() int

Len returns the number of rows currently in the batch.

func (*LaunchRequestColumns) Marshal

func (c *LaunchRequestColumns) Marshal(w io.Writer) (err error)

Marshal writes the SoA buffer to w as the sparse-CBOR wire format produced through factsschema/dml_cbor. Thin wrapper around LaunchRequestBuildEntities — the per-row chain lives there and works against any leeway-DML class that structurally satisfies LaunchRequestEntityI.

func (*LaunchRequestColumns) Row

func (c *LaunchRequestColumns) Row(i int) (row LaunchRequest)

Row reconstructs entity i as an AoS LaunchRequest record. Inverse of Append: slice / pointer fields are shared by reference (no defensive copy); scalar fields and Option[T] are copied.

func (*LaunchRequestColumns) Unmarshal

func (c *LaunchRequestColumns) Unmarshal(rec arrow.Record) (err error)

Unmarshal appends one row to c per entity in rec, projecting the boxer.facts columns through factsschema/ra. Thin wrapper around LaunchRequestFillFromArrow — the per-row decode lives there.

type LaunchRequestEntityI

type LaunchRequestEntityI[
	StringArrayAttr LaunchRequestStringArrayAttrI,
	StringArraySec LaunchRequestStringArraySecI[StringArrayAttr, Ent],
	SymbolAttr LaunchRequestSymbolAttrI,
	SymbolSec LaunchRequestSymbolSecI[SymbolAttr, Ent],
	BlobArrayAttr LaunchRequestBlobArrayAttrI,
	BlobArraySec LaunchRequestBlobArraySecI[BlobArrayAttr, Ent],
	Ent any,
] interface {
	BeginEntity() Ent
	SetId(id uint64, naturalKey []byte) Ent
	SetTimestamp(ts time.Time) Ent
	GetSectionStringArray() StringArraySec
	GetSectionSymbol() SymbolSec
	GetSectionBlobArray() BlobArraySec
	CommitEntity() (err error)
}

LaunchRequestEntityI is the entity-builder surface LaunchRequestAddSections drives. It always lists the per-section getters; the entity-frame methods (BeginEntity / plain setters / CommitEntity) are added only for the full codec's BuildEntities. AddSections stacks sections onto a frame the caller already owns, so it needs none of them — which lets a store drive it with a builder whose frame control is unexported (ADR-0100 SD6). Ent is the builder pointer.

type LaunchRequestStringArrayAttrI

type LaunchRequestStringArrayAttrI interface {
	dmlruntime.InAttributeMembershipLowCardRefPI
	EndAttributeP()
}

LaunchRequestStringArrayAttrI is the InAttr-side view of the stringArray section. P-variants only — every method returns void so no F-bounded `[Self]` parameter is needed.

type LaunchRequestStringArrayAttrsReadI

type LaunchRequestStringArrayAttrsReadI interface {
	GetAttrValueSingleOrDefault(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) string
	GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}

LaunchRequestStringArrayAttrsReadI is the Attributes-side view of the stringArray section.

type LaunchRequestStringArrayMembsReadI

type LaunchRequestStringArrayMembsReadI interface {
	GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}

LaunchRequestStringArrayMembsReadI is the Memberships-side view of the stringArray section.

type LaunchRequestStringArraySecI

type LaunchRequestStringArraySecI[Attr any, Ent any] interface {
	BeginAttributeSingle(value string) Attr
	EndSection() Ent
}

LaunchRequestStringArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.

type LaunchRequestSymbolAttrI

type LaunchRequestSymbolAttrI interface {
	dmlruntime.InAttributeMembershipLowCardRefPI
	EndAttributeP()
}

LaunchRequestSymbolAttrI is the InAttr-side view of the symbol section. P-variants only — every method returns void so no F-bounded `[Self]` parameter is needed.

type LaunchRequestSymbolAttrsReadI

type LaunchRequestSymbolAttrsReadI interface {
	GetAttrValueValue(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) string
	GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}

LaunchRequestSymbolAttrsReadI is the Attributes-side view of the symbol section.

type LaunchRequestSymbolMembsReadI

type LaunchRequestSymbolMembsReadI interface {
	GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}

LaunchRequestSymbolMembsReadI is the Memberships-side view of the symbol section.

type LaunchRequestSymbolSecI

type LaunchRequestSymbolSecI[Attr any, Ent any] interface {
	BeginAttribute(value string) Attr
	EndSection() Ent
}

LaunchRequestSymbolSecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.

Jump to

Keyboard shortcuts

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