github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/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  	"gopkg.in/juju/names.v2"
     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  	ModelTag() names.ModelTag
    17  }
    18  
    19  type stateShim struct {
    20  	state *state.State
    21  }
    22  
    23  func (s stateShim) FindEntity(tag names.Tag) (state.Entity, error) {
    24  	return s.state.FindEntity(tag)
    25  }
    26  
    27  func (s stateShim) GetAnnotations(entity state.GlobalEntity) (map[string]string, error) {
    28  	return s.state.Annotations(entity)
    29  }
    30  
    31  func (s stateShim) SetAnnotations(entity state.GlobalEntity, annotations map[string]string) error {
    32  	return s.state.SetAnnotations(entity, annotations)
    33  }
    34  
    35  func (s stateShim) ModelTag() names.ModelTag {
    36  	return s.state.ModelTag()
    37  }