/
interface.go
38 lines (32 loc) · 1.12 KB
/
interface.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
// Copyright 2019 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgradesteps
import (
"github.com/juju/juju/controller"
"github.com/juju/juju/core/instance"
"github.com/juju/juju/core/status"
"github.com/juju/juju/state"
)
type UpgradeStepsState interface {
state.EntityFinder
ControllerConfig() (controller.Config, error)
ApplyOperation(state.ModelOperation) error
}
// Machine represents point of use methods from the state machine object
type Machine interface {
ContainerType() instance.ContainerType
ModificationStatus() (status.StatusInfo, error)
SetModificationStatus(status.StatusInfo) error
}
// Unit represents point of use methods from the state unit object
type Unit interface {
SetStateOperation(*state.UnitState, state.UnitStateSizeLimits) state.ModelOperation
}
var (
// NOTE(achilleasa): If the above interface definitions are not
// compatible to the equivalent implementations in state, upgrades can
// break due to failed cast checks. The following compile-time checks
// allow us to catch such issues.
_ Unit = (*state.Unit)(nil)
_ Machine = (*state.Machine)(nil)
)