Documentation
¶
Overview ¶
Package launchcfg is play's launch config (ADR-0135 §SD7): the typed arguments another app can open a play window with over `windowhost.open`. The DTO follows the runtime codec grammar and the generated codec is the only wire form — callers encode with Marshal / buscodec.Encode, play decodes in Mount with the generated Unmarshal.
Vocabulary (narrow, ADR-0135 cohort in the keelson vdd):
- vdd.MembPlayLaunchSql / vdd.MembPlayLaunchBandsSql — text, the editor buffer and the Timeline bands buffer.
- vdd.MembPlayLaunchAutoRun / vdd.MembPlayLaunchLive — bool flags.
- vdd.MembPlayLaunchTab — symbol, the initially focused tab id.
Seeding priority in play's Mount: a window opened WITH a config applies it above both the BOXER_PLAY_* env overrides and the persisted session buffer; plainly-opened windows are unaffected.
Index ¶
- Constants
- Variables
- func PlayLaunchAddSections[TextArrayAttr PlayLaunchTextArrayAttrI, ...](dml DML, row PlayLaunch) (err error)
- func PlayLaunchBuildEntities[TextArrayAttr PlayLaunchTextArrayAttrI, ...](dml DML, c *PlayLaunchColumns) (err error)
- func PlayLaunchEmitSectionBool[BoolAttr PlayLaunchBoolAttrI, BoolSec PlayLaunchBoolSecI[BoolAttr, Ent], ...](boolSec BoolSec, row PlayLaunch) (err error)
- func PlayLaunchEmitSectionSymbol[SymbolAttr PlayLaunchSymbolAttrI, ...](symbolSec SymbolSec, row PlayLaunch) (err error)
- func PlayLaunchEmitSectionTextArray[TextArrayAttr PlayLaunchTextArrayAttrI, ...](textArraySec TextArraySec, row PlayLaunch) (err error)
- func PlayLaunchFillFromArrow[TextArrayAttrs PlayLaunchTextArrayAttrsReadI, ...](c *PlayLaunchColumns, n int, idCol *array.Uint64, nkCol *array.Binary, ...) (err error)
- type PlayLaunch
- type PlayLaunchBoolAttrI
- type PlayLaunchBoolAttrsReadI
- type PlayLaunchBoolMembsReadI
- type PlayLaunchBoolSecI
- type PlayLaunchCodec
- type PlayLaunchColumns
- type PlayLaunchEntityI
- type PlayLaunchSymbolAttrI
- type PlayLaunchSymbolAttrsReadI
- type PlayLaunchSymbolMembsReadI
- type PlayLaunchSymbolSecI
- type PlayLaunchTextArrayAttrI
- type PlayLaunchTextArrayAttrsReadI
- type PlayLaunchTextArrayMembsReadI
- type PlayLaunchTextArraySecI
Constants ¶
const ( // EndpointDefault keeps play's env-configured ClickHouse target. EndpointDefault = "default" // EndpointIntrospection binds the opened window's client to the // in-process keelson `/query` endpoint (introspect.LocalQueryEndpoint, // ADR-0094 §SD6) — where ad-hoc `keelson('<handle>')` datasets resolve // (ADR-0134). Ignored, with a warning, when no such endpoint is up. EndpointIntrospection = "introspection" )
Endpoint values for the PlayLaunch.Endpoint field. Empty behaves like EndpointDefault.
const AppId = "github.com/stergiotis/boxer/apps/play"
AppId is play's registered manifest id — the target another app names in a `windowhost.open` request (ADR-0135 §SD7). Kept here, in the leaf launch contract, rather than in the app package: importing `apps/play` for a constant drags the whole playground — and its registry-registering init() — into the importer, which silently registers the SQL playground as a side effect (ADR-0017 §SD4). `play.AppId` re-exports this value, so existing call sites are unaffected. Untyped so it flows into app.AppIdT contexts (Manifest.Id, RequestOpen) without this leaf depending on the app runtime. The appletcreatecfg.AppId precedent.
const Kind = "playLaunch"
Kind is the vocabulary kind name of this config — the value play's manifest declares as LaunchKind and callers put in launchrequest.LaunchRequest.ConfigKind.
Variables ¶
var PlayLaunchActiveFields = sync.OnceValue(func() []int { active := map[string]bool{"bool": true, "symbol": true, "textArray": 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 })
PlayLaunchActiveFields 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.
var PlayLaunchActiveSections = []int{1, 10, 12}
PlayLaunchActiveSections 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.
Functions ¶
func PlayLaunchAddSections ¶
func PlayLaunchAddSections[ TextArrayAttr PlayLaunchTextArrayAttrI, TextArraySec PlayLaunchTextArraySecI[TextArrayAttr, Ent], BoolAttr PlayLaunchBoolAttrI, BoolSec PlayLaunchBoolSecI[BoolAttr, Ent], SymbolAttr PlayLaunchSymbolAttrI, SymbolSec PlayLaunchSymbolSecI[SymbolAttr, Ent], Ent any, DML PlayLaunchEntityI[ TextArrayAttr, TextArraySec, BoolAttr, BoolSec, SymbolAttr, SymbolSec, Ent, ], ](dml DML, row PlayLaunch) (err error)
PlayLaunchAddSections 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 PlayLaunchBuildEntities ¶
func PlayLaunchBuildEntities[ TextArrayAttr PlayLaunchTextArrayAttrI, TextArraySec PlayLaunchTextArraySecI[TextArrayAttr, Ent], BoolAttr PlayLaunchBoolAttrI, BoolSec PlayLaunchBoolSecI[BoolAttr, Ent], SymbolAttr PlayLaunchSymbolAttrI, SymbolSec PlayLaunchSymbolSecI[SymbolAttr, Ent], Ent any, DML PlayLaunchEntityI[ TextArrayAttr, TextArraySec, BoolAttr, BoolSec, SymbolAttr, SymbolSec, Ent, ], ](dml DML, c *PlayLaunchColumns) (err error)
PlayLaunchBuildEntities 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 PlayLaunchEmitSectionBool ¶ added in v0.0.20
func PlayLaunchEmitSectionBool[ BoolAttr PlayLaunchBoolAttrI, BoolSec PlayLaunchBoolSecI[BoolAttr, Ent], Ent any, ](boolSec BoolSec, row PlayLaunch) (err error)
PlayLaunchEmitSectionBool writes this kind's bool attributes into an ALREADY-OPEN section frame, and does not close it. The caller owns the frame: one kind's AddSections, or a builder deferring the close until every component that shares the section has written.
func PlayLaunchEmitSectionSymbol ¶ added in v0.0.20
func PlayLaunchEmitSectionSymbol[ SymbolAttr PlayLaunchSymbolAttrI, SymbolSec PlayLaunchSymbolSecI[SymbolAttr, Ent], Ent any, ](symbolSec SymbolSec, row PlayLaunch) (err error)
PlayLaunchEmitSectionSymbol writes this kind's symbol attributes into an ALREADY-OPEN section frame, and does not close it. The caller owns the frame: one kind's AddSections, or a builder deferring the close until every component that shares the section has written.
func PlayLaunchEmitSectionTextArray ¶ added in v0.0.20
func PlayLaunchEmitSectionTextArray[ TextArrayAttr PlayLaunchTextArrayAttrI, TextArraySec PlayLaunchTextArraySecI[TextArrayAttr, Ent], Ent any, ](textArraySec TextArraySec, row PlayLaunch) (err error)
PlayLaunchEmitSectionTextArray writes this kind's textArray attributes into an ALREADY-OPEN section frame, and does not close it. The caller owns the frame: one kind's AddSections, or a builder deferring the close until every component that shares the section has written.
func PlayLaunchFillFromArrow ¶
func PlayLaunchFillFromArrow[ TextArrayAttrs PlayLaunchTextArrayAttrsReadI, TextArrayMembs PlayLaunchTextArrayMembsReadI, BoolAttrs PlayLaunchBoolAttrsReadI, BoolMembs PlayLaunchBoolMembsReadI, SymbolAttrs PlayLaunchSymbolAttrsReadI, SymbolMembs PlayLaunchSymbolMembsReadI, ]( c *PlayLaunchColumns, n int, idCol *array.Uint64, nkCol *array.Binary, tsCol *array.Timestamp, textArrayAttrs TextArrayAttrs, textArrayMembs TextArrayMembs, boolAttrs BoolAttrs, boolMembs BoolMembs, symbolAttrs SymbolAttrs, symbolMembs SymbolMembs, ) (err error)
PlayLaunchFillFromArrow 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 PlayLaunch ¶
type PlayLaunch struct {
// FactId is the per-row event id (zero from producers; the launch
// row's durable id is minted by the facts store on persist).
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"`
// Sql is the initial editor buffer. Non-empty wins over the
// BOXER_PLAY_SQL override and the persisted-session restore; empty
// falls through to that existing chain.
Sql string `lw:"playLaunchSql,textArray"`
// AutoRun triggers a Run of the seeded buffer on mount. Applied
// whenever the window carries a config (replacing the
// BOXER_PLAY_AUTORUN tier), matching the "config beats env" rule.
AutoRun bool `lw:"playLaunchAutoRun,bool"`
// Live enables live re-run on the main lane (SetLiveMain).
Live bool `lw:"playLaunchLive,bool"`
// BandsSql seeds the Timeline panel's bands editor when non-empty;
// empty leaves the persisted/env-seeded bands untouched.
BandsSql string `lw:"playLaunchBandsSql,textArray"`
// Tab selects the initially focused body tab by id when non-empty
// (ActivateTab); an unknown id is a warning, not a mount error.
Tab string `lw:"playLaunchTab,symbol"`
// Endpoint binds the opened window's client to a query target:
// EndpointIntrospection points it at the in-process keelson `/query`
// endpoint (where ad-hoc `keelson('<handle>')` datasets resolve,
// ADR-0134); empty or EndpointDefault keeps play's env-configured
// ClickHouse. An "introspection" request with no such endpoint up is a
// warning, not a mount error — the window opens on the default target.
Endpoint string `lw:"playLaunchEndpoint,symbol"`
// contains filtered or unexported fields
}
PlayLaunch is the flat wire form of play's launch arguments.
func PlayLaunchReadRow ¶
func PlayLaunchReadRow[ TextArrayAttrs PlayLaunchTextArrayAttrsReadI, TextArrayMembs PlayLaunchTextArrayMembsReadI, BoolAttrs PlayLaunchBoolAttrsReadI, BoolMembs PlayLaunchBoolMembsReadI, SymbolAttrs PlayLaunchSymbolAttrsReadI, SymbolMembs PlayLaunchSymbolMembsReadI, ]( i int, textArrayAttrs TextArrayAttrs, textArrayMembs TextArrayMembs, boolAttrs BoolAttrs, boolMembs BoolMembs, symbolAttrs SymbolAttrs, symbolMembs SymbolMembs, ) (row PlayLaunch, present bool, err error)
PlayLaunchReadRow reads row i as one optional PlayLaunch 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 PlayLaunchBoolAttrI ¶
type PlayLaunchBoolAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
PlayLaunchBoolAttrI is the InAttr-side view of the bool section. P-variants only — every method returns void so no F-bounded `[Self]` parameter is needed.
type PlayLaunchBoolAttrsReadI ¶
type PlayLaunchBoolAttrsReadI interface {
GetAttrValueValue(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) bool
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
PlayLaunchBoolAttrsReadI is the Attributes-side view of the bool section.
type PlayLaunchBoolMembsReadI ¶
type PlayLaunchBoolMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
PlayLaunchBoolMembsReadI is the Memberships-side view of the bool section.
type PlayLaunchBoolSecI ¶
type PlayLaunchBoolSecI[Attr any, Ent any] interface { BeginAttribute(value bool) Attr EndSection() Ent }
PlayLaunchBoolSecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.
type PlayLaunchCodec ¶
type PlayLaunchCodec struct{}
PlayLaunchCodec is the buscodec.CodecI bridge for PlayLaunch. 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 (*PlayLaunchCodec) ContentType ¶
func (inst *PlayLaunchCodec) ContentType() (ct string)
func (*PlayLaunchCodec) Name ¶
func (inst *PlayLaunchCodec) Name() (n string)
type PlayLaunchColumns ¶
type PlayLaunchColumns struct {
FactId []uint64
NaturalKey [][]byte
At []time.Time
Sql []string
AutoRun []bool
Live []bool
BandsSql []string
Tab []string
Endpoint []string
}
PlayLaunchColumns is the SoA storage for batches of PlayLaunch rows. All slices grow in lockstep — Len returns the row count.
func (*PlayLaunchColumns) Append ¶
func (c *PlayLaunchColumns) Append(row PlayLaunch)
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 (*PlayLaunchColumns) Len ¶
func (c *PlayLaunchColumns) Len() int
Len returns the number of rows currently in the batch.
func (*PlayLaunchColumns) Marshal ¶
func (c *PlayLaunchColumns) 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 PlayLaunchBuildEntities — the per-row chain lives there and works against any leeway-DML class that structurally satisfies PlayLaunchEntityI.
func (*PlayLaunchColumns) Row ¶
func (c *PlayLaunchColumns) Row(i int) (row PlayLaunch)
Row reconstructs entity i as an AoS PlayLaunch record. Inverse of Append: slice / pointer fields are shared by reference (no defensive copy); scalar fields and Option[T] are copied.
type PlayLaunchEntityI ¶
type PlayLaunchEntityI[ TextArrayAttr PlayLaunchTextArrayAttrI, TextArraySec PlayLaunchTextArraySecI[TextArrayAttr, Ent], BoolAttr PlayLaunchBoolAttrI, BoolSec PlayLaunchBoolSecI[BoolAttr, Ent], SymbolAttr PlayLaunchSymbolAttrI, SymbolSec PlayLaunchSymbolSecI[SymbolAttr, Ent], Ent any, ] interface { BeginEntity() Ent SetId(id uint64, naturalKey []byte) Ent SetTimestamp(ts time.Time) Ent GetSectionTextArray() TextArraySec GetSectionBool() BoolSec GetSectionSymbol() SymbolSec CommitEntity() (err error) }
PlayLaunchEntityI is the entity-builder surface PlayLaunchAddSections 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 PlayLaunchSymbolAttrI ¶
type PlayLaunchSymbolAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
PlayLaunchSymbolAttrI 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 PlayLaunchSymbolAttrsReadI ¶
type PlayLaunchSymbolAttrsReadI interface {
GetAttrValueValue(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) string
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
PlayLaunchSymbolAttrsReadI is the Attributes-side view of the symbol section.
type PlayLaunchSymbolMembsReadI ¶
type PlayLaunchSymbolMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
PlayLaunchSymbolMembsReadI is the Memberships-side view of the symbol section.
type PlayLaunchSymbolSecI ¶
type PlayLaunchSymbolSecI[Attr any, Ent any] interface { BeginAttribute(value string) Attr EndSection() Ent }
PlayLaunchSymbolSecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.
type PlayLaunchTextArrayAttrI ¶
type PlayLaunchTextArrayAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
PlayLaunchTextArrayAttrI is the InAttr-side view of the textArray section. P-variants only — every method returns void so no F-bounded `[Self]` parameter is needed.
type PlayLaunchTextArrayAttrsReadI ¶
type PlayLaunchTextArrayAttrsReadI interface {
GetAttrValueSingle(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) (string, error)
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
PlayLaunchTextArrayAttrsReadI is the Attributes-side view of the textArray section.
type PlayLaunchTextArrayMembsReadI ¶
type PlayLaunchTextArrayMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
PlayLaunchTextArrayMembsReadI is the Memberships-side view of the textArray section.
type PlayLaunchTextArraySecI ¶
type PlayLaunchTextArraySecI[Attr any, Ent any] interface { BeginAttributeSingle(value string) Attr EndSection() Ent }
PlayLaunchTextArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.