pub struct GeoRouter { /* private fields */ }Expand description
Geo-aware router for multi-region routing
Implementations§
Source§impl GeoRouter
impl GeoRouter
Sourcepub fn set_default_policy(&self, policy: RoutingPolicy)
pub fn set_default_policy(&self, policy: RoutingPolicy)
Set default routing policy
Sourcepub fn register_location(
&self,
region: impl Into<String>,
location: GeoLocation,
)
pub fn register_location( &self, region: impl Into<String>, location: GeoLocation, )
Register region location
Sourcepub fn update_latency(&self, region: impl Into<String>, latency_ms: u32)
pub fn update_latency(&self, region: impl Into<String>, latency_ms: u32)
Update region latency
Sourcepub fn update_health(&self, region: impl Into<String>, healthy: bool)
pub fn update_health(&self, region: impl Into<String>, healthy: bool)
Update region health
Sourcepub fn add_static_route(&self, service: impl Into<String>, route: RegionRoute)
pub fn add_static_route(&self, service: impl Into<String>, route: RegionRoute)
Add static route for a service
Sourcepub fn route(
&self,
client_location: Option<&GeoLocation>,
policy: Option<RoutingPolicy>,
) -> Option<String>
pub fn route( &self, client_location: Option<&GeoLocation>, policy: Option<RoutingPolicy>, ) -> Option<String>
Route request to best region
Sourcepub fn route_service(
&self,
service: &str,
client_location: Option<&GeoLocation>,
) -> Option<String>
pub fn route_service( &self, service: &str, client_location: Option<&GeoLocation>, ) -> Option<String>
Route for a specific service
Sourcepub fn get_preferred_regions(
&self,
client_location: Option<&GeoLocation>,
) -> Vec<String>
pub fn get_preferred_regions( &self, client_location: Option<&GeoLocation>, ) -> Vec<String>
Get all healthy regions sorted by preference
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GeoRouter
impl !RefUnwindSafe for GeoRouter
impl Send for GeoRouter
impl Sync for GeoRouter
impl Unpin for GeoRouter
impl UnwindSafe for GeoRouter
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more