console

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) (http.Handler, error)

Types

type AuditView

type AuditView struct {
	ID        int64             `json:"id"`
	Actor     string            `json:"actor"`
	Action    string            `json:"action"`
	Target    string            `json:"target"`
	Project   string            `json:"project"`
	Metadata  map[string]string `json:"metadata"`
	CreatedAt time.Time         `json:"createdAt"`
}

type CacheView

type CacheView struct {
	Name   string `json:"name"`
	Target string `json:"target"`
}

type ClockView

type ClockView struct {
	Now time.Time `json:"now"`
}

type Config

type Config struct {
	Source        Source
	ClockInterval time.Duration
	Now           func() time.Time
}

type LogView

type LogView struct {
	Available bool   `json:"available"`
	Truncated bool   `json:"truncated"`
	Content   string `json:"content"`
}

type OperationDetailView

type OperationDetailView struct {
	OperationView
	WorkingDirectory string            `json:"workingDirectory"`
	Environment      map[string]string `json:"environment"`
	Caches           []CacheView       `json:"caches"`
	RootDigest       string            `json:"rootDigest"`
	Error            string            `json:"error"`
}

type OperationResourceView

type OperationResourceView struct {
	SampleCount     int     `json:"sampleCount"`
	CPUAverage      float64 `json:"cpuAverage"`
	CPUPeak         float64 `json:"cpuPeak"`
	MemoryAverage   float64 `json:"memoryAverage"`
	MemoryPeak      float64 `json:"memoryPeak"`
	MemoryBytesPeak uint64  `json:"memoryBytesPeak"`
}

type OperationView

type OperationView struct {
	Kind            string                `json:"kind"`
	ID              string                `json:"id"`
	Project         string                `json:"project"`
	ProjectName     string                `json:"projectName"`
	Status          string                `json:"status"`
	Command         string                `json:"command"`
	Image           string                `json:"image"`
	CreatedAt       time.Time             `json:"createdAt"`
	StartedAt       *time.Time            `json:"startedAt"`
	FinishedAt      *time.Time            `json:"finishedAt"`
	ExitCode        *int                  `json:"exitCode"`
	QueueWaitMillis *int64                `json:"queueWaitMillis"`
	Resources       OperationResourceView `json:"resources"`
}

type ProjectView

type ProjectView struct {
	ID                  string `json:"id"`
	Slug                string `json:"slug"`
	Name                string `json:"name"`
	ActiveImage         string `json:"activeImage"`
	AllowImageOverrides bool   `json:"allowImageOverrides"`
	Members             int    `json:"members"`
	Trusts              int    `json:"trusts"`
}

type QueueView

type QueueView struct {
	Position    int        `json:"position"`
	Kind        string     `json:"kind"`
	ID          string     `json:"id"`
	Project     string     `json:"project"`
	ProjectName string     `json:"projectName"`
	Status      string     `json:"status"`
	AcceptedAt  time.Time  `json:"acceptedAt"`
	LeasedAt    *time.Time `json:"leasedAt"`
}

type ResourceSampleView

type ResourceSampleView struct {
	ObservedAt        time.Time `json:"observedAt"`
	CPUUtilization    float64   `json:"cpuUtilization"`
	MemoryUtilization float64   `json:"memoryUtilization"`
}

type ResourceView

type ResourceView struct {
	Samples            []ResourceSampleView `json:"samples"`
	SampleCount        int                  `json:"sampleCount"`
	ActiveSampleCount  int                  `json:"activeSampleCount"`
	CPUCores           int                  `json:"cpuCores"`
	MemoryTotalBytes   uint64               `json:"memoryTotalBytes"`
	DiskUsageBytes     uint64               `json:"diskUsageBytes"`
	DiskTotalBytes     uint64               `json:"diskTotalBytes"`
	BusyRatio          float64              `json:"busyRatio"`
	CPUAverage         float64              `json:"cpuAverage"`
	CPUPeak            float64              `json:"cpuPeak"`
	MemoryAverage      float64              `json:"memoryAverage"`
	MemoryPeak         float64              `json:"memoryPeak"`
	MemoryBytesPeak    uint64               `json:"memoryBytesPeak"`
	QueueWaitP95Millis int64                `json:"queueWaitP95Millis"`
}

ResourceView describes the shared runner capacity for the selected route. Samples are intentionally bounded and normalized so the browser only renders an authorized read model, never raw host or database state.

type Route

type Route struct {
	Kind          RouteKind
	Project       string
	OperationKind string
	OperationID   string
}

type RouteKind

type RouteKind string
const (
	RouteOverview  RouteKind = "overview"
	RouteProject   RouteKind = "project"
	RouteOperation RouteKind = "operation"
	RouteAudit     RouteKind = "audit"
)

type SQLiteSource

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

func NewSQLiteSource

func NewSQLiteSource(config SQLiteSourceConfig) (*SQLiteSource, error)

func (*SQLiteSource) Authenticate

func (s *SQLiteSource) Authenticate(ctx context.Context, token string) (control.Principal, error)

func (*SQLiteSource) Authorize

func (s *SQLiteSource) Authorize(ctx context.Context, principal control.Principal, route Route) error

func (*SQLiteSource) Snapshot

func (s *SQLiteSource) Snapshot(ctx context.Context, principal control.Principal, route Route) (Snapshot, error)

func (*SQLiteSource) SubscribeChanges

func (s *SQLiteSource) SubscribeChanges() (<-chan struct{}, func())

func (*SQLiteSource) SubscribeLog

func (s *SQLiteSource) SubscribeLog(ctx context.Context, principal control.Principal, route Route) (<-chan LogView, error)

SubscribeLog returns a bounded live tail for an authorized job detail route. Other routes have no log stream and receive an already-closed channel.

type SQLiteSourceConfig

type SQLiteSourceConfig struct {
	Store     *controlsqlite.Store
	Scheduler control.Scheduler
	Version   string
	StartedAt time.Time
}

type ServiceView

type ServiceView struct {
	Name      string    `json:"name"`
	Version   string    `json:"version"`
	Control   string    `json:"control"`
	Admission string    `json:"admission"`
	StartedAt time.Time `json:"startedAt"`
}

type SessionView

type SessionView struct {
	User     string        `json:"user"`
	Admin    bool          `json:"admin"`
	Projects []ProjectView `json:"projects"`
}

type Snapshot

type Snapshot struct {
	Revision   int64
	Session    SessionView
	Service    ServiceView
	Worker     WorkerView
	Clock      ClockView
	Resources  ResourceView
	Queue      []QueueView
	Operations []OperationView
	Operation  *OperationDetailView
	Log        LogView
	Audit      []AuditView
	Status     StatusView
}

type Source

type Source interface {
	Authenticate(context.Context, string) (control.Principal, error)
	Authorize(context.Context, control.Principal, Route) error
	Snapshot(context.Context, control.Principal, Route) (Snapshot, error)
	SubscribeChanges() (<-chan struct{}, func())
	SubscribeLog(context.Context, control.Principal, Route) (<-chan LogView, error)
}

type StatusView

type StatusView struct {
	Ready     bool      `json:"ready"`
	Route     string    `json:"route"`
	Message   string    `json:"message"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type WorkerView

type WorkerView struct {
	Status    string    `json:"status"`
	Capacity  string    `json:"capacity"`
	ActiveID  string    `json:"activeId"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Directories

Path Synopsis
cmd
contracts command

Jump to

Keyboard shortcuts

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