CatapultServer
v0.5.0.1 (Elephant)
|
A service locator for local node services. More...
Public Member Functions | |
ServiceLocator (const crypto::KeyPair &keyPair) | |
Creates a locator around keyPair. More... | |
~ServiceLocator () | |
Destroys the locator. More... | |
const crypto::KeyPair & | keyPair () const |
Gets the local key pair. More... | |
const std::vector< utils::DiagnosticCounter > & | counters () const |
Gets the diagnostic counters. More... | |
size_t | numServices () const |
Gets the number of registered services. More... | |
template<typename TService > | |
std::shared_ptr< TService > | service (const std::string &serviceName) const |
Gets the service with serviceName. More... | |
void | registerService (const std::string &serviceName, const std::shared_ptr< void > &pService) |
Adds a service (pService) with serviceName. More... | |
void | registerRootedService (const std::string &serviceName, const std::shared_ptr< void > &pService) |
Adds a rooted service (pService) with serviceName that is kept alive by the service locator. More... | |
template<typename TService , typename TSupplier > | |
void | registerServiceCounter (const std::string &serviceName, const std::string &counterName, TSupplier supplier) |
Adds a service-dependent counter with counterName for service serviceName given supplier. More... | |
Static Public Attributes | |
static constexpr uint64_t | Sentinel_Counter_Value = static_cast<uint64_t>(-1) |
Value that is returned when a statistics source is nullptr . More... | |
Private Member Functions | |
template<typename TService > | |
bool | tryGetService (const std::string &serviceName, std::shared_ptr< TService > &pService) const |
Private Attributes | |
const crypto::KeyPair & | m_keyPair |
std::vector< utils::DiagnosticCounter > | m_counters |
std::unordered_map< std::string, std::weak_ptr< void > > | m_services |
std::vector< std::pair< std::string, std::shared_ptr< void > > > | m_rootedServices |
A service locator for local node services.
|
inlineexplicit |
Creates a locator around keyPair.
|
inline |
Destroys the locator.
|
inline |
Gets the diagnostic counters.
|
inline |
Gets the local key pair.
|
inline |
Gets the number of registered services.
|
inline |
Adds a rooted service (pService) with serviceName that is kept alive by the service locator.
|
inline |
Adds a service (pService) with serviceName.
|
inline |
Adds a service-dependent counter with counterName for service serviceName given supplier.
|
inline |
Gets the service with serviceName.
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |
|
staticconstexpr |
Value that is returned when a statistics source is nullptr
.