Struct sozu_lib::server::Server

source ·
pub struct Server {
    pub poll: Poll,
    /* private fields */
}
Expand description

Server handles the event loop, the listeners, the sessions and communication with the configuration channel.

A listener wraps a listen socket, the associated proxying protocols (HTTP, HTTPS and TCP) and the routing configuration for clusters. Listeners handle creating sessions from accepted sockets.

A session manages a “front” socket for a connected client, and all of the associated data (back socket, protocol state machine, buffers, metrics…).

Server gets configuration updates from the channel (domIN/path routes, backend server address…).

Listeners and sessions are all stored in a slab structure to index them by a Token, they all have to implement the ProxySession trait.

Fields§

§poll: Poll

Implementations§

source§

impl Server

source

pub fn try_new_from_config( worker_to_main_channel: ProxyChannel, worker_to_main_scm: ScmSocket, config: ServerConfig, initial_state: InitialState, expects_initial_status: bool ) -> Result<Self, ServerError>

source

pub fn new( poll: Poll, channel: ProxyChannel, scm: ScmSocket, sessions: Rc<RefCell<SessionManager>>, pool: Rc<RefCell<Pool>>, backends: Rc<RefCell<BackendMap>>, http: Option<HttpProxy>, https: Option<HttpsProxy>, tcp: Option<TcpProxy>, server_config: ServerConfig, initial_state: Option<InitialState>, expects_initial_status: bool ) -> Result<Self, ServerError>

source

pub fn run(&mut self)

The server runs in a loop until a shutdown is ordered

source

pub fn notify_proxys(&mut self, request: WorkerRequest)

source

pub fn return_listen_sockets(&mut self) -> Result<(), ScmSocketError>

Send all socket addresses and file descriptors of all proxies, via the scm socket

source

pub fn to_session(&self, token: Token) -> SessionToken

source

pub fn from_session(&self, token: SessionToken) -> Token

source

pub fn accept(&mut self, token: ListenToken, protocol: Protocol)

source

pub fn create_sessions(&mut self)

source

pub fn ready(&mut self, token: Token, events: Ready)

source

pub fn timeout(&mut self, token: Token)

source

pub fn handle_remaining_readiness(&mut self)

Auto Trait Implementations§

§

impl !Freeze for Server

§

impl !RefUnwindSafe for Server

§

impl !Send for Server

§

impl !Sync for Server

§

impl Unpin for Server

§

impl !UnwindSafe for Server

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

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<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> Same for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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