store

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverAdapters

func DiscoverAdapters(baseDir, sessionID, selfAdapter string) []string

DiscoverAdapters returns all registered adapter names for a session. It scans baseDir/<sessionID>/ for subdirectories and always includes selfAdapter.

func EnsureAdapterDir

func EnsureAdapterDir(baseDir, sessionID, adapter string) error

EnsureAdapterDir creates the adapter directory for a given session, registering the adapter so writers can discover it via DiscoverAdapters.

Types

type LogMessage

type LogMessage struct {
	Timestamp time.Time `json:"ts"`
	Tag       string    `json:"tag"`
	Stream    string    `json:"stream"` // "stdout" | "stderr"
	Lines     []string  `json:"lines"`
	ExitCode  *int      `json:"exit_code,omitempty"`
	Adapter   string    `json:"adapter,omitempty"`
	Host      string    `json:"host,omitempty"`
}

LogMessage represents a captured log entry from a subprocess.

type RetryTracker

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

RetryTracker manages auto-loop retry counts per session.

func NewRetryTracker

func NewRetryTracker(baseDir string) *RetryTracker

NewRetryTracker creates a new retry tracker rooted at baseDir.

func (*RetryTracker) Get

func (r *RetryTracker) Get(sessionID string) (int, error)

Get returns the current retry count for a session.

func (*RetryTracker) Increment

func (r *RetryTracker) Increment(sessionID string) (int, error)

Increment increments and returns the new retry count.

func (*RetryTracker) Reset

func (r *RetryTracker) Reset(sessionID string) error

Reset resets the retry count for a session.

type Store

type Store interface {
	// Write appends a log message to the pending queue for a session.
	Write(sessionID string, msg LogMessage) error

	// Drain reads and consumes all pending messages for a session since last drain.
	Drain(sessionID string, maxLines int) ([]LogMessage, error)

	// Status returns pending message counts per session.
	Status() (map[string]int, error)

	// Close releases any resources held by the store.
	Close() error
}

Store abstracts the log storage and retrieval mechanism.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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