github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/apiserver/annotations/state.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package annotations 5 6 import ( 7 "github.com/juju/names" 8 9 "github.com/juju/juju/state" 10 ) 11 12 type annotationAccess interface { 13 FindEntity(tag names.Tag) (state.Entity, error) 14 GetAnnotations(entity state.GlobalEntity) (map[string]string, error) 15 SetAnnotations(entity state.GlobalEntity, annotations map[string]string) error 16 } 17 18 type stateShim struct { 19 state *state.State 20 } 21 22 func (s stateShim) FindEntity(tag names.Tag) (state.Entity, error) { 23 return s.state.FindEntity(tag) 24 } 25 26 func (s stateShim) GetAnnotations(entity state.GlobalEntity) (map[string]string, error) { 27 return s.state.Annotations(entity) 28 } 29 30 func (s stateShim) SetAnnotations(entity state.GlobalEntity, annotations map[string]string) error { 31 return s.state.SetAnnotations(entity, annotations) 32 }