OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package apiserver | 4 package apiserver |
5 | 5 |
6 import ( | 6 import ( |
7 "errors" | 7 "errors" |
8 "time" | 8 "time" |
9 | 9 |
10 "launchpad.net/tomb" | 10 "launchpad.net/tomb" |
11 | 11 |
12 "launchpad.net/juju-core/rpc" | 12 "launchpad.net/juju-core/rpc" |
13 "launchpad.net/juju-core/state" | 13 "launchpad.net/juju-core/state" |
14 "launchpad.net/juju-core/state/apiserver/agent" | 14 "launchpad.net/juju-core/state/apiserver/agent" |
| 15 "launchpad.net/juju-core/state/apiserver/charmrevisionupdater" |
15 "launchpad.net/juju-core/state/apiserver/client" | 16 "launchpad.net/juju-core/state/apiserver/client" |
16 "launchpad.net/juju-core/state/apiserver/common" | 17 "launchpad.net/juju-core/state/apiserver/common" |
17 "launchpad.net/juju-core/state/apiserver/deployer" | 18 "launchpad.net/juju-core/state/apiserver/deployer" |
18 "launchpad.net/juju-core/state/apiserver/keymanager" | 19 "launchpad.net/juju-core/state/apiserver/keymanager" |
19 "launchpad.net/juju-core/state/apiserver/keyupdater" | 20 "launchpad.net/juju-core/state/apiserver/keyupdater" |
20 loggerapi "launchpad.net/juju-core/state/apiserver/logger" | 21 loggerapi "launchpad.net/juju-core/state/apiserver/logger" |
21 "launchpad.net/juju-core/state/apiserver/machine" | 22 "launchpad.net/juju-core/state/apiserver/machine" |
22 "launchpad.net/juju-core/state/apiserver/provisioner" | 23 "launchpad.net/juju-core/state/apiserver/provisioner" |
23 "launchpad.net/juju-core/state/apiserver/uniter" | 24 "launchpad.net/juju-core/state/apiserver/uniter" |
24 "launchpad.net/juju-core/state/apiserver/upgrader" | 25 "launchpad.net/juju-core/state/apiserver/upgrader" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // KeyUpdater returns an object that provides access to the KeyUpdater API facad
e. | 196 // KeyUpdater returns an object that provides access to the KeyUpdater API facad
e. |
196 // The id argument is reserved for future use and must be empty. | 197 // The id argument is reserved for future use and must be empty. |
197 func (r *srvRoot) KeyUpdater(id string) (*keyupdater.KeyUpdaterAPI, error) { | 198 func (r *srvRoot) KeyUpdater(id string) (*keyupdater.KeyUpdaterAPI, error) { |
198 if id != "" { | 199 if id != "" { |
199 // TODO: There is no direct test for this | 200 // TODO: There is no direct test for this |
200 return nil, common.ErrBadId | 201 return nil, common.ErrBadId |
201 } | 202 } |
202 return keyupdater.NewKeyUpdaterAPI(r.srv.state, r.resources, r) | 203 return keyupdater.NewKeyUpdaterAPI(r.srv.state, r.resources, r) |
203 } | 204 } |
204 | 205 |
| 206 // CharmRevisionUpdater returns an object that provides access to the CharmRevis
ionUpdater API facade. |
| 207 // The id argument is reserved for future use and must be empty. |
| 208 func (r *srvRoot) CharmRevisionUpdater(id string) (*charmrevisionupdater.CharmRe
visionUpdaterAPI, error) { |
| 209 if id != "" { |
| 210 // TODO: There is no direct test for this |
| 211 return nil, common.ErrBadId |
| 212 } |
| 213 return charmrevisionupdater.NewCharmRevisionUpdaterAPI(r.srv.state, r.re
sources, r) |
| 214 } |
| 215 |
205 // NotifyWatcher returns an object that provides | 216 // NotifyWatcher returns an object that provides |
206 // API access to methods on a state.NotifyWatcher. | 217 // API access to methods on a state.NotifyWatcher. |
207 // Each client has its own current set of watchers, stored | 218 // Each client has its own current set of watchers, stored |
208 // in r.resources. | 219 // in r.resources. |
209 func (r *srvRoot) NotifyWatcher(id string) (*srvNotifyWatcher, error) { | 220 func (r *srvRoot) NotifyWatcher(id string) (*srvNotifyWatcher, error) { |
210 if err := r.requireAgent(); err != nil { | 221 if err := r.requireAgent(); err != nil { |
211 return nil, err | 222 return nil, err |
212 } | 223 } |
213 watcher, ok := r.resources.Get(id).(state.NotifyWatcher) | 224 watcher, ok := r.resources.Get(id).(state.NotifyWatcher) |
214 if !ok { | 225 if !ok { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 case <-pt.tomb.Dying(): | 398 case <-pt.tomb.Dying(): |
388 return nil | 399 return nil |
389 case <-timer.C: | 400 case <-timer.C: |
390 go pt.action() | 401 go pt.action() |
391 return errors.New("ping timeout") | 402 return errors.New("ping timeout") |
392 case <-pt.reset: | 403 case <-pt.reset: |
393 timer.Reset(pt.timeout) | 404 timer.Reset(pt.timeout) |
394 } | 405 } |
395 } | 406 } |
396 } | 407 } |
OLD | NEW |