Merge lp:~dimitern/juju-core/066-apiserver-stringswatcher into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | Dimiter Naydenov |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1417 |
Proposed branch: | lp:~dimitern/juju-core/066-apiserver-stringswatcher |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
358 lines (+75/-68) 9 files modified
state/api/interfaces.go (+20/-0) state/api/params/internal.go (+7/-24) state/api/watcher/watcher.go (+18/-13) state/apiserver/root.go (+5/-6) state/apiserver/watcher.go (+11/-11) state/watcher.go (+7/-7) worker/cleaner/cleaner.go (+2/-2) worker/notifyworker.go (+3/-3) worker/notifyworker_test.go (+2/-2) |
To merge this branch: | bzr merge lp:~dimitern/juju-core/066-apiserver-stringswatcher |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+173896@code.launchpad.net |
Commit message
state/apiserver: StringsWatcher common impl.
Replaced srvLifecycleWatcher with srvStringsWatcher.
This will be the server-side implementation for any
watcher that returns a list of strings, like the
LifecycleWatcher, MinUnitsWatcher, UnitsWatcher, or
MachineUnitsWat
At client side of the API there will be a single
StringsWatcher implementation of all these watchers,
thus greatly reducing code duplication (as in state).
Also, CleanupWatcher was made conformant with NotifyWatcher,
since it's the same interface. Workers were updated to
reflect the changes to the interface and a new api/interface.go
was introduced to keep the watcher's interfaces there.
https:/
R=fwereade, fwereade, jameinel, jameinel
Description of the change
state/apiserver: StringsWatcher common impl.
Replaced srvLifecycleWatcher with srvStringsWatcher.
This will be the server-side implementation for any
watcher that returns a list of strings, like the
LifecycleWatcher, MinUnitsWatcher, UnitsWatcher, or
MachineUnitsWat
At client side of the API there will be a single
StringsWatcher implementation of all these watchers,
thus greatly reducing code duplication (as in state).
Also, CleanupWatcher was made conformant with NotifyWatcher,
since it's the same interface. Workers were updated to
reflect the changes to the interface and a new api/interface.go
was introduced to keep the watcher's interfaces there.
Reviewers: mp+173896_ code.launchpad. net,
Message:
Please take a look.
Description:
state/apiserver: StringsWatcher common impl.
Replaced srvLifecycleWatcher with srvStringsWatcher. cher.
This will be the server-side implementation for any
watcher that returns a list of strings, like the
LifecycleWatcher, MinUnitsWatcher, UnitsWatcher, or
MachineUnitsWat
At client side of the API there will be concrete
implementations of each watcher still.
https:/ /code.launchpad .net/~dimitern/ juju-core/ 066-apiserver- stringswatcher/ +merge/ 173896
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/10944044/
Affected files: params/ internal. go watcher/ watcher. go /root.go /watcher. go
A [revision details]
M state/api/
M state/api/
M state/apiserver
M state/apiserver
Index: [revision details] 20130709173747- vea1m7nxrla81n4 o
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision:
<email address hidden>
Index: state/apiserver /root.go apiserver/ root.go' /root.go 2013-07-09 16:29:17 +0000 /root.go 2013-07-10 09:49:15 +0000
=== modified file 'state/
--- state/apiserver
+++ state/apiserver
@@ -110,11 +110,10 @@
}, nil
}
-// LifecycleWatcher returns an object that provides Watcher. atcher, tcher. Each client has its own cher, error) { ErrUnknownWatch er tcher{
-// API access to methods on a state.Lifecycle
-// Each client has its own current set of watchers, stored
-// in r.resources.
-func (r *srvRoot) LifecycleWatcher(id string) (*srvLifecycleW
error) {
+// StringsWatcher returns an object that provides API access to
+// methods on a state.StringsWa
+// current set of watchers, stored in r.resources.
+func (r *srvRoot) StringsWatcher(id string) (*srvStringsWat
if err := r.requireAgent(); err != nil {
return nil, err
}
@@ -122,7 +121,7 @@
if !ok {
return nil, common.
}
- return &srvLifecycleWa
+ return &srvStringsWatcher{
watcher: watcher,
id: id,
resources: r.resources,
Index: state/apiserver /watcher. go apiserver/ watcher. go' /watcher. go 2013-07-09 16:29:17 +0000 /watcher. go 2013-07-10 09:49:15 +0000 Stop(w. id)
=== modified file 'state/
--- state/apiserver
+++ state/apiserver
@@ -52,31 +52,31 @@
return w.resources.
}
-// srvLifecycleWatcher notifies about lifecycle changes for all Watcher. tcher
-// entities of a given kind. See state.lifecycle
-type srvLifecycleWatcher struct {
+// srvStringsWatcher notifies about changes for all entities of a
+// given kind, sending the changes as a list of strings.
+type srvStringsWatcher struct {
watcher state.StringsWa
id string
resources *common.Resources
}
-// Next returns when a change has occured to the lifecycle of an cher. tcher) Next() (params. LifecycleWatchR esults, error)
-// entity of the collection being watched since the most recent call
-// to Next or the Watch call that created the srvLifecycleWat
-func (w *srvLifecycleWa
{
+// Next returns when a change has occured to an entity of the
+// collection being watched since...