forked from ericrpowers/trireme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.go
46 lines (33 loc) · 1.41 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
41
42
43
44
45
46
package trireme
import (
"github.com/headingy/trireme/constants"
"github.com/headingy/trireme/monitor"
"github.com/headingy/trireme/policy"
"github.com/headingy/trireme/supervisor"
)
// Trireme is the main interface to the Trireme package.
type Trireme interface {
// PURuntime returns a getter for a specific contextID.
PURuntime(contextID string) (policy.RuntimeReader, error)
// Start starts the component.
Start() error
// Stop stops the component.
Stop() error
// Supervisor returns the supervisor for a given PU type
Supervisor(kind constants.PUType) supervisor.Supervisor
monitor.ProcessingUnitsHandler
PolicyUpdater
}
// A PolicyUpdater has the ability to receive an update for a specific policy.
type PolicyUpdater interface {
// UpdatePolicy updates the policy of the isolator for a container.
UpdatePolicy(contextID string, newPolicy *policy.PUPolicy) error
}
// A PolicyResolver is responsible of creating the Policies for a specific Processing Unit.
// The PolicyResolver also got the ability to update an already instantiated policy.
type PolicyResolver interface {
// ResolvePolicy returns the policy.PUPolicy associated with the given contextID using the given policy.RuntimeReader.
ResolvePolicy(contextID string, RuntimeReader policy.RuntimeReader) (*policy.PUPolicy, error)
// HandleDeletePU is called when a PU is stopped/killed.
HandlePUEvent(contextID string, eventType monitor.Event)
}