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 state | 4 package state |
5 | 5 |
6 import ( | 6 import ( |
7 "fmt" | 7 "fmt" |
8 "reflect" | 8 "reflect" |
9 "strings" | 9 "strings" |
10 | 10 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 | 122 |
123 type backingService serviceDoc | 123 type backingService serviceDoc |
124 | 124 |
125 func (svc *backingService) updated(st *State, store *multiwatcher.Store, id inte
rface{}) error { | 125 func (svc *backingService) updated(st *State, store *multiwatcher.Store, id inte
rface{}) error { |
126 info := ¶ms.ServiceInfo{ | 126 info := ¶ms.ServiceInfo{ |
127 Name: svc.Name, | 127 Name: svc.Name, |
128 Exposed: svc.Exposed, | 128 Exposed: svc.Exposed, |
129 CharmURL: svc.CharmURL.String(), | 129 CharmURL: svc.CharmURL.String(), |
130 Life: params.Life(svc.Life.String()), | 130 Life: params.Life(svc.Life.String()), |
| 131 MinUnits: svc.MinUnits, |
131 } | 132 } |
132 oldInfo := store.Get(info.EntityId()) | 133 oldInfo := store.Get(info.EntityId()) |
133 needConfig := false | 134 needConfig := false |
134 if oldInfo == nil { | 135 if oldInfo == nil { |
135 // We're adding the entry for the first time, | 136 // We're adding the entry for the first time, |
136 // so fetch the associated child documents. | 137 // so fetch the associated child documents. |
137 c, err := readConstraints(st, serviceGlobalKey(svc.Name)) | 138 c, err := readConstraints(st, serviceGlobalKey(svc.Name)) |
138 if err != nil { | 139 if err != nil { |
139 return err | 140 return err |
140 } | 141 } |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // in, such as settings changes to entities we don't care about. | 526 // in, such as settings changes to entities we don't care about. |
526 err := c.FindId(change.Id).One(doc) | 527 err := c.FindId(change.Id).One(doc) |
527 if err == mgo.ErrNotFound { | 528 if err == mgo.ErrNotFound { |
528 return doc.removed(b.st, all, change.Id) | 529 return doc.removed(b.st, all, change.Id) |
529 } | 530 } |
530 if err != nil { | 531 if err != nil { |
531 return err | 532 return err |
532 } | 533 } |
533 return doc.updated(b.st, all, change.Id) | 534 return doc.updated(b.st, all, change.Id) |
534 } | 535 } |
OLD | NEW |