Skip to main content

SessionIo

Struct SessionIo 

Source
pub struct SessionIo<'a> { /* private fields */ }
Expand description

Handler-facing control surface for one session.

The handler uses this to respond, relay, dial upstreams, and manage the session lifecycle. Buffer management is automatic: writes copy into pre-allocated pool slots (one user-space copy, zero malloc).

Implementations§

Source§

impl<'a> SessionIo<'a>

Source

pub fn slot_index(&self) -> u32

Session slot index (metrics/log correlation).

Source

pub fn respond(&mut self, bytes: &[u8])

Queues bytes to the downstream socket.

§Panics

Never panics; on pool exhaustion the write is queued as pending bytes (bounded by max_buffered — beyond that the session is killed as runaway).

Source

pub fn write_upstream(&mut self, bytes: &[u8])

Queues bytes to the upstream socket (must be connected).

Source

pub fn connect_upstream(&mut self, addr: SocketAddr) -> bool

Dials a TCP upstream for this session.

Returns false when the connect could not even start; the completion arrives via Handler::on_upstream_connected or Handler::on_upstream_error.

Source

pub fn connect_upstream_unix(&mut self, path: PathBuf) -> bool

Dials a Unix-domain-socket upstream.

Source

pub fn start_splice(&mut self) -> bool

Starts the zero-copy L4 splice pump (requires a connected upstream).

Source

pub fn downstream_eof_write(&mut self)

Half-closes the downstream write side (streaming completion).

Source

pub fn upstream_eof_write(&mut self)

Half-closes the upstream write side (end of request body).

Source

pub fn close(&mut self)

Closes the whole session.

Source

pub fn set_deadline(&mut self, at: Option<Instant>, reason: DeadlineReason)

Arms (or clears) the session’s single deadline slot with a reason.

Source

pub fn detach_upstream(&mut self) -> Option<RawFd>

Detaches the upstream fd without closing it (connection pooling). Returns the raw descriptor; the caller owns it from here.

Source

pub fn discard_upstream(&mut self)

Discards a dead upstream (close + epoch bump) so stale completions for its descriptor can never touch the session again.

Source

pub fn attach_upstream(&mut self, fd: RawFd) -> bool

Attaches a previously detached fd as this session’s upstream (connection pooling checkout) and arms its read.

Source

pub fn upstream_fd(&self) -> Option<RawFd>

Raw upstream descriptor (diagnostics).

Source

pub fn request_sent_upstream(&self) -> bool

true once the request head has been written to the upstream (failover decisions must not re-send after this point).

Source

pub fn mark_request_sent(&mut self)

Marks the request head as written upstream.

Source

pub fn peer(&self) -> Option<SocketAddr>

Peer address of the downstream connection.

Source

pub fn has_upstream(&self) -> bool

true when the session has a connected upstream.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for SessionIo<'a>

§

impl<'a> !Send for SessionIo<'a>

§

impl<'a> !Sync for SessionIo<'a>

§

impl<'a> !UnwindSafe for SessionIo<'a>

§

impl<'a> Freeze for SessionIo<'a>

§

impl<'a> Unpin for SessionIo<'a>

§

impl<'a> UnsafeUnpin for SessionIo<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V