Documentation ¶
Index ¶
- func CheckingAPICaller(c *gc.C, args *CheckArgs, numCalls *int, err error) base.APICallCloser
- func NotifyingCheckingAPICaller(c *gc.C, args *CheckArgs, called chan struct{}, err error) base.APICaller
- func PatchFacadeCall(p Patcher, caller *base.FacadeCaller, ...)
- type APICallerFunc
- type CheckArgs
- type Patcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckingAPICaller ¶
CheckingAPICaller returns an APICallerFunc which can report the number of times its APICall() method was called (if numCalls is not nil), as well as check if any of the arguments passed to the APICall() method match the values given in args (if args itself is not nil, otherwise no arguments are checked). The final error result of the APICall() will be set to err.
func NotifyingCheckingAPICaller ¶
func NotifyingCheckingAPICaller(c *gc.C, args *CheckArgs, called chan struct{}, err error) base.APICaller
NotifyingCheckingAPICaller returns an APICallerFunc which sends a message on the channel "called" every time it recives a call, as well as check if any of the arguments passed to the APICall() method match the values given in args (if args itself is not nil, otherwise no arguments are checked). The final error result of the APICall() will be set to err.
func PatchFacadeCall ¶
func PatchFacadeCall(p Patcher, caller *base.FacadeCaller, f func(request string, params, response interface{}) error)
PatchFacadeCall patches the provided FacadeCaller such that the FacadeCall method calls are diverted to the provided function.
Types ¶
type APICallerFunc ¶
type APICallerFunc func(objType string, version int, id, request string, params, response interface{}) error
APICallerFunc is a function type that implements APICaller.
func (APICallerFunc) APICall ¶
func (f APICallerFunc) APICall(objType string, version int, id, request string, params, response interface{}) error
func (APICallerFunc) BestFacadeVersion ¶
func (APICallerFunc) BestFacadeVersion(facade string) int
func (APICallerFunc) Close ¶
func (APICallerFunc) Close() error
func (APICallerFunc) EnvironTag ¶
func (APICallerFunc) EnvironTag() (names.EnvironTag, error)
type CheckArgs ¶
type CheckArgs struct { Facade string Version int Id string Method string Args interface{} Results interface{} IdIsEmpty bool VersionIsZero bool }
CheckArgs holds the possible arguments to CheckingAPICaller(). Any fields non empty fields will be checked to match the arguments recieved by the APICall() method of the returned APICallerFunc. If Id is empty, but IdIsEmpty is true, the id argument is checked to be empty. The same applies to Version being empty, but if VersionIsZero set to true the version is checked to be 0.