Documentation
¶
Overview ¶
Package logstream reads task logs without retaining the file in memory.
Index ¶
Constants ¶
View Source
const ( DefaultPageBytes = 64 << 10 MaxPageBytes = 1 << 20 )
View Source
const ( // MaxLineBytes matches the process-output bound. Oversized evidence is an // explicit error rather than a silently truncated log line. MaxLineBytes = 4 * 1024 * 1024 )
Variables ¶
View Source
var ( ErrInvalidCursor = errors.New("invalid log cursor or cursor selection mismatch") ErrInvalidPageSize = errors.New("log page size must be between 4 and 1048576 bytes") ErrLogResetRequired = errors.New("log was replaced or truncated; start a new read without the cursor") ErrInvalidUTF8 = errors.New("log contains invalid UTF-8; inspect the log file directly") )
Functions ¶
Types ¶
type LogIdentity ¶
type LogIdentity struct {
InstanceID string `json:"instanceId"`
RunID string `json:"runId"`
Task string `json:"task"`
AttemptID string `json:"attemptId"`
}
func CursorIdentity ¶
func CursorIdentity(token string) (LogIdentity, error)
CursorIdentity lets callers resolve retained evidence before touching a log. A cursor selects an attempt; it never authorizes a filesystem path.
type Page ¶
type Page struct {
LogIdentity
Text string `json:"text"`
StartOffset int64 `json:"startOffset"`
EndOffset int64 `json:"endOffset"`
NextCursor string `json:"nextCursor"`
AtEnd bool `json:"atEnd"`
PendingBytes int `json:"pendingBytes"`
}
func ReadPage ¶
func ReadPage(ctx context.Context, path string, identity LogIdentity, token string, limit int, terminal bool) (Page, error)
ReadPage preserves byte offsets and partial lines without splitting UTF-8. An incomplete final rune waits at its original offset while an attempt runs; terminal evidence reports malformed text explicitly instead of polling forever.
Click to show internal directories.
Click to hide internal directories.