Documentation
¶
Overview ¶
Package dialogreply is the leeway-coded wire form of the file-dialog reply payload published on `fs.dialog.{op}` replies.
Vocabulary:
- vdd.MembDialogApproved — narrow boolean (kept narrow vs. elevating to a shared `approved` term — see the fsbroker vdd file's rationale).
- vdd.MembDialogHandleSubject — narrow string; the NATS subject prefix the caller's caps are scoped to on approval.
- vdd.MembReason — shared, populated on denial and broker-side errors.
The Go-level [fsbroker.DialogReply] keeps its existing shape (Granted/HandleSubjectPrefix/Reason); this struct is the codec-side projection only. Conversion lives in `fsbroker.MarshalDialogReply` / `UnmarshalDialogReply`. New plain columns (FactId/At) are stamped at marshal time inside those helpers; the broker's existing API is unchanged.
Index ¶
- Variables
- func DialogReplyAddSections[BoolAttr DialogReplyBoolAttrI, BoolSec DialogReplyBoolSecI[BoolAttr, Ent], ...](dml DML, row DialogReply) (err error)
- func DialogReplyBuildEntities[BoolAttr DialogReplyBoolAttrI, BoolSec DialogReplyBoolSecI[BoolAttr, Ent], ...](dml DML, c *DialogReplyColumns) (err error)
- func DialogReplyEmitSectionBool[BoolAttr DialogReplyBoolAttrI, BoolSec DialogReplyBoolSecI[BoolAttr, Ent], ...](boolSec BoolSec, row DialogReply) (err error)
- func DialogReplyEmitSectionStringArray[StringArrayAttr DialogReplyStringArrayAttrI, ...](stringArraySec StringArraySec, row DialogReply) (err error)
- func DialogReplyEmitSectionTextArray[TextArrayAttr DialogReplyTextArrayAttrI, ...](textArraySec TextArraySec, row DialogReply) (err error)
- func DialogReplyFillFromArrow[BoolAttrs DialogReplyBoolAttrsReadI, BoolMembs DialogReplyBoolMembsReadI, ...](c *DialogReplyColumns, n int, idCol *array.Uint64, nkCol *array.Binary, ...) (err error)
- type DialogReply
- type DialogReplyBoolAttrI
- type DialogReplyBoolAttrsReadI
- type DialogReplyBoolMembsReadI
- type DialogReplyBoolSecI
- type DialogReplyCodec
- type DialogReplyColumns
- type DialogReplyEntityI
- type DialogReplyStringArrayAttrI
- type DialogReplyStringArrayAttrsReadI
- type DialogReplyStringArrayMembsReadI
- type DialogReplyStringArraySecI
- type DialogReplyTextArrayAttrI
- type DialogReplyTextArrayAttrsReadI
- type DialogReplyTextArrayMembsReadI
- type DialogReplyTextArraySecI
Constants ¶
This section is empty.
Variables ¶
var DialogReplyActiveFields = sync.OnceValue(func() []int { active := map[string]bool{"bool": true, "stringArray": 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 })
DialogReplyActiveFields 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 DialogReplyActiveSections = []int{1, 9, 12}
DialogReplyActiveSections 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.
var PackageProps = packageprops.Props{ WASMWASI: packageprops.WASMBlocked, WASMJS: packageprops.WASMBlocked, WASMFreestanding: packageprops.WASMBlocked, }
PackageProps records this package's curated properties (ADR-0080). Seeded by `boxer code analysis golang wasmsurvey props generate`; curate by hand. The same group's `props verify` reconciles it.
Functions ¶
func DialogReplyAddSections ¶ added in v0.0.17
func DialogReplyAddSections[ BoolAttr DialogReplyBoolAttrI, BoolSec DialogReplyBoolSecI[BoolAttr, Ent], StringArrayAttr DialogReplyStringArrayAttrI, StringArraySec DialogReplyStringArraySecI[StringArrayAttr, Ent], TextArrayAttr DialogReplyTextArrayAttrI, TextArraySec DialogReplyTextArraySecI[TextArrayAttr, Ent], Ent any, DML DialogReplyEntityI[ BoolAttr, BoolSec, StringArrayAttr, StringArraySec, TextArrayAttr, TextArraySec, Ent, ], ](dml DML, row DialogReply) (err error)
DialogReplyAddSections 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 DialogReplyBuildEntities ¶
func DialogReplyBuildEntities[ BoolAttr DialogReplyBoolAttrI, BoolSec DialogReplyBoolSecI[BoolAttr, Ent], StringArrayAttr DialogReplyStringArrayAttrI, StringArraySec DialogReplyStringArraySecI[StringArrayAttr, Ent], TextArrayAttr DialogReplyTextArrayAttrI, TextArraySec DialogReplyTextArraySecI[TextArrayAttr, Ent], Ent any, DML DialogReplyEntityI[ BoolAttr, BoolSec, StringArrayAttr, StringArraySec, TextArrayAttr, TextArraySec, Ent, ], ](dml DML, c *DialogReplyColumns) (err error)
DialogReplyBuildEntities 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 DialogReplyEmitSectionBool ¶ added in v0.0.20
func DialogReplyEmitSectionBool[ BoolAttr DialogReplyBoolAttrI, BoolSec DialogReplyBoolSecI[BoolAttr, Ent], Ent any, ](boolSec BoolSec, row DialogReply) (err error)
DialogReplyEmitSectionBool 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 DialogReplyEmitSectionStringArray ¶ added in v0.0.20
func DialogReplyEmitSectionStringArray[ StringArrayAttr DialogReplyStringArrayAttrI, StringArraySec DialogReplyStringArraySecI[StringArrayAttr, Ent], Ent any, ](stringArraySec StringArraySec, row DialogReply) (err error)
DialogReplyEmitSectionStringArray writes this kind's stringArray 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 DialogReplyEmitSectionTextArray ¶ added in v0.0.20
func DialogReplyEmitSectionTextArray[ TextArrayAttr DialogReplyTextArrayAttrI, TextArraySec DialogReplyTextArraySecI[TextArrayAttr, Ent], Ent any, ](textArraySec TextArraySec, row DialogReply) (err error)
DialogReplyEmitSectionTextArray 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 DialogReplyFillFromArrow ¶
func DialogReplyFillFromArrow[ BoolAttrs DialogReplyBoolAttrsReadI, BoolMembs DialogReplyBoolMembsReadI, StringArrayAttrs DialogReplyStringArrayAttrsReadI, StringArrayMembs DialogReplyStringArrayMembsReadI, TextArrayAttrs DialogReplyTextArrayAttrsReadI, TextArrayMembs DialogReplyTextArrayMembsReadI, ]( c *DialogReplyColumns, n int, idCol *array.Uint64, nkCol *array.Binary, tsCol *array.Timestamp, boolAttrs BoolAttrs, boolMembs BoolMembs, stringArrayAttrs StringArrayAttrs, stringArrayMembs StringArrayMembs, textArrayAttrs TextArrayAttrs, textArrayMembs TextArrayMembs, ) (err error)
DialogReplyFillFromArrow 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 DialogReply ¶
type DialogReply struct {
// FactId is the per-row event id.
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"`
// Approved carries the user's accept/cancel decision (false also
// covers broker-side errors with Reason populated).
Approved bool `lw:"dialogApproved,bool"`
// HandleSubjectPrefix is the NATS subject prefix the caller's
// caps cover on approval. Empty on denial.
HandleSubjectPrefix string `lw:"dialogHandleSubject,stringArray"`
// Reason is the rationale (denial reason or broker error). Empty
// on a successful approval.
Reason string `lw:"reason,textArray"`
// contains filtered or unexported fields
}
DialogReply is the flat wire form of a file-dialog reply.
func DialogReplyReadRow ¶ added in v0.0.17
func DialogReplyReadRow[ BoolAttrs DialogReplyBoolAttrsReadI, BoolMembs DialogReplyBoolMembsReadI, StringArrayAttrs DialogReplyStringArrayAttrsReadI, StringArrayMembs DialogReplyStringArrayMembsReadI, TextArrayAttrs DialogReplyTextArrayAttrsReadI, TextArrayMembs DialogReplyTextArrayMembsReadI, ]( i int, boolAttrs BoolAttrs, boolMembs BoolMembs, stringArrayAttrs StringArrayAttrs, stringArrayMembs StringArrayMembs, textArrayAttrs TextArrayAttrs, textArrayMembs TextArrayMembs, ) (row DialogReply, present bool, err error)
DialogReplyReadRow reads row i as one optional DialogReply 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 DialogReplyBoolAttrI ¶
type DialogReplyBoolAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
DialogReplyBoolAttrI 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 DialogReplyBoolAttrsReadI ¶
type DialogReplyBoolAttrsReadI interface {
GetAttrValueValue(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) bool
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
DialogReplyBoolAttrsReadI is the Attributes-side view of the bool section.
type DialogReplyBoolMembsReadI ¶
type DialogReplyBoolMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
DialogReplyBoolMembsReadI is the Memberships-side view of the bool section.
type DialogReplyBoolSecI ¶
type DialogReplyBoolSecI[Attr any, Ent any] interface { BeginAttribute(value bool) Attr EndSection() Ent }
DialogReplyBoolSecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.
type DialogReplyCodec ¶
type DialogReplyCodec struct{}
DialogReplyCodec is the buscodec.CodecI bridge for DialogReply. 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 (*DialogReplyCodec) ContentType ¶
func (inst *DialogReplyCodec) ContentType() (ct string)
func (*DialogReplyCodec) Name ¶
func (inst *DialogReplyCodec) Name() (n string)
type DialogReplyColumns ¶
type DialogReplyColumns struct {
FactId []uint64
NaturalKey [][]byte
At []time.Time
Approved []bool
HandleSubjectPrefix []string
Reason []string
}
DialogReplyColumns is the SoA storage for batches of DialogReply rows. All slices grow in lockstep — Len returns the row count.
func (*DialogReplyColumns) Append ¶
func (c *DialogReplyColumns) Append(row DialogReply)
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 (*DialogReplyColumns) Len ¶
func (c *DialogReplyColumns) Len() int
Len returns the number of rows currently in the batch.
func (*DialogReplyColumns) Marshal ¶
func (c *DialogReplyColumns) 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 DialogReplyBuildEntities — the per-row chain lives there and works against any leeway-DML class that structurally satisfies DialogReplyEntityI.
func (*DialogReplyColumns) Row ¶
func (c *DialogReplyColumns) Row(i int) (row DialogReply)
Row reconstructs entity i as an AoS DialogReply record. Inverse of Append: slice / pointer fields are shared by reference (no defensive copy); scalar fields and Option[T] are copied.
type DialogReplyEntityI ¶
type DialogReplyEntityI[ BoolAttr DialogReplyBoolAttrI, BoolSec DialogReplyBoolSecI[BoolAttr, Ent], StringArrayAttr DialogReplyStringArrayAttrI, StringArraySec DialogReplyStringArraySecI[StringArrayAttr, Ent], TextArrayAttr DialogReplyTextArrayAttrI, TextArraySec DialogReplyTextArraySecI[TextArrayAttr, Ent], Ent any, ] interface { BeginEntity() Ent SetId(id uint64, naturalKey []byte) Ent SetTimestamp(ts time.Time) Ent GetSectionBool() BoolSec GetSectionStringArray() StringArraySec GetSectionTextArray() TextArraySec CommitEntity() (err error) }
DialogReplyEntityI is the entity-builder surface DialogReplyAddSections 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 DialogReplyStringArrayAttrI ¶
type DialogReplyStringArrayAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
DialogReplyStringArrayAttrI 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 DialogReplyStringArrayAttrsReadI ¶
type DialogReplyStringArrayAttrsReadI interface {
GetAttrValueSingle(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) (string, error)
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
DialogReplyStringArrayAttrsReadI is the Attributes-side view of the stringArray section.
type DialogReplyStringArrayMembsReadI ¶
type DialogReplyStringArrayMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
DialogReplyStringArrayMembsReadI is the Memberships-side view of the stringArray section.
type DialogReplyStringArraySecI ¶
type DialogReplyStringArraySecI[Attr any, Ent any] interface { BeginAttributeSingle(value string) Attr EndSection() Ent }
DialogReplyStringArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.
type DialogReplyTextArrayAttrI ¶
type DialogReplyTextArrayAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
DialogReplyTextArrayAttrI 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 DialogReplyTextArrayAttrsReadI ¶
type DialogReplyTextArrayAttrsReadI interface {
GetAttrValueSingle(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) (string, error)
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
DialogReplyTextArrayAttrsReadI is the Attributes-side view of the textArray section.
type DialogReplyTextArrayMembsReadI ¶
type DialogReplyTextArrayMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
DialogReplyTextArrayMembsReadI is the Memberships-side view of the textArray section.
type DialogReplyTextArraySecI ¶
type DialogReplyTextArraySecI[Attr any, Ent any] interface { BeginAttributeSingle(value string) Attr EndSection() Ent }
DialogReplyTextArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.