pub struct Router { /* private fields */ }Expand description
Router manages the mapping between Tenants and Raft Nodes
Implementations§
Source§impl Router
impl Router
Sourcepub fn new(local_node_id: RaftNodeId) -> Self
pub fn new(local_node_id: RaftNodeId) -> Self
Create a new Router
Sourcepub fn update_route(&self, tenant_id: String, leader_node_id: RaftNodeId)
pub fn update_route(&self, tenant_id: String, leader_node_id: RaftNodeId)
Add or update a route for a tenant
Sourcepub fn remove_route(&self, tenant_id: &str)
pub fn remove_route(&self, tenant_id: &str)
Remove a route
Sourcepub fn route(&self, tenant_id: &str) -> Option<RouteResult>
pub fn route(&self, tenant_id: &str) -> Option<RouteResult>
Determine where to route a request for a given tenant
Sourcepub fn get_all_routes(&self) -> HashMap<String, RaftNodeId>
pub fn get_all_routes(&self) -> HashMap<String, RaftNodeId>
Get all known routes (for debugging/status)
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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