| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package jobmgr |
| 4 | |
| 5 | import ( |
| 6 | "context" |
| 7 | |
| 8 | "github.com/netdata/netdata/go/plugins/plugin/framework/collectorapi" |
| 9 | "github.com/netdata/netdata/go/plugins/plugin/framework/vnodes" |
| 10 | ) |
| 11 | |
| 12 | // runtimeJob is the minimal job runner contract needed by jobmgr orchestration. |
| 13 | // It is implemented by both legacy module.Job and module.JobV2. |
| 14 | type runtimeJob interface { |
| 15 | FullName() string |
| 16 | ModuleName() string |
| 17 | Name() string |
| 18 | Collector() any |
| 19 | |
| 20 | Start() |
| 21 | Stop() |
| 22 | Tick(clock int) |
| 23 | |
| 24 | AutoDetection() error |
| 25 | AutoDetectionEvery() int |
| 26 | RetryAutoDetection() bool |
| 27 | Cleanup() |
| 28 | |
| 29 | IsRunning() bool |
| 30 | Panicked() bool |
| 31 | |
| 32 | Vnode() vnodes.VirtualNode |
| 33 | UpdateVnode(vnode *vnodes.VirtualNode) |
| 34 | } |
| 35 | |
| 36 | // configModule is the shared Init/Check/config contract for dyncfg config test/get |
| 37 | // flows. Both legacy CollectorV1 and CollectorV2 satisfy it. |
| 38 | type configModule interface { |
| 39 | GetBase() *collectorapi.Base |
| 40 | Init(ctx context.Context) error |
| 41 | Check(ctx context.Context) error |
| 42 | Cleanup(ctx context.Context) |
| 43 | Configuration() any |
| 44 | } |