Documentation
¶
Index ¶
- Constants
- Variables
- func JSON(w http.ResponseWriter, code int, v interface{}) error
- func LabelMatches(labels, query map[string]string) bool
- func ParseBody(r *http.Request, v interface{}) error
- func QueryFromRequest(r *http.Request) (map[string]string, error)
- func UpSelector(i *api.Instance) bool
- type HTTPError
- type InstanceSelectorFunc
- type OptionFunc
- type Server
Constants ¶
View Source
const ( DefaultAddress = "127.0.0.1:63412" DefaultPrefix = "/akins.org/onedari" )
Variables ¶
View Source
var ( DefaultEndpoints = []string{"http://127.0.0.1:2379", "http://127.0.0.1:4001"} MissingLabelError = errors.New("must have at least one label") MissingQueryError = errors.New("must have at least one label query") InvalidIDError = errors.New("invalid ID") EmptyNodeError = errors.New("empty node") InvalidInstanceError = errors.New("invalid instance") )
Functions ¶
func LabelMatches ¶
LabelMatches returns true if all the labels in query match label.
func UpSelector ¶
UpSelector returns true for instances that are "up".
Types ¶
type InstanceSelectorFunc ¶
func LabelSelector ¶
func LabelSelector(query map[string]string) InstanceSelectorFunc
LabelSelector returns true if the given query matches the instance.
func NodeSelector ¶
func NodeSelector(n *api.Node) InstanceSelectorFunc
NodeSelector returns true only if this instance is on the given node. This is a bit of a hack because of the naive search implementation we use.
type OptionFunc ¶
func Address ¶
func Address(addr string) OptionFunc
func EtcdEndpoints ¶
func EtcdEndpoints(endpoints []string) OptionFunc
func Prefix ¶
func Prefix(p string) OptionFunc
type Server ¶
func (*Server) ListInstances ¶
func (s *Server) ListInstances(selectors ...InstanceSelectorFunc) ([]*api.Instance, error)
ListInstances fetches all instances optionally using the query as a selector.
Click to show internal directories.
Click to hide internal directories.