class_docstr: Router that performs longest prefix matches on incoming routes.
class_docstr_tok: ["Router","that","performs","longest","prefix","matches","on","incoming","routes","."]
code: def __init__(self, get_handle: Callable, protocol: RequestProtocol):
      # Function to get a handle given a name. Used to mock for testing.
      self._get_handle = get_handle
      # Protocol to config handle
      self._protocol = protocol
      # Routes sorted in order of decreasing length.
      self.sorted_routes: List[str] = list()
      # Endpoints associated with the routes.
      self.route_info: Dict[str, EndpointTag] = dict()
      # Contains a ServeHandle for each endpoint.
      self.handles: Dict[EndpointTag, RayServeHandle] = dict()
      # Map of application name to is_cross_language.
      self.app_to_is_cross_language: Dict[
          ApplicationName, bool
      ] = dict()
  
file_path: ray/python/ray/serve/_private/proxy_router.py
imports: import logging
  from abc import ABC, abstractmethod
  from typing import Callable, Dict, List, Optional, Tuple
  from ray.serve._private.common import ApplicationName, EndpointInfo, EndpointTag, RequestProtocol
  from ray.serve._private.constants import RAY_SERVE_PROXY_PREFER_LOCAL_NODE_ROUTING, SERVE_LOGGER_NAME
  from ray.serve.handle import RayServeHandle
label_desc: Use image node_id 1 to create a new LongestPrefixRouter object from inherited base classes: ProxyRouter with example: obj = LongestPrefixRouter(get_handle, protocol)