Left: | ||
Right: |
OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |