registry

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package registry provides functionality for managing running service registrations. NOTE: This package uses in-memory storage only. No files are persisted. Service state is transient and only valid while the dashboard/orchestrator is running.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceRegistry

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

ServiceRegistry manages the registry of running services for a project. NOTE: This is an in-memory only registry. No files are persisted.

func GetRegistry

func GetRegistry(projectDir string) *ServiceRegistry

GetRegistry returns the service registry instance for the given project directory. If projectDir is empty, uses current working directory. NOTE: Registry is in-memory only. No files are persisted or loaded.

func (*ServiceRegistry) Clear

func (r *ServiceRegistry) Clear() error

Clear removes all entries from the registry. NOTE: In-memory only, no file persistence.

func (*ServiceRegistry) GetService

func (r *ServiceRegistry) GetService(serviceName string) (*ServiceRegistryEntry, bool)

GetService retrieves a service entry. Returns a copy of the entry to prevent race conditions on concurrent access.

func (*ServiceRegistry) ListAll

func (r *ServiceRegistry) ListAll() []*ServiceRegistryEntry

ListAll returns all registered services. Returns copies of the entries to prevent race conditions on concurrent access.

func (*ServiceRegistry) Register

func (r *ServiceRegistry) Register(entry *ServiceRegistryEntry) error

Register adds a service to the registry. NOTE: In-memory only, no file persistence.

func (*ServiceRegistry) Unregister

func (r *ServiceRegistry) Unregister(serviceName string) error

Unregister removes a service from the registry. NOTE: In-memory only, no file persistence.

func (*ServiceRegistry) UpdateExitInfo

func (r *ServiceRegistry) UpdateExitInfo(serviceName string, exitCode int, endTime time.Time) error

UpdateExitInfo updates the exit code and end time for a completed service. This is used for build/task mode services that complete and exit.

func (*ServiceRegistry) UpdateStatus

func (r *ServiceRegistry) UpdateStatus(serviceName, status string) error

UpdateStatus updates the lifecycle status of a service. NOTE: Health is not stored in registry - it is computed dynamically via health checks.

type ServiceRegistryEntry

type ServiceRegistryEntry struct {
	Name        string    `json:"name"`
	ProjectDir  string    `json:"projectDir"`
	PID         int       `json:"pid"`
	Port        int       `json:"port"`
	URL         string    `json:"url"`
	AzureURL    string    `json:"azureUrl,omitempty"`
	Language    string    `json:"language"`
	Framework   string    `json:"framework"`
	Status      string    `json:"status"` // "starting", "ready", "stopping", "stopped", "error", "building", "built", "completed", "failed", "watching"
	StartTime   time.Time `json:"startTime"`
	LastChecked time.Time `json:"lastChecked"`
	Error       string    `json:"error,omitempty"`
	Type        string    `json:"type,omitempty"`     // "http", "tcp", "process"
	Mode        string    `json:"mode,omitempty"`     // "watch", "build", "daemon", "task" (for type=process)
	ExitCode    *int      `json:"exitCode,omitempty"` // Exit code for completed build/task mode services (nil = still running)
	EndTime     time.Time `json:"endTime,omitempty"`  // When the process exited (for build/task modes)
}

ServiceRegistryEntry represents a running service in the registry. NOTE: Health status is NOT stored here - it is computed dynamically via health checks. This prevents stale cached health data from causing issues with the dashboard.

Jump to

Keyboard shortcuts

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