Documentation
¶
Index ¶
- func ResolveDependencies(services map[string]config.Service, requestedServices []string) ([]string, error)
- type DependencyGraph
- type HealthStatus
- type Orchestrator
- func (o *Orchestrator) AddService(name string, cfg config.Service)
- func (o *Orchestrator) GetService(name string) (*Service, bool)
- func (o *Orchestrator) StartServicesInOrder(ctx context.Context, orderedServiceNames []string, cfg *config.Config) error
- func (o *Orchestrator) StopAll(ctx context.Context) error
- type Service
- func (s *Service) CheckHealth(ctx context.Context) error
- func (s *Service) GetContainerID() string
- func (s *Service) GetHealthStatus() HealthStatus
- func (s *Service) GetLastError() error
- func (s *Service) GetStartedAt() time.Time
- func (s *Service) GetState() State
- func (s *Service) GetUptime() time.Duration
- func (s *Service) IsHealthy() bool
- func (s *Service) IsRunning() bool
- func (s *Service) Restart(ctx context.Context, client *docker.Client, networkID string) error
- func (s *Service) Start(ctx context.Context, client *docker.Client, networkID string) error
- func (s *Service) Stop(ctx context.Context, client *docker.Client) error
- func (s *Service) String() string
- func (s *Service) WasAlreadyRunning() bool
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveDependencies ¶
func ResolveDependencies(services map[string]config.Service, requestedServices []string) ([]string, error)
ResolveDependencies resolves service dependencies and returns them in start order Returns a list of service names in the order they should be started Detects circular dependencies and returns an error if found
Types ¶
type DependencyGraph ¶
type DependencyGraph struct {
// contains filtered or unexported fields
}
DependencyGraph represents the service dependency relationships
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the health status of a service
const ( HealthUnknown HealthStatus = "unknown" // Health status not yet determined HealthHealthy HealthStatus = "healthy" // Service is healthy HealthUnhealthy HealthStatus = "unhealthy" // Service is unhealthy HealthStarting HealthStatus = "starting" // Service is starting (health check has not run yet) )
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
Orchestrator manages the lifecycle of multiple services with parallel execution
func NewOrchestrator ¶
func NewOrchestrator(projectName string, dockerClient *docker.Client, networkID string) *Orchestrator
NewOrchestrator creates a new service orchestrator
func (*Orchestrator) AddService ¶
func (o *Orchestrator) AddService(name string, cfg config.Service)
AddService adds a service to the orchestrator
func (*Orchestrator) GetService ¶
func (o *Orchestrator) GetService(name string) (*Service, bool)
GetService returns a service by name
func (*Orchestrator) StartServicesInOrder ¶
func (o *Orchestrator) StartServicesInOrder(ctx context.Context, orderedServiceNames []string, cfg *config.Config) error
StartServicesInOrder starts services in dependency order with parallel execution Services at the same dependency level are started in parallel Returns an error if any service fails, rolling back successfully started services
type Service ¶
type Service struct {
// Service identification
Name string // Service name (e.g., "frontend", "api")
ProjectName string // Project this service belongs to
Config config.Service // Service configuration from ork.yml
// contains filtered or unexported fields
}
Service represents a runtime service instance with state tracking
func (*Service) CheckHealth ¶
CheckHealth performs a health check on the service
func (*Service) GetContainerID ¶
GetContainerID returns the container ID
func (*Service) GetHealthStatus ¶
func (s *Service) GetHealthStatus() HealthStatus
GetHealthStatus returns the current health status
func (*Service) GetLastError ¶
GetLastError returns the last error encountered
func (*Service) GetStartedAt ¶
GetStartedAt returns when the service was started
func (*Service) WasAlreadyRunning ¶ added in v0.2.0
WasAlreadyRunning returns true if the service was found already running (not newly started)
type State ¶
type State string
State represents the current state of a service
const ( StatePending State = "pending" // Service not yet started StateStarting State = "starting" // Service is being started StateRunning State = "running" // Service is running StateStopping State = "stopping" // Service is being stopped StateStopped State = "stopped" // Service has been stopped StateFailed State = "failed" // Service failed to start or crashed )