Let a module read its own streams back by a batch direct get, as it reads its log, so its tools can answer what the stream holds (a build step's whole failure output)

This commit is contained in:
2026-10-30 10:54:05 +01:00
parent 95a12105cf
commit b90376ba59
7 changed files with 255 additions and 39 deletions
+20
View File
@@ -988,6 +988,26 @@ func (b *moduleBus) Log(verb string, params json.RawMessage) (json.RawMessage, e
return json.Marshal(answer)
}
// StreamRead answers a bundle's read of one of its module's own streams (ADR 0363): {stream, subject, from, limit}, the
// stream by its local name, the subject an event pattern. The runtime refuses, with the reason, a stream the module's
// membership does not name.
func (b *moduleBus) StreamRead(params json.RawMessage) (json.RawMessage, error) {
var asked struct {
Stream string `json:"stream"`
Subject string `json:"subject"`
From uint64 `json:"from"`
Limit int `json:"limit"`
}
if err := json.Unmarshal(params, &asked); err != nil || asked.Stream == "" {
return nil, fmt.Errorf("mesh/stream.read names no stream: {stream, subject, from, limit}")
}
page, err := b.all.conn.StreamRead(b.module, asked.Stream, asked.Subject, asked.From, asked.Limit)
if err != nil {
return nil, err
}
return json.Marshal(page)
}
// Watch hands a bundle its module's state as it is and as it changes (ADR 0201): `{state, key}`, the
// key a pattern with `*` and `**`, empty for every key.
func (b *moduleBus) Watch(params json.RawMessage, deliver func(json.RawMessage) error) (func(), error) {