pub struct HelloHandler { /* private fields */ }Expand description
Deterministic Hello handler over an in-memory backend table.
Implementations§
Source§impl HelloHandler
impl HelloHandler
Sourcepub fn with_handoff_ack_deadline(self, ack_deadline: Duration) -> Self
pub fn with_handoff_ack_deadline(self, ack_deadline: Duration) -> Self
Override the backend ACK deadline for pending handoffs.
Sourcepub fn handoff_token_store(&self) -> MutexGuard<'_, HandoffTokenStore>
pub fn handoff_token_store(&self) -> MutexGuard<'_, HandoffTokenStore>
Lock the pending handoff token store owned by this handler.
The backend-side acceptance path
(backend_lib::accept_handed_off) consumes pending tokens from
this store exactly once.
Sourcepub fn handoff_ack_registry(&self) -> MutexGuard<'_, HandoffAckRegistry>
pub fn handoff_ack_registry(&self) -> MutexGuard<'_, HandoffAckRegistry>
Lock the pending handoff ACK registry owned by this handler.
Every token issued during Hello negotiation is registered here and
must be acknowledged via HelloHandler::acknowledge_handoff before
the ACK deadline, or it is abandoned by
HelloHandler::expire_overdue_handoffs.
Sourcepub fn acknowledge_handoff(
&self,
token: &HandoffToken,
now: Instant,
) -> Result<AcknowledgedHandoff, HandoffAckError>
pub fn acknowledge_handoff( &self, token: &HandoffToken, now: Instant, ) -> Result<AcknowledgedHandoff, HandoffAckError>
Record that the backend adopted a handed-off connection.
Completes the pending handoff registered at Hello time and revokes the one-time token. Lock order: ACK registry, then token store.
Sourcepub fn expire_overdue_handoffs(&self, now: Instant) -> Vec<ExpiredHandoff>
pub fn expire_overdue_handoffs(&self, now: Instant) -> Vec<ExpiredHandoff>
Abandon every pending handoff whose backend ACK deadline has passed.
Each returned expiry has had its token revoked; callers must use the
backend_pipe reconnect fallback for the affected connections.
Sourcepub fn with_rate_limit(self, max_per_window: u32, window: Duration) -> Self
pub fn with_rate_limit(self, max_per_window: u32, window: Duration) -> Self
Override the per-peer Hello rate limit.
Sourcepub fn with_backend(
self,
backend: RegisteredBackend,
) -> Result<Self, HelloHandlerError>
pub fn with_backend( self, backend: RegisteredBackend, ) -> Result<Self, HelloHandlerError>
Register a backend by its service definition’s service name.
Sourcepub fn handle_frame(&self, frame: Frame, peer: PeerIdentity) -> HelloReply
pub fn handle_frame(&self, frame: Frame, peer: PeerIdentity) -> HelloReply
Decode and handle a framed v1 Hello request.
Sourcepub fn handle_request(&self, request: &HelloRequest) -> HelloReply
pub fn handle_request(&self, request: &HelloRequest) -> HelloReply
Validate a decoded Hello request and return a v1 HelloReply.
Trait Implementations§
Source§impl Debug for HelloHandler
impl Debug for HelloHandler
Source§impl Default for HelloHandler
impl Default for HelloHandler
Source§impl HelloResponder for HelloHandler
impl HelloResponder for HelloHandler
Source§fn handle_frame(&self, frame: Frame, peer: PeerIdentity) -> HelloReply
fn handle_frame(&self, frame: Frame, peer: PeerIdentity) -> HelloReply
Auto Trait Implementations§
impl !Freeze for HelloHandler
impl RefUnwindSafe for HelloHandler
impl Send for HelloHandler
impl Sync for HelloHandler
impl Unpin for HelloHandler
impl UnsafeUnpin for HelloHandler
impl UnwindSafe for HelloHandler
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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