github.com/mhilton/juju-juju@v0.0.0-20150901100907-a94dd2c73455/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  	DoesNotRequireMachineLock
    16  }
    17  
    18  // String is part of the Operation interface.
    19  func (ur *updateRelations) String() string {
    20  	return fmt.Sprintf("update relations %v", ur.ids)
    21  }
    22  
    23  // Prepare does nothing.
    24  // Prepare is part of the Operation interface.
    25  func (ur *updateRelations) Prepare(_ State) (*State, error) {
    26  	return nil, nil
    27  }
    28  
    29  // Execute ensures the operation's relation ids are known and tracked. This
    30  // doesn't directly change any persistent state.
    31  // Execute is part of the Operation interface.
    32  func (ur *updateRelations) Execute(_ State) (*State, error) {
    33  	return nil, ur.callbacks.UpdateRelations(ur.ids)
    34  }
    35  
    36  // Commit does nothing.
    37  // Commit is part of the Operation interface.
    38  func (ur *updateRelations) Commit(_ State) (*State, error) {
    39  	return nil, nil
    40  }