Documentation ¶
Index ¶
Constants ¶
View Source
const DECAY = 0.1
tracks last 10 samples (very fast)
Variables ¶
View Source
var (
ErrNoNodes = errors.New("no nodes available")
)
Functions ¶
Types ¶
type Config ¶
type Config struct { DBurl string `json:"db_url"` Listen string `json:"port"` ZipkinURL string `json:"zipkin_url"` Nodes []string `json:"nodes"` HealthcheckInterval int `json:"healthcheck_interval"` HealthcheckEndpoint string `json:"healthcheck_endpoint"` HealthcheckUnhealthy int `json:"healthcheck_unhealthy"` HealthcheckTimeout int `json:"healthcheck_timeout"` MinAPIVersion *semver.Version `json:"min_api_version"` Transport *http.Transport }
type Grouper ¶
type Grouper interface { // List returns a set of hosts that may be used to route a request // for a given key. List(key string) ([]string, error) // Wrap allows adding middleware to the provided http.Handler. Wrap(http.Handler) http.Handler }
func NewAllGrouper ¶
NewAllGrouper returns a Grouper that will return the entire list of nodes that are being maintained, regardless of key. An 'AllGrouper' will health check servers at a specified interval, taking them in and out as they pass/fail and exposes endpoints for adding, removing and listing nodes.
type KeyFunc ¶
KeyFunc maps a request to a shard key, it may return an error if there are issues locating the shard key.
type Router ¶
type Router interface { // Route will pick a node from the given set of nodes. Route(nodes []string, key string) (string, error) // InterceptResponse allows a Router to extract information from proxied // requests so that it might do a better job next time. InterceptResponse // should not modify the Response as it has already been received nor the // Request, having already been sent. InterceptResponse(req *http.Request, resp *http.Response) // Wrap allows adding middleware to the provided http.Handler. Wrap(http.Handler) http.Handler }
func NewConsistentRouter ¶
Click to show internal directories.
Click to hide internal directories.