Documentation
¶
Overview ¶
Package taskcancel is the leeway-coded wire form of the cancellation request published on `task.<id>.cancel`. Third broker DTO to migrate off the buscodec fxamacker-cbor default onto the ADR-0042 SoA codec (after keelson/runtime/codec/taskprogress and keelson/runtime/codec/taskcreated).
Vocabulary reuse:
- vdd.MembTaskId — shared subject identifier across all task.* wire DTOs.
- vdd.MembReason — shared free-text rationale column; will be reused by TaskError and future audit DTOs that carry a "why this happened" annotation.
Wire shape vs the legacy task.TaskCancel JSON form:
- `Id TaskIdT` → `TaskId string` (subject id moves out of the plain `id` slot into a string-section tagged column).
- `AtMs` → `At` (codec plain `ts` is a `time.Time`; producers convert via `time.UnixMilli` at the wire boundary).
- New `FactId uint64` plain `id` (per-row event sequence; currently left zero — see the TaskProgress migration entry for the producer-side sequencer follow-up).
The legacy "empty payload yields zero TaskCancel" interop hook stays in [task.UnmarshalTaskCancel] — bypassing the codec for the nil-payload case keeps cancel-with-no-reason callers wire-compatible across the migration.
Index ¶
- Variables
- func TaskCancelAddSections[StringArrayAttr TaskCancelStringArrayAttrI, ...](dml DML, row TaskCancel) (err error)
- func TaskCancelBuildEntities[StringArrayAttr TaskCancelStringArrayAttrI, ...](dml DML, c *TaskCancelColumns) (err error)
- func TaskCancelEmitSectionStringArray[StringArrayAttr TaskCancelStringArrayAttrI, ...](stringArraySec StringArraySec, row TaskCancel) (err error)
- func TaskCancelEmitSectionTextArray[TextArrayAttr TaskCancelTextArrayAttrI, ...](textArraySec TextArraySec, row TaskCancel) (err error)
- func TaskCancelFillFromArrow[StringArrayAttrs TaskCancelStringArrayAttrsReadI, ...](c *TaskCancelColumns, n int, idCol *array.Uint64, nkCol *array.Binary, ...) (err error)
- type TaskCancel
- type TaskCancelCodec
- type TaskCancelColumns
- type TaskCancelEntityI
- type TaskCancelStringArrayAttrI
- type TaskCancelStringArrayAttrsReadI
- type TaskCancelStringArrayMembsReadI
- type TaskCancelStringArraySecI
- type TaskCancelTextArrayAttrI
- type TaskCancelTextArrayAttrsReadI
- type TaskCancelTextArrayMembsReadI
- type TaskCancelTextArraySecI
Constants ¶
This section is empty.
Variables ¶
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.
var TaskCancelActiveFields = sync.OnceValue(func() []int { active := map[string]bool{"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 })
TaskCancelActiveFields 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 TaskCancelActiveSections = []int{9, 12}
TaskCancelActiveSections 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 TaskCancelAddSections ¶ added in v0.0.17
func TaskCancelAddSections[ StringArrayAttr TaskCancelStringArrayAttrI, StringArraySec TaskCancelStringArraySecI[StringArrayAttr, Ent], TextArrayAttr TaskCancelTextArrayAttrI, TextArraySec TaskCancelTextArraySecI[TextArrayAttr, Ent], Ent any, DML TaskCancelEntityI[ StringArrayAttr, StringArraySec, TextArrayAttr, TextArraySec, Ent, ], ](dml DML, row TaskCancel) (err error)
TaskCancelAddSections 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 TaskCancelBuildEntities ¶
func TaskCancelBuildEntities[ StringArrayAttr TaskCancelStringArrayAttrI, StringArraySec TaskCancelStringArraySecI[StringArrayAttr, Ent], TextArrayAttr TaskCancelTextArrayAttrI, TextArraySec TaskCancelTextArraySecI[TextArrayAttr, Ent], Ent any, DML TaskCancelEntityI[ StringArrayAttr, StringArraySec, TextArrayAttr, TextArraySec, Ent, ], ](dml DML, c *TaskCancelColumns) (err error)
TaskCancelBuildEntities 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 TaskCancelEmitSectionStringArray ¶ added in v0.0.20
func TaskCancelEmitSectionStringArray[ StringArrayAttr TaskCancelStringArrayAttrI, StringArraySec TaskCancelStringArraySecI[StringArrayAttr, Ent], Ent any, ](stringArraySec StringArraySec, row TaskCancel) (err error)
TaskCancelEmitSectionStringArray 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 TaskCancelEmitSectionTextArray ¶ added in v0.0.20
func TaskCancelEmitSectionTextArray[ TextArrayAttr TaskCancelTextArrayAttrI, TextArraySec TaskCancelTextArraySecI[TextArrayAttr, Ent], Ent any, ](textArraySec TextArraySec, row TaskCancel) (err error)
TaskCancelEmitSectionTextArray 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 TaskCancelFillFromArrow ¶
func TaskCancelFillFromArrow[ StringArrayAttrs TaskCancelStringArrayAttrsReadI, StringArrayMembs TaskCancelStringArrayMembsReadI, TextArrayAttrs TaskCancelTextArrayAttrsReadI, TextArrayMembs TaskCancelTextArrayMembsReadI, ]( c *TaskCancelColumns, n int, idCol *array.Uint64, nkCol *array.Binary, tsCol *array.Timestamp, stringArrayAttrs StringArrayAttrs, stringArrayMembs StringArrayMembs, textArrayAttrs TextArrayAttrs, textArrayMembs TextArrayMembs, ) (err error)
TaskCancelFillFromArrow 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 TaskCancel ¶
type TaskCancel struct {
// FactId is the per-row event id; distinct from TaskId (the
// subject of the cancel request).
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"`
// TaskId names the task whose cancellation is being requested.
TaskId string `lw:"taskId,stringArray"`
// Reason is a short human-readable rationale for the cancel
// (e.g. "user clicked cancel", "deadline exceeded"). Empty
// string means no rationale was supplied.
Reason string `lw:"reason,textArray"`
// contains filtered or unexported fields
}
TaskCancel is the wire payload a consumer publishes on `task.<id>.cancel`. The producer's handle subscribes to this and cancels its internal context when one arrives.
func TaskCancelReadRow ¶ added in v0.0.17
func TaskCancelReadRow[ StringArrayAttrs TaskCancelStringArrayAttrsReadI, StringArrayMembs TaskCancelStringArrayMembsReadI, TextArrayAttrs TaskCancelTextArrayAttrsReadI, TextArrayMembs TaskCancelTextArrayMembsReadI, ]( i int, stringArrayAttrs StringArrayAttrs, stringArrayMembs StringArrayMembs, textArrayAttrs TextArrayAttrs, textArrayMembs TextArrayMembs, ) (row TaskCancel, present bool, err error)
TaskCancelReadRow reads row i as one optional TaskCancel 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 TaskCancelCodec ¶
type TaskCancelCodec struct{}
TaskCancelCodec is the buscodec.CodecI bridge for TaskCancel. 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 (*TaskCancelCodec) ContentType ¶
func (inst *TaskCancelCodec) ContentType() (ct string)
func (*TaskCancelCodec) Name ¶
func (inst *TaskCancelCodec) Name() (n string)
type TaskCancelColumns ¶
type TaskCancelColumns struct {
FactId []uint64
NaturalKey [][]byte
At []time.Time
TaskId []string
Reason []string
}
TaskCancelColumns is the SoA storage for batches of TaskCancel rows. All slices grow in lockstep — Len returns the row count.
func (*TaskCancelColumns) Append ¶
func (c *TaskCancelColumns) Append(row TaskCancel)
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 (*TaskCancelColumns) Len ¶
func (c *TaskCancelColumns) Len() int
Len returns the number of rows currently in the batch.
func (*TaskCancelColumns) Marshal ¶
func (c *TaskCancelColumns) 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 TaskCancelBuildEntities — the per-row chain lives there and works against any leeway-DML class that structurally satisfies TaskCancelEntityI.
func (*TaskCancelColumns) Row ¶
func (c *TaskCancelColumns) Row(i int) (row TaskCancel)
Row reconstructs entity i as an AoS TaskCancel record. Inverse of Append: slice / pointer fields are shared by reference (no defensive copy); scalar fields and Option[T] are copied.
type TaskCancelEntityI ¶
type TaskCancelEntityI[ StringArrayAttr TaskCancelStringArrayAttrI, StringArraySec TaskCancelStringArraySecI[StringArrayAttr, Ent], TextArrayAttr TaskCancelTextArrayAttrI, TextArraySec TaskCancelTextArraySecI[TextArrayAttr, Ent], Ent any, ] interface { BeginEntity() Ent SetId(id uint64, naturalKey []byte) Ent SetTimestamp(ts time.Time) Ent GetSectionStringArray() StringArraySec GetSectionTextArray() TextArraySec CommitEntity() (err error) }
TaskCancelEntityI is the entity-builder surface TaskCancelAddSections 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 TaskCancelStringArrayAttrI ¶
type TaskCancelStringArrayAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
TaskCancelStringArrayAttrI 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 TaskCancelStringArrayAttrsReadI ¶
type TaskCancelStringArrayAttrsReadI interface {
GetAttrValueSingle(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) (string, error)
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
TaskCancelStringArrayAttrsReadI is the Attributes-side view of the stringArray section.
type TaskCancelStringArrayMembsReadI ¶
type TaskCancelStringArrayMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
TaskCancelStringArrayMembsReadI is the Memberships-side view of the stringArray section.
type TaskCancelStringArraySecI ¶
type TaskCancelStringArraySecI[Attr any, Ent any] interface { BeginAttributeSingle(value string) Attr EndSection() Ent }
TaskCancelStringArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.
type TaskCancelTextArrayAttrI ¶
type TaskCancelTextArrayAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
TaskCancelTextArrayAttrI 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 TaskCancelTextArrayAttrsReadI ¶
type TaskCancelTextArrayAttrsReadI interface {
GetAttrValueSingle(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) (string, error)
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
TaskCancelTextArrayAttrsReadI is the Attributes-side view of the textArray section.
type TaskCancelTextArrayMembsReadI ¶
type TaskCancelTextArrayMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
TaskCancelTextArrayMembsReadI is the Memberships-side view of the textArray section.
type TaskCancelTextArraySecI ¶
type TaskCancelTextArraySecI[Attr any, Ent any] interface { BeginAttributeSingle(value string) Attr EndSection() Ent }
TaskCancelTextArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.