HTTPPool implements PeerPicker for a pool of HTTP peers.
| 37 | |
| 38 | // HTTPPool implements PeerPicker for a pool of HTTP peers. |
| 39 | type HTTPPool struct { |
| 40 | // Context optionally specifies a context for the server to use when it |
| 41 | // receives a request. |
| 42 | // If nil, the server uses the request's context |
| 43 | Context func(*http.Request) context.Context |
| 44 | |
| 45 | // Transport optionally specifies an http.RoundTripper for the client |
| 46 | // to use when it makes a request. |
| 47 | // If nil, the client uses http.DefaultTransport. |
| 48 | Transport func(context.Context) http.RoundTripper |
| 49 | |
| 50 | // this peer's base URL, e.g. "https://example.net:8000" |
| 51 | self string |
| 52 | |
| 53 | // opts specifies the options. |
| 54 | opts HTTPPoolOptions |
| 55 | |
| 56 | mu sync.Mutex // guards peers and httpGetters |
| 57 | peers *consistenthash.Map |
| 58 | httpGetters map[string]*httpGetter // keyed by e.g. "http://10.0.0.2:8008" |
| 59 | } |
| 60 | |
| 61 | // HTTPPoolOptions are the configurations of a HTTPPool. |
| 62 | type HTTPPoolOptions struct { |
nothing calls this directly
no outgoing calls
no test coverage detected