forked from juju/juju
/
state.go
37 lines (28 loc) · 958 Bytes
/
state.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
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package annotations
import (
"gopkg.in/juju/names.v2"
"github.com/juju/juju/state"
)
type annotationAccess interface {
FindEntity(tag names.Tag) (state.Entity, error)
GetAnnotations(entity state.GlobalEntity) (map[string]string, error)
SetAnnotations(entity state.GlobalEntity, annotations map[string]string) error
ModelTag() names.ModelTag
}
type stateShim struct {
state *state.State
}
func (s stateShim) FindEntity(tag names.Tag) (state.Entity, error) {
return s.state.FindEntity(tag)
}
func (s stateShim) GetAnnotations(entity state.GlobalEntity) (map[string]string, error) {
return s.state.Annotations(entity)
}
func (s stateShim) SetAnnotations(entity state.GlobalEntity, annotations map[string]string) error {
return s.state.SetAnnotations(entity, annotations)
}
func (s stateShim) ModelTag() names.ModelTag {
return s.state.ModelTag()
}