launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/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 "launchpad.net/juju-core/state/api/params" 7 8 // AllWatcher holds information allowing us to get Deltas describing changes 9 // to the entire environment. 10 type AllWatcher struct { 11 client *Client 12 id *string 13 } 14 15 func newAllWatcher(client *Client, id *string) *AllWatcher { 16 return &AllWatcher{client, id} 17 } 18 19 func (watcher *AllWatcher) Next() ([]params.Delta, error) { 20 info := new(params.AllWatcherNextResults) 21 err := watcher.client.st.Call("AllWatcher", *watcher.id, "Next", nil, info) 22 return info.Deltas, err 23 } 24 25 func (watcher *AllWatcher) Stop() error { 26 return watcher.client.st.Call("AllWatcher", *watcher.id, "Stop", nil, nil) 27 }