// Routing specifies the routing value.
513527
func (s *CountService) Routing(routing string) *CountService {
	s.routing = routing
	return s
}
1331604
func Route(msg *Message, router Router) error {
	if router == nil {
		DiscardMessage(msg, "nil", fmt.Sprintf("Router for stream %s is nil", msg.GetStreamID().GetName()))
		return nil
	}

	action := router.Modulate(msg)
	streamName := msg.GetStreamID().GetName()

	switch action {
	case ModulateResultDiscard:
		MetricMessagesDiscarded.Inc(1)
		DiscardMessage(msg, router.GetID(), "Router discarded")
		return nil

	case ModulateResultContinue:
		MetricMessagesRouted.Inc(1)
		GetStreamMetric(msg.streamID).Routed.Inc(1)
		MessageTrace(msg, router.GetID(), "Routed")

		return router.Enqueue(msg)

	case ModulateResultFallback:
		if msg.GetStreamID() == router.GetStreamID() {

			prevStreamName := StreamRegistry.GetStreamName(msg.GetPrevStreamID())
			return NewModulateResultError("Routing loop detected for router %s (from %s)", streamName, prevStreamName)
		}

		// Do NOT route the original message in this case.
		// If a modulate pipeline returns fallback, the message might have been
		// modified already. To meet expectations the CHANGED message has to be
		// routed.

		return Route(msg, msg.GetRouter())
	}

	return NewModulateResultError("Unknown ModulateResult action: %d", action)
}
174810
func (s *ScrollService) Routing(routings ...string) *ScrollService {
	s.routing = strings.Join(routings, ",")
	return s
}
791571
func (w *WebService) Routes() []Route {
	if !w.dynamicRoutes {
		return w.routes
	}
	// Make a copy of the array to prevent concurrency problems
	w.routesLock.RLock()
	defer w.routesLock.RUnlock()
	result := make([]Route, len(w.routes))
	for ix := range w.routes {
		result[ix] = w.routes[ix]
	}
	return result
}
431930
func Routing(rt config.RoutingC) Option {
	return func(cfg *Config) error {
		if cfg.Routing != nil {
			return fmt.Errorf("cannot specify multiple routing options")
		}
		cfg.Routing = rt
		return nil
	}
}
1244042
func (a *AliasAddAction) SearchRouting(routing ...string) *AliasAddAction {
	a.searchRouting = strings.Join(routing, ",")
	return a
}
525848
func (r *Request) RoutePath() string {
	if r.route != nil {
		return r.route.Path
	}
	return ""
}
985467
func (c *Clientset) Route() routeinternalversion.RouteInterface {
	return &fakerouteinternalversion.FakeRoute{Fake: &c.Fake}
}
1279960
func (s *ExistsService) Routing(routing string) *ExistsService {
	s.routing = routing
	return s
}
372539
func (r *Router) Handle(method, path string, handlers []HandlerFunc) {
	handlers = r.combineHandlers(handlers)
	r.ace.httprouter.Handle(method, r.path(path), func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
		c := r.ace.createContext(w, req)
		c.params = params
		c.handlers = handlers
		c.Next()
		r.ace.pool.Put(c)
	})
}
761705
func (s *Server) Match(method string, route string, handler interface{}) {
	s.addRoute(route, method, handler)
}
933134
func (r *Route) Middleware(m Middleware) *Route {
	r.middleware = append(r.middleware, &middlewareForVerb{
		mid:  m,
		verb: flagAny,
	})
	return r
}
669199
func (s *DeleteService) Routing(routing string) *DeleteService {
	s.routing = routing
	return s
}
326306
func (rt *Router) Handle(method, path string, handler http.Handler) {
	if len(path) == 0 || path[0] != '/' {
		panic(fmt.Errorf("router: path %q must begin with %q", path, "/"))
	}

	// Get (or set) tree for method.
	n := rt.trees[method]
	if n == nil {
		n = new(node)
		rt.trees[method] = n
	}

	// Put parameters in their own node.
	parts := splitPath(path)
	var s string
	var params map[string]uint16
	for i, part := range parts {
		s += "/"
		if len(part) > 0 && part[0] == ':' { // It's a parameter.
			n.makeChild(s, params, nil, nil, (i == 0 && s == "/")) // Make child without ":".
			part = part[1:]
			reSep := strings.IndexByte(part, ':') // Search for a name/regexp separator.
			var re *regexp.Regexp
			if reSep == -1 { // No regular expression.
				if part == "" {
					panic(fmt.Errorf("router: path %q has anonymous parameter", path))
				}
				if params == nil {
					params = make(map[string]uint16)
				}
				params[part] = uint16(i) // Store parameter name with part index.

			} else { // Parameter comes with regular expression.
				if name := part[:reSep]; name != "" {
					if params == nil {
						params = make(map[string]uint16)
					}
					params[name] = uint16(i) // Store parameter name with part index.
				}
				res := part[reSep+1:]
				if res == "" {
					panic(fmt.Errorf("router: path %q has empty regular expression", path))
				}
				re = regexp.MustCompile(res)
			}
			s += ":"               // Only keep colon to represent parameter in tree.
			if i == len(parts)-1 { // Parameter is the last part: make it with handler.
				n.makeChild(s, params, re, handler, false)
			} else {
				n.makeChild(s, params, re, nil, false)
			}
		} else {
			s += part
			if i == len(parts)-1 { // Last part: make it with handler.
				if s != "/" && isWildcard(s) {
					if params == nil {
						params = make(map[string]uint16)
					}
					params["*"] = uint16(i)
				}
				n.makeChild(s, params, nil, handler, (i == 0 && s == "/"))
			}
		}
	}
}
100058
func (rb *route) Resolve() *route {
	for rb.Redirect != nil {
		rb = rb.Redirect
	}
	return rb
}
1151488
func (r *RuleRouter) Route(msg map[string]interface{}) map[string]interface{} {
	outputs := []map[string]interface{}{}
	for _, rule := range r.rules {
		if rule.Matches(msg) {
			outputs = append(outputs, rule.OutputFor(msg))
		}
	}
	return map[string]interface{}{
		"team":        teamName,
		"kv_version":  kv.Version,
		"kv_language": "go",
		"routes":      outputs,
	}
}
1324223
func (item *MultiGetItem) Routing(routing string) *MultiGetItem {
	item.routing = routing
	return item
}