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
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, 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>
[src]

Persists a session, either creating a new session or updating an existing session.

fn read_session(
    &self,
    identifier: SessionIdentifier
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, SessionError>> + Send>>
[src]

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>
[src]

Drops a session from the underlying storage.

Loading content...

Implementors

impl Backend for MemoryBackend[src]

Loading content...