Trait gotham::middleware::session::Backend
[−]
[src]
pub trait Backend: Send { fn persist_session(
&self,
identifier: SessionIdentifier,
content: &[u8]
) -> Result<(), SessionError>; fn read_session(
&self,
identifier: SessionIdentifier
) -> Box<Future<Item = Option<Vec<u8>>, Error = SessionError> + Send>; fn drop_session(
&self,
identifier: SessionIdentifier
) -> Result<(), SessionError>; }
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,
identifier: SessionIdentifier,
content: &[u8]
) -> Result<(), SessionError>
&self,
identifier: SessionIdentifier,
content: &[u8]
) -> Result<(), SessionError>
Persists a session, either creating a new session or updating an existing session.
fn read_session(
&self,
identifier: SessionIdentifier
) -> Box<Future<Item = Option<Vec<u8>>, Error = SessionError> + Send>
&self,
identifier: SessionIdentifier
) -> Box<Future<Item = Option<Vec<u8>>, Error = SessionError> + Send>
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,
identifier: SessionIdentifier
) -> Result<(), SessionError>
&self,
identifier: SessionIdentifier
) -> Result<(), SessionError>
Drops a session from the underlying storage.
Implementors
impl Backend for MemoryBackend