/
state.go
32 lines (24 loc) · 853 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
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package annotations
import (
"github.com/juju/names"
"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
}
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)
}