summaryrefslogtreecommitdiff
path: root/plugins/informer/interface.go
blob: 9277b85bca145539b70056e2d112a20da7b3c08e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package informer

import (
	"context"

	"github.com/spiral/roadrunner/v2/pkg/state/job"
	"github.com/spiral/roadrunner/v2/pkg/state/process"
)

/*
Informer plugin should not receive any other plugin in the Init or via Collects
Because Availabler implementation should present in every plugin
*/

// Statistic interfaces ==============

// Informer used to get workers from particular plugin or set of plugins
type Informer interface {
	Workers() []*process.State
}

// JobsStat interface provide statistic for the jobs plugin
type JobsStat interface {
	// JobsState returns slice with the attached drivers information
	JobsState(ctx context.Context) ([]*job.State, error)
}

// Statistic interfaces end ============

// Availabler interface should be implemented by every plugin which wish to report to the PHP worker that it available in the RR runtime
type Availabler interface {
	// Available method needed to collect all plugins which are available in the runtime.
	Available()
}