Documentation
¶
Index ¶
- Constants
- func CanonicalConfigPath(path string) (string, error)
- func ExecutableIdentity() (path string, build string, err error)
- func Run(ctx context.Context, opts Options) error
- func Stop(ctx context.Context, configPath string) (pidfileFallback bool, err error)
- func ValidatePIDFile(record PIDFile, expectedConfigPath string) error
- type ControlRequest
- type ControlResponse
- type Daemon
- type Handshake
- type HandshakeEnvelope
- type HandshakeResponse
- type Options
- type PIDFile
- type Paths
- type StatusResponse
Constants ¶
const ( SessionProtocol = 1 ControlProtocol = 1 )
Variables ¶
This section is empty.
Functions ¶
func CanonicalConfigPath ¶
CanonicalConfigPath resolves all existing symlink components while keeping a not-yet-created config path usable.
func ExecutableIdentity ¶
func Stop ¶
Stop asks the daemon to drain over its control connection. If the socket is unavailable or the control handshake fails, it signals only after validating every pidfile identity field.
func ValidatePIDFile ¶
ValidatePIDFile checks every persisted identity field against the requested config and the currently running process. A failure is conservative: the caller must not signal the recorded PID.
Types ¶
type ControlRequest ¶
type ControlRequest struct {
Command string `json:"command"`
}
type ControlResponse ¶
type ControlResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
Status *StatusResponse `json:"status,omitempty"`
}
func Control ¶
func Control(ctx context.Context, configPath, command string) (ControlResponse, error)
Control sends one versioned command to the daemon for configPath. Control connections intentionally do not carry or enforce the caller's build identity, so a newly installed binary can still inspect or stop an older daemon.
type Handshake ¶
type Handshake struct {
Type string `json:"type"`
Protocol int `json:"protocol,omitempty"`
ControlProtocol int `json:"controlProtocol,omitempty"`
Build string `json:"build,omitempty"`
ConfigPath string `json:"configPath"`
Namespace string `json:"namespace,omitempty"`
ExposeManagerTools bool `json:"exposeManagerTools,omitempty"`
Resources bool `json:"resources,omitempty"`
Prompts bool `json:"prompts,omitempty"`
Eager bool `json:"eager,omitempty"`
// Compression is tri-state: "" = --compress absent (the active namespace's
// configured level decides), "off" = explicit off, otherwise the level.
Compression string `json:"compression,omitempty"`
PID int `json:"pid,omitempty"`
}
type HandshakeEnvelope ¶
type HandshakeEnvelope struct {
Handshake Handshake `json:"mcpmu_handshake"`
}
type HandshakeResponse ¶
type PIDFile ¶
type PIDFile struct {
ConfigPath string `json:"configPath"`
PID int `json:"pid"`
StartedAt time.Time `json:"startedAt"`
ProcessStartIdentity int64 `json:"processStartIdentity"`
ExecutablePath string `json:"executablePath"`
}
func ReadPIDFile ¶
type Paths ¶
type Paths struct {
RuntimeDir string
Socket string
SpawnLock string
RunLock string
PIDFile string
LogFile string
}
Paths contains every per-config daemon rendezvous artifact.
func RuntimePaths ¶
RuntimePaths derives short rendezvous names from the canonical config path. The short hash is only a filename hint; handshakes and pidfiles retain the complete path as the authoritative identity.
type StatusResponse ¶
type StatusResponse struct {
Socket string `json:"socket"`
Build string `json:"build"`
Version string `json:"version"`
Revision string `json:"revision"`
ConfigPath string `json:"configPath"`
PID int `json:"pid"`
Sessions int `json:"sessions"`
RunningUpstreams []string `json:"runningUpstreams"`
Stopping bool `json:"stopping"`
}
func Inspect ¶
func Inspect(ctx context.Context, configPath string) (status StatusResponse, pidfileFallback bool, err error)
Inspect returns live daemon status. If the control socket is unavailable, it validates the pidfile against the requested full config path and current process identity and returns a deliberately limited status snapshot.