streams

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Streams = StreamNames{}

Streams provides access to stream names

Functions

func FormatLogs

func FormatLogs(logs []TaskLogEntry) string

FormatLogs converts log entries to plain text (one line per entry). Used by filesystem and CLI for consistent output formatting.

Types

type ReadRecord

type ReadRecord struct {
	SeqNum    int64  `json:"seq_num"`
	Timestamp int64  `json:"timestamp"`
	Body      string `json:"body"` // S2 returns body as a JSON-encoded string
}

ReadRecord represents a record read from S2

type S2Client

type S2Client struct {
	// contains filtered or unexported fields
}

S2Client provides access to S2 streams for append-only log storage

func NewS2Client

func NewS2Client(config S2Config) *S2Client

NewS2Client creates a new S2 stream client

func (*S2Client) Append

func (c *S2Client) Append(ctx context.Context, stream string, data interface{}) error

Append appends a record to a stream

func (*S2Client) AppendLog

func (c *S2Client) AppendLog(ctx context.Context, taskID, stream, data string) error

AppendLog is a convenience method for appending a log entry

func (*S2Client) AppendStatus

func (c *S2Client) AppendStatus(ctx context.Context, taskID, status string, exitCode *int, errorMsg string) error

AppendStatus is a convenience method for appending a status entry

func (*S2Client) Enabled

func (c *S2Client) Enabled() bool

Enabled returns true if the S2 client is configured

func (*S2Client) Read

func (c *S2Client) Read(ctx context.Context, stream string, seqNum int64, count int) ([]ReadRecord, error)

Read reads records from a stream

func (*S2Client) ReadLogs

func (c *S2Client) ReadLogs(ctx context.Context, taskID string, seqNum int64) ([]TaskLogEntry, int64, error)

ReadLogs reads log entries for a task. Returns the logs, the next sequence number for pagination, and any error. Pass nextSeqNum to subsequent calls to fetch logs beyond the first page.

type S2Config

type S2Config struct {
	// Token is the S2 API token
	Token string

	// Basin is the S2 basin name (e.g., "airstore")
	Basin string

	// Timeout for HTTP requests
	Timeout time.Duration
}

S2Config configures the S2 stream client

type StreamNames

type StreamNames struct{}

StreamNames provides consistent stream naming

func (StreamNames) TaskLogs

func (StreamNames) TaskLogs(taskID string) string

TaskLogs returns the stream name for a task's logs

func (StreamNames) TaskStatus

func (StreamNames) TaskStatus(taskID string) string

TaskStatus returns the stream name for a task's status events

type TaskLogEntry

type TaskLogEntry struct {
	TaskID    string `json:"task_id"`
	Timestamp int64  `json:"timestamp"`
	Stream    string `json:"stream"` // "stdout" or "stderr"
	Data      string `json:"data"`
}

TaskLogEntry represents a log entry for a task

type TaskStatusEntry

type TaskStatusEntry struct {
	TaskID    string `json:"task_id"`
	Timestamp int64  `json:"timestamp"`
	Status    string `json:"status"`
	ExitCode  *int   `json:"exit_code,omitempty"`
	Error     string `json:"error,omitempty"`
}

TaskStatusEntry represents a status change for a task

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL