-
Notifications
You must be signed in to change notification settings - Fork 51
/
interfaces.go
40 lines (29 loc) · 1.18 KB
/
interfaces.go
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
35
36
37
38
39
40
package monitor
import (
"context"
"go.aporeto.io/trireme-lib/monitor/config"
"go.aporeto.io/trireme-lib/monitor/registerer"
)
// A Monitor is an interface implmented to start/stop monitors.
type Monitor interface {
// Start starts the monitor.
Run(ctx context.Context) error
// UpdateConfiguration updates the configuration of the monitor
UpdateConfiguration(ctx context.Context, config *config.MonitorConfig) error
// Resync requests to the monitor to do a resync.
Resync(ctx context.Context) error
}
// Implementation for a monitor.
type Implementation interface {
// Run starts the monitor implementation.
Run(ctx context.Context) error
// SetupConfig provides a configuration to implmentations. Every implmentation
// can have its own config type.
SetupConfig(registerer registerer.Registerer, cfg interface{}) error
// SetupHandlers sets up handlers for monitors to invoke for various events such as
// processing unit events and synchronization events. This will be called before Start()
// by the consumer of the monitor
SetupHandlers(c *config.ProcessorConfig)
// Resync should resynchronize PUs. This should be done while starting up.
Resync(ctx context.Context) error
}