system

package
v0.0.0-...-1e0776f Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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

func GetEnvironmentWarnings(dbDriver string) []Warning

GetEnvironmentWarnings returns warnings based on current environment and database driver.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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