$darkmode
oak::LockedRegistrar Class Reference

#include <registrar.hpp>

Inheritance diagram for oak::LockedRegistrar:
Collaboration diagram for oak::LockedRegistrar:

Public Member Functions

void register_handler (const std::string &route, cloe::Handler h) override
 
std::unique_lock< std::shared_mutex > lock ()
 
 StaticRegistrar (Server *s)
 
 StaticRegistrar (Server *s, const std::string &prefix, Middleware m)
 
- Public Member Functions inherited from oak::StaticRegistrar
 StaticRegistrar (Server *s)
 
 StaticRegistrar (Server *s, const std::string &prefix, Middleware m)
 
void set_prefix (const std::string &prefix)
 
void set_logger (Logger logger)
 
const std::vector< std::string > & endpoints () const
 
- Public Member Functions inherited from oak::Registrar
 Registrar (const Registrar *r, const std::string &prefix, Middleware m)
 
Registrar with (const std::string &prefix, Middleware m) const
 
Registrar with_prefix (const std::string &prefix) const
 
Registrar with_middleware (Middleware m) const
 
std::string prefix () const
 
Middleware middleware () const
 

Additional Inherited Members

- Protected Member Functions inherited from oak::StaticRegistrar
void log (const std::string &endpoint)
 
- Protected Member Functions inherited from oak::Registrar
 Registrar (const std::string &prefix, Middleware m)
 
- Protected Attributes inherited from oak::StaticRegistrar
Serverserver_
 
Logger logger_
 
std::vector< std::string > endpoints_
 
- Protected Attributes inherited from oak::Registrar
Registrarproxy_ {nullptr}
 
std::string prefix_
 
Middleware middleware_
 

Detailed Description

LockedRegistrar provides a registrar implementation that is safe for dynamically changing data content handlers.

The contract requires a write lock to be acquired before changing any of the data that might be access from handlers added. When the write lock is held, all requests are blocked to avoid data races.

The throughput of requests is strongly limited by this registrar.

Member Function Documentation

◆ lock()

std::unique_lock<std::shared_mutex> oak::LockedRegistrar::lock ( )
inline

Return a unique lock guard so that the backing data can be modified.

On destruction, the lock is released.

Here is the caller graph for this function:

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