Documentation
¶
Index ¶
- type BridgeInfo
- type Controller
- func (c *Controller) Configure(spec LaunchSpec) error
- func (c *Controller) GetLaunchMode() string
- func (c *Controller) GetPID() int
- func (c *Controller) GetStopProcessName() string
- func (c *Controller) IsLauncherProcessRunning() bool
- func (c *Controller) IsRunning() bool
- func (c *Controller) Kill() error
- func (c *Controller) Restart() error
- func (c *Controller) SetBridgeInfo(port int, token string)
- func (c *Controller) Start() error
- func (c *Controller) Stop(grace time.Duration) error
- func (c *Controller) WaitForProcessStart(timeout time.Duration) error
- type ControllerInterface
- type GABPConnector
- type LaunchSpec
- type ProcessError
- type ProcessErrorType
- type ProcessStartResult
- type SerializedStarter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgeInfo ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements a stateless approach to process management It queries the actual system state rather than maintaining internal state
func (*Controller) Configure ¶
func (c *Controller) Configure(spec LaunchSpec) error
Configure sets up the controller with the given launch specification
func (*Controller) GetLaunchMode ¶
func (c *Controller) GetLaunchMode() string
GetLaunchMode returns the launch mode
func (*Controller) GetPID ¶
func (c *Controller) GetPID() int
GetPID returns the process ID if available
func (*Controller) GetStopProcessName ¶
func (c *Controller) GetStopProcessName() string
GetStopProcessName returns the stop process name
func (*Controller) IsLauncherProcessRunning ¶
func (c *Controller) IsLauncherProcessRunning() bool
IsLauncherProcessRunning checks if the launcher process itself is still running
func (*Controller) IsRunning ¶
func (c *Controller) IsRunning() bool
IsRunning queries the actual system state to determine if the process is running This is stateless - it directly checks the real process state
func (*Controller) Restart ¶
func (c *Controller) Restart() error
Restart stops and then starts the process
func (*Controller) SetBridgeInfo ¶
func (c *Controller) SetBridgeInfo(port int, token string)
SetBridgeInfo sets the bridge connection information
func (*Controller) Start ¶
func (c *Controller) Start() error
Start launches the process and waits for verification
func (*Controller) Stop ¶
func (c *Controller) Stop(grace time.Duration) error
Stop gracefully stops the process
func (*Controller) WaitForProcessStart ¶
func (c *Controller) WaitForProcessStart(timeout time.Duration) error
WaitForProcessStart waits for the process to be detectable in the system
type ControllerInterface ¶
type ControllerInterface interface {
Configure(spec LaunchSpec) error
SetBridgeInfo(port int, token string)
Start() error
Stop(grace time.Duration) error
Kill() error
IsRunning() bool
GetPID() int
GetLaunchMode() string
GetStopProcessName() string
IsLauncherProcessRunning() bool
}
ControllerInterface defines the interface for process controllers
func NewController ¶
func NewController() ControllerInterface
NewController creates a new controller instance This maintains the existing API while using the consolidated implementation
type GABPConnector ¶
type GABPConnector interface {
AttemptConnection(ctx context.Context, gameID string, port int, token string) bool
}
GABPConnector interface for testing and abstraction
type LaunchSpec ¶
type ProcessError ¶
type ProcessError struct {
Type ProcessErrorType
Context string
Err error
}
ProcessError represents different types of process-related errors
func (*ProcessError) Error ¶
func (e *ProcessError) Error() string
type ProcessErrorType ¶
type ProcessErrorType int
const ( ProcessErrorTypeConfiguration ProcessErrorType = iota ProcessErrorTypeStart ProcessErrorTypeStop ProcessErrorTypeStatus ProcessErrorTypeNotFound )
type ProcessStartResult ¶
type ProcessStartResult struct {
ProcessStarted bool // Process found in system
GABPConnected bool // Successfully connected to GABP server
Error error
}
ProcessStartResult represents the result of a process start operation
type SerializedStarter ¶
type SerializedStarter struct {
// contains filtered or unexported fields
}
SerializedStarter ensures only one process is starting at a time This implements the serialized starting approach requested by @pardeike
func NewSerializedStarter ¶
func NewSerializedStarter() *SerializedStarter
NewSerializedStarter creates a new serialized starter with default timeouts
func NewSerializedStarterForTesting ¶
func NewSerializedStarterForTesting() *SerializedStarter
NewSerializedStarterForTesting creates a serialized starter with shorter timeouts for testing
func (*SerializedStarter) SetTimeouts ¶
func (s *SerializedStarter) SetTimeouts(processStart, gabpConnect time.Duration)
SetTimeouts allows customization of timeout values
func (*SerializedStarter) StartWithVerification ¶
func (s *SerializedStarter) StartWithVerification( controller ControllerInterface, gabpConnector GABPConnector, gameID string, port int, token string, ) *ProcessStartResult
StartWithVerification starts a process with full verification This method serializes the starting process as requested by @pardeike