Malloy
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
malloy::http::sessions::manager Class Reference

Public Member Functions

 manager (std::shared_ptr< storage > storage)
 
 manager (const manager &other)=delete
 
 manager (manager &&other) noexcept=delete
 
virtual ~manager ()=default
 
manageroperator= (const manager &rhs)=delete
 
manageroperator= (manager &&rhs) noexcept=delete
 
std::shared_ptr< sessionget (const request_header<> &hdr)
 
std::shared_ptr< sessionget (const request<> &req)
 
std::shared_ptr< sessionget (const id_type &id)
 
std::shared_ptr< sessionstart (const request<> &req, response<> &resp)
 
void destroy (const request<> &req, response<> &resp)
 
std::size_t destroy_expired (const std::chrono::seconds &max_lifetime)
 
bool is_valid (const request<> &req)
 
bool is_valid (const malloy::http::request_header<> &hdr)
 
bool is_valid (const id_type &id)
 

Static Public Attributes

static constexpr const char * cookie_name = "sessionId"
 

Constructor & Destructor Documentation

◆ manager() [1/3]

manager::manager ( std::shared_ptr< storage storage)
explicit

Constructor.

This will throw std::invalid_argument if no valid storage is provided.

Parameters
storageThe session storage to use.

◆ manager() [2/3]

malloy::http::sessions::manager::manager ( const manager other)
delete

Copy constructor.

Parameters
other

◆ manager() [3/3]

malloy::http::sessions::manager::manager ( manager &&  other)
deletenoexcept

Move constructor.

Parameters
other

◆ ~manager()

virtual malloy::http::sessions::manager::~manager ( )
virtualdefault

Destructor.

Member Function Documentation

◆ destroy()

void manager::destroy ( const request<> &  req,
response<> &  resp 
)

Destroys an existing session.

Parameters
reqThe request.
respThe response.
See also
start()
Here is the call graph for this function:

◆ destroy_expired()

std::size_t manager::destroy_expired ( const std::chrono::seconds &  max_lifetime)

Destroys any sessions older than the specified max lifetime.

Parameters
max_lifetimeThe maximum lifetime of a session.
Returns
The number of sessions that were expired/destroyed.

◆ get() [1/3]

std::shared_ptr< session > manager::get ( const id_type &  id)

Get an existing session (if any).

Parameters
idThe session ID.
Returns
The session (if any).
See also
start()

◆ get() [2/3]

std::shared_ptr< session > malloy::http::sessions::manager::get ( const request<> &  req)
inline

Get an existing session (if any).

Parameters
reqThe HTTP request.
Returns
The session (if any).
See also
start()
Here is the call graph for this function:

◆ get() [3/3]

std::shared_ptr< session > manager::get ( const request_header<> &  hdr)

Get an existing session (if any).

Parameters
hdrThe HTTP request header.
Returns
The session (if any).
See also
start()
Here is the call graph for this function:

◆ is_valid() [1/3]

bool manager::is_valid ( const id_type &  id)

Checks whether the session is valid.

Parameters
idThe session id.
Returns
Whether the session is valid.
Here is the call graph for this function:

◆ is_valid() [2/3]

bool manager::is_valid ( const malloy::http::request_header<> &  hdr)

Checks whether the session is valid.

Parameters
hdrThe request header.
Returns
Whether the session is valid.
Here is the call graph for this function:

◆ is_valid() [3/3]

bool malloy::http::sessions::manager::is_valid ( const request<> &  req)
inline

Checks whether the session is valid.

Parameters
reqThe request.
Returns
Whether the session is valid.
Here is the call graph for this function:

◆ operator=() [1/2]

manager & malloy::http::sessions::manager::operator= ( const manager rhs)
delete

Copy assignment operator.

Parameters
rhs
Returns

◆ operator=() [2/2]

manager & malloy::http::sessions::manager::operator= ( manager &&  rhs)
deletenoexcept

Move assignment operator.

Parameters
rhs
Returns

◆ start()

std::shared_ptr< session > manager::start ( const request<> &  req,
response<> &  resp 
)

Get an existing session (if any) or create a new one.

Parameters
reqThe request.
respThe response.
Returns
The session.
See also
get()
delete()
Here is the call graph for this function:

Member Data Documentation

◆ cookie_name

constexpr const char* malloy::http::sessions::manager::cookie_name = "sessionId"
staticconstexpr

Name of the session cookie


The documentation for this class was generated from the following files: