Documentation
¶
Index ¶
- type Environment
- type EnvironmentInfo
- type MaintenanceManager
- func (m *MaintenanceManager) Disable() MaintenanceState
- func (m *MaintenanceManager) Enable(reason string, estimatedDuration time.Duration) MaintenanceState
- func (m *MaintenanceManager) GetState() MaintenanceState
- func (m *MaintenanceManager) IsEnabled() bool
- func (m *MaintenanceManager) SetOnChange(fn func(state MaintenanceState))
- func (m *MaintenanceManager) UpdateEstimatedEnd(end time.Time) MaintenanceState
- func (m *MaintenanceManager) UpdateReason(reason string) MaintenanceState
- type MaintenanceState
- type Warning
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment struct {
IsContainer bool `json:"isContainer"`
IsKubernetes bool `json:"isKubernetes"`
InstanceID string `json:"instanceId"`
}
Environment contains detected environment information.
func DetectEnvironment ¶
func DetectEnvironment() *Environment
DetectEnvironment detects the current runtime environment. Results are cached for the lifetime of the process.
type EnvironmentInfo ¶
type EnvironmentInfo struct {
Environment Environment `json:"environment"`
Warnings []Warning `json:"warnings"`
}
EnvironmentInfo holds environment detection results and warnings.
func GetEnvironmentInfo ¶
func GetEnvironmentInfo(dbDriver string) *EnvironmentInfo
GetEnvironmentInfo returns complete environment information including warnings.
type MaintenanceManager ¶
type MaintenanceManager struct {
// contains filtered or unexported fields
}
MaintenanceManager manages the maintenance mode state.
func NewMaintenanceManager ¶
func NewMaintenanceManager() *MaintenanceManager
NewMaintenanceManager creates a new maintenance manager.
func (*MaintenanceManager) Disable ¶
func (m *MaintenanceManager) Disable() MaintenanceState
Disable disables maintenance mode.
func (*MaintenanceManager) Enable ¶
func (m *MaintenanceManager) Enable(reason string, estimatedDuration time.Duration) MaintenanceState
Enable enables maintenance mode with a reason.
func (*MaintenanceManager) GetState ¶
func (m *MaintenanceManager) GetState() MaintenanceState
GetState returns the current maintenance state.
func (*MaintenanceManager) IsEnabled ¶
func (m *MaintenanceManager) IsEnabled() bool
IsEnabled returns whether maintenance mode is currently enabled.
func (*MaintenanceManager) SetOnChange ¶
func (m *MaintenanceManager) SetOnChange(fn func(state MaintenanceState))
SetOnChange sets a callback to be called when maintenance state changes. This can be used to broadcast SSE events.
func (*MaintenanceManager) UpdateEstimatedEnd ¶
func (m *MaintenanceManager) UpdateEstimatedEnd(end time.Time) MaintenanceState
UpdateEstimatedEnd updates the estimated end time.
func (*MaintenanceManager) UpdateReason ¶
func (m *MaintenanceManager) UpdateReason(reason string) MaintenanceState
UpdateReason updates the maintenance reason without changing other state.
type MaintenanceState ¶
type MaintenanceState struct {
Enabled bool `json:"enabled"`
Reason string `json:"reason,omitempty"`
StartedAt *time.Time `json:"startedAt,omitempty"`
EstimatedEnd *time.Time `json:"estimatedEnd,omitempty"`
}
MaintenanceState represents the current maintenance mode status.
type Warning ¶
type Warning struct {
Code string `json:"code"`
Message string `json:"message"`
Severity string `json:"severity"` // "warning", "error", "info"
}
Warning represents a system warning.
func GetEnvironmentWarnings ¶
GetEnvironmentWarnings returns warnings based on current environment and database driver.