OLD | NEW |
1 // Copyright 2012, 2013 Canonical Ltd. | 1 // Copyright 2012, 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 api | 4 package api |
5 | 5 |
6 import ( | 6 import ( |
7 "code.google.com/p/go.net/websocket" | 7 "code.google.com/p/go.net/websocket" |
8 "crypto/tls" | 8 "crypto/tls" |
9 "crypto/x509" | 9 "crypto/x509" |
10 "launchpad.net/juju-core/cert" | 10 "launchpad.net/juju-core/cert" |
11 "launchpad.net/juju-core/log" | 11 "launchpad.net/juju-core/log" |
12 "launchpad.net/juju-core/rpc" | 12 "launchpad.net/juju-core/rpc" |
13 "launchpad.net/juju-core/rpc/jsoncodec" | 13 "launchpad.net/juju-core/rpc/jsoncodec" |
14 "launchpad.net/juju-core/state/api/params" | 14 "launchpad.net/juju-core/state/api/params" |
15 "launchpad.net/juju-core/utils" | 15 "launchpad.net/juju-core/utils" |
16 "time" | 16 "time" |
17 ) | 17 ) |
18 | 18 |
19 // PingPeriod defines how often the internal connection health check | 19 // PingPeriod defines how often the internal connection health check |
20 // will run. It's a variable so it can be changed in tests. | 20 // will run. It's a variable so it can be changed in tests. |
21 var PingPeriod = 1 * time.Minute | 21 var PingPeriod = 1 * time.Minute |
22 | 22 |
23 type State struct { | 23 type State struct { |
24 client *rpc.Conn | 24 client *rpc.Conn |
25 conn *websocket.Conn | 25 conn *websocket.Conn |
26 | 26 |
| 27 // authTag holds the authenticated entity's tag after login. |
| 28 authTag string |
| 29 |
27 // broken is a channel that gets closed when the connection is | 30 // broken is a channel that gets closed when the connection is |
28 // broken. | 31 // broken. |
29 broken chan struct{} | 32 broken chan struct{} |
30 } | 33 } |
31 | 34 |
32 // Info encapsulates information about a server holding juju state and | 35 // Info encapsulates information about a server holding juju state and |
33 // can be used to make a connection to it. | 36 // can be used to make a connection to it. |
34 type Info struct { | 37 type Info struct { |
35 // Addrs holds the addresses of the state servers. | 38 // Addrs holds the addresses of the state servers. |
36 Addrs []string | 39 Addrs []string |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 func (s *State) Broken() <-chan struct{} { | 167 func (s *State) Broken() <-chan struct{} { |
165 return s.broken | 168 return s.broken |
166 } | 169 } |
167 | 170 |
168 // RPCClient returns the RPC client for the state, so that testing | 171 // RPCClient returns the RPC client for the state, so that testing |
169 // functions can tickle parts of the API that the conventional entry | 172 // functions can tickle parts of the API that the conventional entry |
170 // points don't reach. This is exported for testing purposes only. | 173 // points don't reach. This is exported for testing purposes only. |
171 func (s *State) RPCClient() *rpc.Conn { | 174 func (s *State) RPCClient() *rpc.Conn { |
172 return s.client | 175 return s.client |
173 } | 176 } |
OLD | NEW |