Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHTTPHandler ¶
func RegisterHTTPHandler(universe *gc.Universe, opts *HTTPOptions, serveMux *http.ServeMux)
RegisterHTTPHandler sets up an HTTPHandler with a user specified path and serveMux (if non nil) to handle requests to the given Universe. If both opts and serveMux are nil, defaultBasePath and DefaultServeMux will be used. *You must use the same base path for the HTTPFetchProtocol and the HTTPHandler on the same Universe*.
If a serveMux is not specified, opencensus metrics will automatically wrap the handler. It is recommended to configure opencensus yourself if specifying a serveMux.
Types ¶
type HTTPFetchProtocol ¶
type HTTPFetchProtocol struct {
// contains filtered or unexported fields
}
HTTPFetchProtocol specifies HTTP specific options for HTTP-based peer communication
func NewHTTPFetchProtocol ¶
func NewHTTPFetchProtocol(opts *HTTPOptions) *HTTPFetchProtocol
NewHTTPFetchProtocol creates an HTTP fetch protocol to be passed into a Universe constructor; uses a user chosen base path specified in HTTPOptions (or the default "/_galaxycache/" base path if passed nil). *You must use the same base path for the HTTPFetchProtocol and the HTTPHandler on the same Universe*.
func (*HTTPFetchProtocol) NewFetcher ¶
func (hp *HTTPFetchProtocol) NewFetcher(url string) (gc.RemoteFetcher, error)
NewFetcher implements the Protocol interface for HTTPProtocol by constructing a new fetcher to fetch from peers via HTTP Prefixes URL with http:// if neither http:// nor https:// are prefixes of the URL argument.
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
HTTPHandler implements the HTTP handler necessary to serve an HTTP request; it contains a pointer to its parent Universe in order to access its galaxies
func (*HTTPHandler) ServeHTTP ¶
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTPOptions ¶
type HTTPOptions struct { Transport http.RoundTripper BasePath string Recorder stats.Recorder }
HTTPOptions can specify the transport, base path, and stats.Recorder for serving and fetching. *ONLY SPECIFY IF NOT USING THE DEFAULT "/_galaxycache/" BASE PATH*.