Documentation
¶
Overview ¶
Package workerpipe (ADR-0168): funcd's end of a worker's raw stdout and stderr, read as written into a bounded queue for funclog and a bounded tail. Both drivers use it; it imports no container or observability package.
Index ¶
Constants ¶
const ( DefaultLineBytes = 64 << 10 // a longer line is split into lines of this size DefaultQueueBytes = 256 << 10 // the queue for funclog; half of it per stream DefaultTailBytes = 64 << 10 // the tail Runtime.Logs returns )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
Options sizes an Output; a zero size is its default and a nil Logger is slog.Default().
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output holds funcd's end of one worker run's stdout and stderr.
func (*Output) Close ¶
func (o *Output) Close()
Close never blocks and is idempotent: once every Drain has returned it files the last partial lines, Warns about any drop not yet reported, and closes Done. Writes after Close are dropped and counted.
func (*Output) Done ¶
func (o *Output) Done() <-chan struct{}
Done is closed once Close ran and every Drain returned.
func (*Output) Drain ¶
func (o *Output) Drain(s Stream, r io.ReadCloser)
Drain reads r on its own goroutine until EOF or an error, then closes r. A Drain that starts after Close still runs; Done waits for every Drain.
func (*Output) Reader ¶
func (o *Output) Reader(s Stream) StreamReader
Reader returns s's "\n"-ended lines, queued from the first call; it returns EOF once the Output is closed, drained and the queue is empty.
func (*Output) Tail ¶
func (o *Output) Tail() io.ReadCloser
Tail returns a copy of the last TailBytes of output, the oldest line evicted first: stdout's lines, then stderr's.
type StreamReader ¶
type StreamReader interface {
io.ReadCloser
CloseRead() error
}
StreamReader is one stream's queued lines; CloseRead is the Shutdown seal: EOF after the queued lines.