Documentation
¶
Overview ¶
Package supervisor 管理本项目的服务进程、控制通道和监听资源。
Index ¶
- func Attach(ctx context.Context, socket string, specs map[string]Spec, output *Display) (bool, error)
- func ConfigureHorizon()
- func Frontend(ctx context.Context, spec Spec) error
- func Parse(selection, action string) ([]string, error)
- func Pending(message string) error
- func Ready() error
- func ReportRuntime(ctx context.Context, socket string)
- func Run(ctx context.Context, socket string, specs map[string]Spec, names []string, ...) error
- func Terminal(ctx context.Context, socket string, launcher Spec, specs map[string]Spec, ...) (result error)
- func Wait(ctx context.Context, check func(context.Context) error) error
- func Watch(ctx context.Context, directory, runtime string, output io.Writer, ...) error
- func WatchParent(ctx context.Context, shutdown func(error)) (func(), error)
- type Display
- type ProcessStats
- type Response
- type RuntimeStats
- type Spec
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attach ¶ added in v0.1.1
func Attach(ctx context.Context, socket string, specs map[string]Spec, output *Display) (bool, error)
Attach transfers local terminal ownership after the requested services are ready. Closing the current owner stops the manager; closing a replaced owner has no effect.
func ConfigureHorizon ¶
func ConfigureHorizon()
ConfigureHorizon 通过公开扩展接口限定本代服务的停机范围,队列和监控数据仍由原 Store 管理。
func ReportRuntime ¶ added in v0.1.3
ReportRuntime 向项目的本地控制通道上报当前Go进程的协程数,随context退出。
func Run ¶
func Run(ctx context.Context, socket string, specs map[string]Spec, names []string, watch bool, display *Display) error
Run 持有排他锁和本地控制入口,直到收到停止命令或应用退出信号。
func Terminal ¶ added in v0.1.1
func Terminal(ctx context.Context, socket string, launcher Spec, specs map[string]Spec, output *Display) (result error)
Terminal starts an independent local manager when absent, then owns its control connection.
Types ¶
type Display ¶ added in v0.1.3
type Display struct {
Out io.Writer
Options console.OutputOptions
Locale string
Environment string
JSON bool
Log string
// contains filtered or unexported fields
}
Display 是Dawn命令共用的终端输出,串行写入状态表与服务日志。
func NewDisplay ¶ added in v0.1.3
NewDisplay 复用Console的输出目标、语言和终端选项。
type ProcessStats ¶ added in v0.1.3
type ProcessStats struct {
Name string `json:"name"`
PID int `json:"pid"`
User string `json:"user"`
RSS *uint64 `json:"rss_bytes,omitempty"`
CPU *float64 `json:"cpu_percent,omitempty"`
Threads *int32 `json:"threads,omitempty"`
Goroutines *int `json:"goroutines,omitempty"`
StartedAt int64 `json:"started_at"`
Children []ProcessStats `json:"children,omitempty"`
}
ProcessStats 是操作系统采样的进程指标;不可用的指标省略。
type Response ¶
type RuntimeStats ¶ added in v0.1.3
RuntimeStats 是Go进程通过本地控制通道上报的运行时指标。
type Spec ¶
type Spec struct {
Command []string
Dir, Address, Probe string
URL string
Env []string
Timeout time.Duration
JoinGroup bool
}
Spec 声明服务的执行入口;Address 用于继承监听器,Probe 用于前端就绪检查。
type Status ¶
type Status struct {
Name string `json:"name"`
State string `json:"state"`
Wanted bool `json:"wanted"`
PID int `json:"pid"`
Restarts int `json:"restarts"`
StartedAt int64 `json:"started_at"`
LastError string `json:"last_error,omitempty"`
Address string `json:"address,omitempty"`
Process *ProcessStats `json:"process,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.