Trait sozu_lib::ProxySession
source · pub trait ProxySession {
// Required methods
fn protocol(&self) -> Protocol;
fn ready(&mut self, session: Rc<RefCell<dyn ProxySession>>) -> bool;
fn update_readiness(&mut self, token: Token, events: Ready);
fn close(&mut self);
fn timeout(&mut self, t: Token) -> bool;
fn last_event(&self) -> Instant;
fn print_session(&self);
fn frontend_token(&self) -> Token;
fn shutting_down(&mut self) -> bool;
}
Expand description
trait that must be implemented by listeners and client sessions
Required Methods§
sourcefn protocol(&self) -> Protocol
fn protocol(&self) -> Protocol
indicates the protocol associated with the session
this is used to distinguish sessions from listenrs, channels, metrics and timers
sourcefn ready(&mut self, session: Rc<RefCell<dyn ProxySession>>) -> bool
fn ready(&mut self, session: Rc<RefCell<dyn ProxySession>>) -> bool
if a session received an event or can still execute, the event loop will call this method. Its result indicates if it can still execute, needs to connect to a backend server, close the session
sourcefn update_readiness(&mut self, token: Token, events: Ready)
fn update_readiness(&mut self, token: Token, events: Ready)
if the event loop got an event for a token associated with the session, it will call this method on the session
sourcefn close(&mut self)
fn close(&mut self)
close a session, frontend and backend sockets, remove the entries from the session manager slab
sourcefn timeout(&mut self, t: Token) -> bool
fn timeout(&mut self, t: Token) -> bool
if a timeout associated with the session triggers, the event loop will call this method with the timeout’s token
sourcefn last_event(&self) -> Instant
fn last_event(&self) -> Instant
last time the session got an event
sourcefn print_session(&self)
fn print_session(&self)
display the session’s internal state (for debugging purpose)
sourcefn frontend_token(&self) -> Token
fn frontend_token(&self) -> Token
get the token associated with the frontend
sourcefn shutting_down(&mut self) -> bool
fn shutting_down(&mut self) -> bool
tell the session it has to shut down if possible
if the session handles HTTP requests, it will not close until the response is completely sent back to the client