github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/worker/uniter/operation/relations.go (about) 1 // Copyright 2014-2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package operation 5 6 import ( 7 "fmt" 8 ) 9 10 type updateRelations struct { 11 ids []int 12 13 callbacks Callbacks 14 } 15 16 // String is part of the Operation interface. 17 func (ur *updateRelations) String() string { 18 return fmt.Sprintf("update relations %v", ur.ids) 19 } 20 21 // Prepare does nothing. 22 // Prepare is part of the Operation interface. 23 func (ur *updateRelations) Prepare(_ State) (*State, error) { 24 return nil, nil 25 } 26 27 // Execute ensures the operation's relation ids are known and tracked. This 28 // doesn't directly change any persistent state. 29 // Execute is part of the Operation interface. 30 func (ur *updateRelations) Execute(_ State) (*State, error) { 31 return nil, ur.callbacks.UpdateRelations(ur.ids) 32 } 33 34 // Commit does nothing. 35 // Commit is part of the Operation interface. 36 func (ur *updateRelations) Commit(_ State) (*State, error) { 37 return nil, nil 38 }