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

Side by Side Diff: state/megawatcher.go

Issue 8626043: juju: remove dependency on api/params
Patch Set: juju: remove dependency on api/params Created 10 years, 11 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/apiserver.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 package state 1 package state
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "labix.org/v2/mgo" 5 "labix.org/v2/mgo"
6 "launchpad.net/juju-core/log" 6 "launchpad.net/juju-core/log"
7 "launchpad.net/juju-core/state/api/params" 7 "launchpad.net/juju-core/state/api/params"
8 "launchpad.net/juju-core/state/multiwatcher" 8 "launchpad.net/juju-core/state/multiwatcher"
9 "launchpad.net/juju-core/state/watcher" 9 "launchpad.net/juju-core/state/watcher"
10 "reflect" 10 "reflect"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 type backingUnit unitDoc 61 type backingUnit unitDoc
62 62
63 func (u *backingUnit) updated(st *State, store *multiwatcher.Store, id interface {}) error { 63 func (u *backingUnit) updated(st *State, store *multiwatcher.Store, id interface {}) error {
64 info := &params.UnitInfo{ 64 info := &params.UnitInfo{
65 Name: u.Name, 65 Name: u.Name,
66 Service: u.Service, 66 Service: u.Service,
67 Series: u.Series, 67 Series: u.Series,
68 PublicAddress: u.PublicAddress, 68 PublicAddress: u.PublicAddress,
69 PrivateAddress: u.PrivateAddress, 69 PrivateAddress: u.PrivateAddress,
70 MachineId: u.MachineId, 70 MachineId: u.MachineId,
71 Resolved: u.Resolved,
72 Ports: u.Ports, 71 Ports: u.Ports,
73 } 72 }
74 if u.CharmURL != nil { 73 if u.CharmURL != nil {
75 info.CharmURL = u.CharmURL.String() 74 info.CharmURL = u.CharmURL.String()
76 } 75 }
77 oldInfo := store.Get(info.EntityId()) 76 oldInfo := store.Get(info.EntityId())
78 if oldInfo == nil { 77 if oldInfo == nil {
79 // We're adding the entry for the first time, 78 // We're adding the entry for the first time,
80 // so fetch the associated unit status. 79 // so fetch the associated unit status.
81 sdoc, err := getStatus(st, unitGlobalKey(u.Name)) 80 sdoc, err := getStatus(st, unitGlobalKey(u.Name))
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // than simply fetching each entity in turn. 371 // than simply fetching each entity in turn.
373 err := c.FindId(change.Id).One(doc) 372 err := c.FindId(change.Id).One(doc)
374 if err == mgo.ErrNotFound { 373 if err == mgo.ErrNotFound {
375 return doc.removed(b.st, all, change.Id) 374 return doc.removed(b.st, all, change.Id)
376 } 375 }
377 if err != nil { 376 if err != nil {
378 return err 377 return err
379 } 378 }
380 return doc.updated(b.st, all, change.Id) 379 return doc.updated(b.st, all, change.Id)
381 } 380 }
OLDNEW
« no previous file with comments | « state/apiserver/apiserver.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