Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1134)

Side by Side Diff: state/megawatcher.go

Issue 12522043: Implemented the ServiceUpdate API call.
Patch Set: Implemented the ServiceUpdate API call. Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « state/apiserver/client/perm_test.go ('k') | state/megawatcher_internal_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 := &params.ServiceInfo{ 126 info := &params.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
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 }
OLDNEW
« no previous file with comments | « state/apiserver/client/perm_test.go ('k') | state/megawatcher_internal_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b