package supervisorimport ()// Start starts the process with the given key from the table. It returns// ErrNotRunning if the supervisor is not running and ErrProcessExists if the// process already exists. Otherwise it returns an error from process// initialization.func ( *Supervisor[, ]) ( context.Context, ) (, error) { , := .startProcessForKey(, )if != nil {varreturn , }return .proc, nil}// Stop stops the process with the given key. It returns ErrProcessNotFound if// the process does not exist, and an error from running the process otherwise.func ( *Supervisor[, ]) ( context.Context, ) error {return .stopProcess(, )}// Get returns a running process or either a ErrProcessNotFound error if the// process does not exist or ErrProcessNotRunning is the process exists but is// not running.func ( *Supervisor[, ]) ( context.Context, ) (, error) { , := .processes.Load()if ! || == nil {varreturn , ErrProcessNotFound }if .State() != process.StateRunning {return .proc, ErrProcessNotRunning }return .proc, nil}// Keys returns a list of all process keys.func ( *Supervisor[, ]) () [] {var [] .processes.Range(func( , *managedProcess[]) bool { = append(, )returntrue })return}
The pages are generated with Goldsv0.4.9. (GOOS=linux GOARCH=amd64)