server

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedStoreType = errors.New("unsupported state store type")
	ErrStoreValidation      = errors.New("invalid store request")
	// ErrActiveStore rejects deleting the elected active store (mapped to 409).
	ErrActiveStore = errors.New("cannot remove the active workflow state store")
)

ErrUnsupportedStoreType / ErrStoreValidation map validation failures to 400.

Functions

func NewRouter

func NewRouter(opts Options) http.Handler

NewRouter wires the API and the embedded SPA under the optional base path.

func SPAHandler

func SPAHandler(fsys fs.FS, basePath string, telemetryEnabled bool) http.Handler

SPAHandler serves static assets from fsys and falls back to index.html for unknown paths so client-side (History-API) routing works. basePath is the optional subpath the app is mounted under ("" for root). telemetryEnabled is injected into the served index.html as window.__DASH_TELEMETRY_ENABLED__ so the front-end knows whether to load Datadog RUM.

Types

type ActorRow

type ActorRow struct {
	AppID     string `json:"appId"`
	Type      string `json:"type"`
	Count     int    `json:"count"`
	Placement string `json:"placement,omitempty"`
}

ActorRow is a single actor-type entry returned by GET /api/actors.

type Options

type Options struct {
	BasePath string // "" or e.g. "/dashboard"
	DistFS   fs.FS  // embedded SPA assets (contains index.html)
	Version  version.Info
	Apps     discovery.Service
	// ContainerLogs streams container logs for compose-discovered apps.
	// nil disables container log streaming (404 for those apps).
	ContainerLogs func(ctx context.Context, containerID string) (<-chan string, error)
	Backend       WorkflowBackend
	Stores        StoreRegistry
	Resources     resources.Service
	News          news.Service
	ControlPlane  controlplane.Manager
	// TelemetryEnabled controls whether the served SPA loads Datadog RUM.
	TelemetryEnabled bool
}

Options configures the HTTP router.

type Server

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

Server owns the http.Server lifecycle.

func New

func New(addr string, opts Options) *Server

New builds a Server listening on addr.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully stops the server.

func (*Server) Start

func (s *Server) Start() error

Start blocks serving until the server is shut down.

type StoreInfo

type StoreInfo struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	Type       string    `json:"type"`
	Source     string    `json:"source"` // "auto" | "manual"
	Path       string    `json:"path"`
	Active     bool      `json:"active"`
	Connection string    `json:"connection"` // secrets-free host/db summary for display
	UpdatedAt  time.Time `json:"updatedAt"`  // last added/updated; drives panel recency order
}

StoreInfo describes one registry connection. ID is the stable, URL-safe key the API/selection address it by; Name is the human-facing label.

type StoreRegistry

type StoreRegistry interface {
	Stores() []StoreInfo
	AddStore(name, typ string, metadata map[string]string) error
	UpdateStore(id, name, typ string, metadata map[string]string) (string, error)
	DeleteStore(id string) error
}

StoreRegistry exposes the persisted connection registry to the API: listing all entries and adding/updating/deleting manual connections.

type SubscriptionRow

type SubscriptionRow struct {
	AppID           string              `json:"appId"`
	PubsubName      string              `json:"pubsubName"`
	Topic           string              `json:"topic"`
	Rules           []discovery.SubRule `json:"rules,omitempty"`
	DeadLetterTopic string              `json:"deadLetterTopic,omitempty"`
	Type            string              `json:"type,omitempty"`
}

SubscriptionRow is a single subscription entry returned by GET /api/subscriptions.

type TargetResolver

type TargetResolver interface {
	Resolve(ctx context.Context, appID, instanceID string) (workflow.RemoveTarget, error)
}

TargetResolver resolves an (appID, instanceID) pair into a RemoveTarget. Implemented in cmd (Task 13) by combining discovery.Service + workflow.Service.

type WorkflowBackend

type WorkflowBackend interface {
	ServiceFor(store string) (svc workflow.Service, rem WorkflowRemover, targets TargetResolver, ok bool)
}

WorkflowBackend selects the workflow service/remover/resolver for a named state store. An empty name selects the active store; ok=false means the named store is unknown.

type WorkflowRemover

type WorkflowRemover interface {
	RemoveMany(ctx context.Context, targets []workflow.RemoveTarget, force bool) []workflow.RemoveResult
}

WorkflowRemover is the removal surface the API needs (impl: *workflow.Remover).

Jump to

Keyboard shortcuts

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