github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/apiserver/uniter/state.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package uniter
     5  
     6  import (
     7  	"github.com/juju/juju/state"
     8  )
     9  
    10  type storageStateInterface interface {
    11  	StorageInstance(id string) (state.StorageInstance, error)
    12  	Unit(name string) (*state.Unit, error)
    13  }
    14  
    15  type storageStateShim struct {
    16  	*state.State
    17  }
    18  
    19  var getStorageState = func(st *state.State) storageStateInterface {
    20  	return storageStateShim{st}
    21  }
    22  
    23  func (s storageStateShim) StorageInstance(id string) (state.StorageInstance, error) {
    24  	return s.State.StorageInstance(id)
    25  }
    26  
    27  func (s storageStateShim) Unit(name string) (*state.Unit, error) {
    28  	return s.State.Unit(name)
    29  }