Documentation
¶
Overview ¶
Package watchreply is the leeway-coded wire form of the watch-reply payload on `fs.handle.{uuid}.watch`.
Vocabulary:
- vdd.MembWatchStarted — narrow bool. False either on a broker-side error (Reason populated) or when the handle already has an active watch.
- vdd.MembWatchEventSubject — narrow string; the subject events publish to on success.
- vdd.MembWatchBackend — narrow symbol; the watcher implementation that was selected ("inotify" / "poller").
- vdd.MembReason — shared, populated on failure.
Index ¶
- Variables
- func WatchReplyBuildEntities[BoolAttr WatchReplyBoolAttrI, BoolSec WatchReplyBoolSecI[BoolAttr, Ent], ...](dml DML, c *WatchReplyColumns) (err error)
- func WatchReplyFillFromArrow[BoolAttrs WatchReplyBoolAttrsReadI, BoolMembs WatchReplyBoolMembsReadI, ...](c *WatchReplyColumns, n int, idCol *array.Uint64, nkCol *array.Binary, ...) (err error)
- type WatchReply
- type WatchReplyBoolAttrI
- type WatchReplyBoolAttrsReadI
- type WatchReplyBoolMembsReadI
- type WatchReplyBoolSecI
- type WatchReplyCodec
- type WatchReplyColumns
- type WatchReplyEntityI
- type WatchReplyStringArrayAttrI
- type WatchReplyStringArrayAttrsReadI
- type WatchReplyStringArrayMembsReadI
- type WatchReplyStringArraySecI
- type WatchReplySymbolAttrI
- type WatchReplySymbolAttrsReadI
- type WatchReplySymbolMembsReadI
- type WatchReplySymbolSecI
- type WatchReplyTextArrayAttrI
- type WatchReplyTextArrayAttrsReadI
- type WatchReplyTextArrayMembsReadI
- type WatchReplyTextArraySecI
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 `wasmsurvey props generate`; curate by hand, then `wasmsurvey props verify`.
var WatchReplyActiveFields = sync.OnceValue(func() []int { active := map[string]bool{"bool": true, "stringArray": 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 })
WatchReplyActiveFields is the column-index subset this kind populates in the runtime.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 WatchReplyActiveSections = []int{1, 9, 10, 12}
WatchReplyActiveSections 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 WatchReplyBuildEntities ¶
func WatchReplyBuildEntities[ BoolAttr WatchReplyBoolAttrI, BoolSec WatchReplyBoolSecI[BoolAttr, Ent], StringArrayAttr WatchReplyStringArrayAttrI, StringArraySec WatchReplyStringArraySecI[StringArrayAttr, Ent], SymbolAttr WatchReplySymbolAttrI, SymbolSec WatchReplySymbolSecI[SymbolAttr, Ent], TextArrayAttr WatchReplyTextArrayAttrI, TextArraySec WatchReplyTextArraySecI[TextArrayAttr, Ent], Ent any, DML WatchReplyEntityI[ BoolAttr, BoolSec, StringArrayAttr, StringArraySec, SymbolAttr, SymbolSec, TextArrayAttr, TextArraySec, Ent, ], ](dml DML, c *WatchReplyColumns) (err error)
WatchReplyBuildEntities 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 WatchReplyFillFromArrow ¶
func WatchReplyFillFromArrow[ BoolAttrs WatchReplyBoolAttrsReadI, BoolMembs WatchReplyBoolMembsReadI, StringArrayAttrs WatchReplyStringArrayAttrsReadI, StringArrayMembs WatchReplyStringArrayMembsReadI, SymbolAttrs WatchReplySymbolAttrsReadI, SymbolMembs WatchReplySymbolMembsReadI, TextArrayAttrs WatchReplyTextArrayAttrsReadI, TextArrayMembs WatchReplyTextArrayMembsReadI, ]( c *WatchReplyColumns, n int, idCol *array.Uint64, nkCol *array.Binary, tsCol *array.Timestamp, boolAttrs BoolAttrs, boolMembs BoolMembs, stringArrayAttrs StringArrayAttrs, stringArrayMembs StringArrayMembs, symbolAttrs SymbolAttrs, symbolMembs SymbolMembs, textArrayAttrs TextArrayAttrs, textArrayMembs TextArrayMembs, ) (err error)
WatchReplyFillFromArrow 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 WatchReply ¶
type WatchReply struct {
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"`
// Started signals whether the watch actually started.
Started bool `lw:"watchStarted,bool"`
// EventSubject is the subject events publish to on success.
EventSubject string `lw:"watchEventSubject,stringArray"`
// Backend names the watcher implementation that was selected.
Backend string `lw:"watchBackend,symbol"`
// Reason carries the failure rationale (empty on success).
Reason string `lw:"reason,textArray"`
// contains filtered or unexported fields
}
WatchReply is the flat wire form of a watch reply.
type WatchReplyBoolAttrI ¶
type WatchReplyBoolAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
WatchReplyBoolAttrI 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 WatchReplyBoolAttrsReadI ¶
type WatchReplyBoolAttrsReadI interface {
GetAttrValueValue(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) bool
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
WatchReplyBoolAttrsReadI is the Attributes-side view of the bool section.
type WatchReplyBoolMembsReadI ¶
type WatchReplyBoolMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
WatchReplyBoolMembsReadI is the Memberships-side view of the bool section.
type WatchReplyBoolSecI ¶
type WatchReplyBoolSecI[Attr any, Ent any] interface { BeginAttribute(value bool) Attr EndSection() Ent }
WatchReplyBoolSecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.
type WatchReplyCodec ¶
type WatchReplyCodec struct{}
WatchReplyCodec is the buscodec.CodecI bridge for WatchReply. 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 (*WatchReplyCodec) ContentType ¶
func (inst *WatchReplyCodec) ContentType() (ct string)
func (*WatchReplyCodec) Name ¶
func (inst *WatchReplyCodec) Name() (n string)
type WatchReplyColumns ¶
type WatchReplyColumns struct {
FactId []uint64
NaturalKey [][]byte
At []time.Time
Started []bool
EventSubject []string
Backend []string
Reason []string
}
WatchReplyColumns is the SoA storage for batches of WatchReply rows. All slices grow in lockstep — Len returns the row count.
func (*WatchReplyColumns) Append ¶
func (c *WatchReplyColumns) Append(row WatchReply)
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 (*WatchReplyColumns) Len ¶
func (c *WatchReplyColumns) Len() int
Len returns the number of rows currently in the batch.
func (*WatchReplyColumns) Marshal ¶
func (c *WatchReplyColumns) 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 WatchReplyBuildEntities — the per-row chain lives there and works against any leeway-DML class that structurally satisfies WatchReplyEntityI.
func (*WatchReplyColumns) Row ¶
func (c *WatchReplyColumns) Row(i int) (row WatchReply)
Row reconstructs entity i as an AoS WatchReply record. Inverse of Append: slice / pointer fields are shared by reference (no defensive copy); scalar fields and Option[T] are copied.
type WatchReplyEntityI ¶
type WatchReplyEntityI[ BoolAttr WatchReplyBoolAttrI, BoolSec WatchReplyBoolSecI[BoolAttr, Ent], StringArrayAttr WatchReplyStringArrayAttrI, StringArraySec WatchReplyStringArraySecI[StringArrayAttr, Ent], SymbolAttr WatchReplySymbolAttrI, SymbolSec WatchReplySymbolSecI[SymbolAttr, Ent], TextArrayAttr WatchReplyTextArrayAttrI, TextArraySec WatchReplyTextArraySecI[TextArrayAttr, Ent], Ent any, ] interface { BeginEntity() Ent SetId(id uint64, naturalKey []byte) Ent SetTimestamp(ts time.Time) Ent GetSectionBool() BoolSec GetSectionStringArray() StringArraySec GetSectionSymbol() SymbolSec GetSectionTextArray() TextArraySec CommitEntity() (err error) }
WatchReplyEntityI lists exactly the entity-level methods WatchReply uses. Type parameters compose the per-section Attr + Sec interfaces; Ent is the entity type itself (return type of BeginEntity / SetId / SetTimestamp / SetLifecycle — usually the DML pointer).
type WatchReplyStringArrayAttrI ¶
type WatchReplyStringArrayAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
WatchReplyStringArrayAttrI 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 WatchReplyStringArrayAttrsReadI ¶
type WatchReplyStringArrayAttrsReadI interface {
GetAttrValueSingleOrDefault(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) string
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
WatchReplyStringArrayAttrsReadI is the Attributes-side view of the stringArray section.
type WatchReplyStringArrayMembsReadI ¶
type WatchReplyStringArrayMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
WatchReplyStringArrayMembsReadI is the Memberships-side view of the stringArray section.
type WatchReplyStringArraySecI ¶
type WatchReplyStringArraySecI[Attr any, Ent any] interface { BeginAttributeSingle(value string) Attr EndSection() Ent }
WatchReplyStringArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.
type WatchReplySymbolAttrI ¶
type WatchReplySymbolAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
WatchReplySymbolAttrI 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 WatchReplySymbolAttrsReadI ¶
type WatchReplySymbolAttrsReadI interface {
GetAttrValueValue(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) string
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
WatchReplySymbolAttrsReadI is the Attributes-side view of the symbol section.
type WatchReplySymbolMembsReadI ¶
type WatchReplySymbolMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
WatchReplySymbolMembsReadI is the Memberships-side view of the symbol section.
type WatchReplySymbolSecI ¶
type WatchReplySymbolSecI[Attr any, Ent any] interface { BeginAttribute(value string) Attr EndSection() Ent }
WatchReplySymbolSecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.
type WatchReplyTextArrayAttrI ¶
type WatchReplyTextArrayAttrI interface {
dmlruntime.InAttributeMembershipLowCardRefPI
EndAttributeP()
}
WatchReplyTextArrayAttrI 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 WatchReplyTextArrayAttrsReadI ¶
type WatchReplyTextArrayAttrsReadI interface {
GetAttrValueSingleOrDefault(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) string
GetNumberOfAttributes(entityIdx raruntime.EntityIdx) int64
}
WatchReplyTextArrayAttrsReadI is the Attributes-side view of the textArray section.
type WatchReplyTextArrayMembsReadI ¶
type WatchReplyTextArrayMembsReadI interface {
GetMembValueLowCardRef(entityIdx raruntime.EntityIdx, attrIdx raruntime.AttributeIdx) iter.Seq[uint64]
}
WatchReplyTextArrayMembsReadI is the Memberships-side view of the textArray section.
type WatchReplyTextArraySecI ¶
type WatchReplyTextArraySecI[Attr any, Ent any] interface { BeginAttributeSingle(value string) Attr EndSection() Ent }
WatchReplyTextArraySecI is the Section-side view: opens an attribute and closes the section. Attr and Ent are bound at the call site by inference.