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

Side by Side Diff: worker/peergrouper/worker.go

Issue 83130045: worker/peergrouper: use mongo.SelectPeerHostPort
Patch Set: Created 9 years, 12 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
« agent/mongo/mongo_test.go ('K') | « agent/mongo/mongo_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 Canonical Ltd. 1 // Copyright 2014 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 peergrouper 4 package peergrouper
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 "sync" 8 "sync"
9 "time" 9 "time"
10 10
11 » "launchpad.net/tomb" 11 » "launchpad.net/juju-core/agent/mongo"
12
13 "launchpad.net/juju-core/errors" 12 "launchpad.net/juju-core/errors"
14 "launchpad.net/juju-core/instance" 13 "launchpad.net/juju-core/instance"
15 "launchpad.net/juju-core/replicaset" 14 "launchpad.net/juju-core/replicaset"
16 "launchpad.net/juju-core/state" 15 "launchpad.net/juju-core/state"
17 "launchpad.net/juju-core/worker" 16 "launchpad.net/juju-core/worker"
17 "launchpad.net/tomb"
rog 2014/04/02 15:45:20 this should go in its own section, just after "tim
wwitzel3 2014/04/02 16:16:51 Done.
18 ) 18 )
19 19
20 type stateInterface interface { 20 type stateInterface interface {
21 Machine(id string) (stateMachine, error) 21 Machine(id string) (stateMachine, error)
22 WatchStateServerInfo() state.NotifyWatcher 22 WatchStateServerInfo() state.NotifyWatcher
23 StateServerInfo() (*state.StateServerInfo, error) 23 StateServerInfo() (*state.StateServerInfo, error)
24 MongoSession() mongoSession 24 MongoSession() mongoSession
25 } 25 }
26 26
27 type stateMachine interface { 27 type stateMachine interface {
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 wantsVote bool 425 wantsVote bool
426 apiHostPorts []instance.HostPort 426 apiHostPorts []instance.HostPort
427 mongoHostPorts []instance.HostPort 427 mongoHostPorts []instance.HostPort
428 428
429 worker *pgWorker 429 worker *pgWorker
430 stm stateMachine 430 stm stateMachine
431 machineWatcher state.NotifyWatcher 431 machineWatcher state.NotifyWatcher
432 } 432 }
433 433
434 func (m *machine) mongoHostPort() string { 434 func (m *machine) mongoHostPort() string {
435 » return instance.SelectInternalHostPort(m.mongoHostPorts, false) 435 » return mongo.SelectPeerHostPort(m.mongoHostPorts)
436 } 436 }
437 437
438 func (m *machine) String() string { 438 func (m *machine) String() string {
439 return m.id 439 return m.id
440 } 440 }
441 441
442 func (m *machine) GoString() string { 442 func (m *machine) GoString() string {
443 return fmt.Sprintf("&peergrouper.machine{id: %q, wantsVote: %v, hostPort : %q}", m.id, m.wantsVote, m.mongoHostPort()) 443 return fmt.Sprintf("&peergrouper.machine{id: %q, wantsVote: %v, hostPort : %q}", m.id, m.wantsVote, m.mongoHostPort())
444 } 444 }
445 445
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 517 }
518 518
519 func inStrings(t string, ss []string) bool { 519 func inStrings(t string, ss []string) bool {
520 for _, s := range ss { 520 for _, s := range ss {
521 if s == t { 521 if s == t {
522 return true 522 return true
523 } 523 }
524 } 524 }
525 return false 525 return false
526 } 526 }
OLDNEW
« agent/mongo/mongo_test.go ('K') | « agent/mongo/mongo_test.go ('k') | no next file » | no next file with comments »

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