29 lines
1.6 KiB
Markdown
29 lines
1.6 KiB
Markdown
# api
|
|
**Import:** `dappco.re/go/core/process/pkg/api`
|
|
**Files:** 2
|
|
|
|
## Types
|
|
|
|
### `ProcessProvider`
|
|
`struct`
|
|
|
|
Route-group and renderable provider for process-daemon registry APIs and the bundled UI entrypoint.
|
|
|
|
Exported fields:
|
|
- None.
|
|
|
|
## Functions
|
|
|
|
### Package Functions
|
|
|
|
- `func NewProvider(registry *process.Registry, hub *ws.Hub) *ProcessProvider`: Creates a provider backed by the supplied registry and WebSocket hub. When `registry` is `nil`, it uses `process.DefaultRegistry()`.
|
|
- `func PIDAlive(pid int) bool`: Uses `os.FindProcess` plus signal `0` to report whether a PID is still alive.
|
|
|
|
### `ProcessProvider` Methods
|
|
|
|
- `func (p *ProcessProvider) Name() string`: Returns the route-group name `"process"`.
|
|
- `func (p *ProcessProvider) BasePath() string`: Returns the route-group base path `"/api/process"`.
|
|
- `func (p *ProcessProvider) Element() provider.ElementSpec`: Returns the UI element spec with tag `core-process-panel` and script source `/assets/core-process.js`.
|
|
- `func (p *ProcessProvider) Channels() []string`: Returns the WebSocket channels exposed by the provider: daemon started, daemon stopped, daemon health, process started, process output, process exited, and process killed.
|
|
- `func (p *ProcessProvider) RegisterRoutes(rg *gin.RouterGroup)`: Registers `GET /daemons`, `GET /daemons/:code/:daemon`, `POST /daemons/:code/:daemon/stop`, and `GET /daemons/:code/:daemon/health`.
|
|
- `func (p *ProcessProvider) Describe() []api.RouteDescription`: Returns static route descriptions for the daemon list, single-daemon lookup, daemon stop, and daemon health endpoints.
|