server

package
v0.0.0-...-31e5321 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToAsciiCast

func ToAsciiCast(stdout string, writer io.Writer) error

For backward compatibility.

Types

type AsciiCastConverter

type AsciiCastConverter struct {
	// Version is the version of the asciicast format
	Version int
	// TerminalWidth is the width of the terminal in columns
	TerminalWidth int
	// TerminalHeight is the height of the terminal in rows
	TerminalHeight int
	// LinesPerChunk controls how many lines we group together in a single event
	LinesPerChunk int
	// ChunkSpeedDivisor controls how the chunk size affects timing
	ChunkSpeedDivisor float64
	// MinTimeIncrement is the minimum time between events in seconds
	MinTimeIncrement float64
	// MaxTimeIncrement is the maximum time between events in seconds
	MaxTimeIncrement float64
}

AsciiCastConverter handles the conversion of text output to asciicast format.

func NewAsciiCastConverter

func NewAsciiCastConverter() *AsciiCastConverter

NewAsciiCastConverter creates a new converter with default settings.

func (*AsciiCastConverter) ToAsciiCast

func (c *AsciiCastConverter) ToAsciiCast(stdout string, writer io.Writer) error

ToAsciiCast converts a string of stdout to asciicast format and writes it to the given writer.

type ExecutionService

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

ExecutionService manages pipeline execution with concurrency limits.

func NewExecutionService

func NewExecutionService(store storage.Driver, logger *slog.Logger, maxInFlight int) *ExecutionService

NewExecutionService creates a new execution service.

func (*ExecutionService) CanExecute

func (s *ExecutionService) CanExecute() bool

CanExecute returns true if a new pipeline can be started.

func (*ExecutionService) CurrentInFlight

func (s *ExecutionService) CurrentInFlight() int

CurrentInFlight returns the number of currently running pipelines.

func (*ExecutionService) MaxInFlight

func (s *ExecutionService) MaxInFlight() int

MaxInFlight returns the maximum number of concurrent pipelines allowed.

func (*ExecutionService) TriggerPipeline

func (s *ExecutionService) TriggerPipeline(ctx context.Context, pipeline *storage.Pipeline) (*storage.PipelineRun, error)

TriggerPipeline starts a new pipeline execution asynchronously. It creates a run record, starts a goroutine to execute the pipeline, and returns the run ID immediately.

func (*ExecutionService) Wait

func (s *ExecutionService) Wait()

Wait blocks until all in-flight pipeline executions have completed. This is useful for graceful shutdown or testing.

type PipelineRequest

type PipelineRequest struct {
	Name      string `json:"name"`
	Content   string `json:"content"`
	DriverDSN string `json:"driver_dsn"`
}

PipelineRequest represents the JSON body for creating a pipeline.

type Router

type Router struct {
	*echo.Echo
	// contains filtered or unexported fields
}

Router wraps echo.Echo and provides access to the execution service.

func NewRouter

func NewRouter(logger *slog.Logger, store storage.Driver, opts RouterOptions) (*Router, error)

func (*Router) ExecutionService

func (r *Router) ExecutionService() *ExecutionService

ExecutionService returns the execution service for testing purposes.

func (*Router) WaitForExecutions

func (r *Router) WaitForExecutions()

WaitForExecutions blocks until all in-flight pipeline executions have completed. This is useful for graceful shutdown or testing.

type RouterOptions

type RouterOptions struct {
	MaxInFlight int
}

RouterOptions configures the router.

type TemplateRender

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

func (*TemplateRender) Render

func (t *TemplateRender) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Jump to

Keyboard shortcuts

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