pub struct Router { /* private fields */ }Expand description
Multi-upstream router
Selects the appropriate upstream based on route matching rules. Each upstream uses Pingora’s LoadBalancer (even for single backends).
Implementations§
Source§impl Router
impl Router
Sourcepub fn from_config(config: &TomlConfig) -> Result<Self>
pub fn from_config(config: &TomlConfig) -> Result<Self>
Create router from TOML configuration
Sourcepub fn select_upstream(&self, session: &Session) -> Result<&Arc<Upstream>>
pub fn select_upstream(&self, session: &Session) -> Result<&Arc<Upstream>>
Select upstream based on request matching
Returns the first matching upstream, or error if no route matches.
Sourcepub fn find_matching_route(&self, session: &Session) -> Option<&Route>
pub fn find_matching_route(&self, session: &Session) -> Option<&Route>
Find the matching route for path transformation
This is used during upstream_request_filter to apply path rewriting.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Router
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl !UnwindSafe for Router
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more