github.com/mattyw/juju@v0.0.0-20140610034352-732aecd63861/state/api/allwatcher.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package api 5 6 import ( 7 "github.com/juju/juju/state/api/params" 8 ) 9 10 // AllWatcher holds information allowing us to get Deltas describing changes 11 // to the entire environment. 12 type AllWatcher struct { 13 client *Client 14 id *string 15 } 16 17 func newAllWatcher(client *Client, id *string) *AllWatcher { 18 return &AllWatcher{client, id} 19 } 20 21 func (watcher *AllWatcher) Next() ([]params.Delta, error) { 22 info := new(params.AllWatcherNextResults) 23 err := watcher.client.st.Call("AllWatcher", *watcher.id, "Next", nil, info) 24 return info.Deltas, err 25 } 26 27 func (watcher *AllWatcher) Stop() error { 28 return watcher.client.st.Call("AllWatcher", *watcher.id, "Stop", nil, nil) 29 }