Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::retry_executor_registry Class Reference

Retry executor registry. More...

#include <fault_tolerance_manager.h>

Collaboration diagram for kcenon::monitoring::retry_executor_registry:
Collaboration graph

Public Member Functions

template<typename T >
void register_executor (const std::string &name, std::shared_ptr< retry_executor< T > > executor)
 
template<typename T >
std::shared_ptr< retry_executor< T > > get_executor (const std::string &name)
 
void remove_executor (const std::string &name)
 
std::vector< std::string > get_all_names () const
 
void clear ()
 

Private Attributes

std::mutex mutex_
 
std::unordered_map< std::string, std::any > registry_
 

Detailed Description

Retry executor registry.

Definition at line 314 of file fault_tolerance_manager.h.

Member Function Documentation

◆ clear()

void kcenon::monitoring::retry_executor_registry::clear ( )
inline

Definition at line 347 of file fault_tolerance_manager.h.

347 {
348 std::lock_guard<std::mutex> lock(mutex_);
349 registry_.clear();
350 }
std::unordered_map< std::string, std::any > registry_

References mutex_, and registry_.

Referenced by FaultToleranceTest::TearDown().

Here is the caller graph for this function:

◆ get_all_names()

std::vector< std::string > kcenon::monitoring::retry_executor_registry::get_all_names ( ) const
inline

Definition at line 337 of file fault_tolerance_manager.h.

337 {
338 std::lock_guard<std::mutex> lock(mutex_);
339 std::vector<std::string> names;
340 names.reserve(registry_.size());
341 for (const auto& pair : registry_) {
342 names.push_back(pair.first);
343 }
344 return names;
345 }

References mutex_, and registry_.

◆ get_executor()

template<typename T >
std::shared_ptr< retry_executor< T > > kcenon::monitoring::retry_executor_registry::get_executor ( const std::string & name)
inline

Definition at line 323 of file fault_tolerance_manager.h.

323 {
324 std::lock_guard<std::mutex> lock(mutex_);
325 auto it = registry_.find(name);
326 if (it != registry_.end()) {
327 return std::any_cast<std::shared_ptr<retry_executor<T>>>(it->second);
328 }
329 return nullptr;
330 }

References mutex_, and registry_.

◆ register_executor()

template<typename T >
void kcenon::monitoring::retry_executor_registry::register_executor ( const std::string & name,
std::shared_ptr< retry_executor< T > > executor )
inline

Definition at line 317 of file fault_tolerance_manager.h.

317 {
318 std::lock_guard<std::mutex> lock(mutex_);
319 registry_[name] = std::move(executor);
320 }

References mutex_, and registry_.

◆ remove_executor()

void kcenon::monitoring::retry_executor_registry::remove_executor ( const std::string & name)
inline

Definition at line 332 of file fault_tolerance_manager.h.

332 {
333 std::lock_guard<std::mutex> lock(mutex_);
334 registry_.erase(name);
335 }

References mutex_, and registry_.

Member Data Documentation

◆ mutex_

std::mutex kcenon::monitoring::retry_executor_registry::mutex_
mutableprivate

◆ registry_

std::unordered_map<std::string, std::any> kcenon::monitoring::retry_executor_registry::registry_
private

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