Trait gotham::middleware::session::Backend [−][src]
pub trait Backend: Send {
fn persist_session(
&self,
state: &State,
identifier: SessionIdentifier,
content: &[u8]
) -> Pin<Box<SetSessionFuture>>;
fn read_session(
&self,
state: &State,
identifier: SessionIdentifier
) -> Pin<Box<GetSessionFuture>>;
fn drop_session(
&self,
state: &State,
identifier: SessionIdentifier
) -> Pin<Box<SetSessionFuture>>;
}
Expand description
A Backend
receives session data and stores it, and recalls the session data subsequently.
All session data is serialized into a Vec<u8>
which is treated as opaque by the backend. The
serialization format is subject to change and must not be relied upon by the Backend
.
Required methods
fn persist_session(
&self,
state: &State,
identifier: SessionIdentifier,
content: &[u8]
) -> Pin<Box<SetSessionFuture>>
fn persist_session(
&self,
state: &State,
identifier: SessionIdentifier,
content: &[u8]
) -> Pin<Box<SetSessionFuture>>
Persists a session, either creating a new session or updating an existing session.
fn read_session(
&self,
state: &State,
identifier: SessionIdentifier
) -> Pin<Box<GetSessionFuture>>
fn read_session(
&self,
state: &State,
identifier: SessionIdentifier
) -> Pin<Box<GetSessionFuture>>
Retrieves a session from the underlying storage.
The returned future will resolve to an Option<Vec<u8>>
on success, where a value of
None
indicates that the session is not available for use and a new session should be
established.
fn drop_session(
&self,
state: &State,
identifier: SessionIdentifier
) -> Pin<Box<SetSessionFuture>>
fn drop_session(
&self,
state: &State,
identifier: SessionIdentifier
) -> Pin<Box<SetSessionFuture>>
Drops a session from the underlying storage.