RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
rtctk::componentFramework::ServiceRegistryIf Class Referenceabstract

Class that implements a service registry to be used by the service discovery. More...

#include <rtctk/componentFramework/serviceRegistryIf.hpp>

Inheritance diagram for rtctk::componentFramework::ServiceRegistryIf:
rtctk::componentFramework::ConsulServiceRegistryAdapter rtctk::componentFramework::FileServiceRegistryAdapter

Classes

class  ConsulUnavailable
 
class  InvalidComponent
 
class  InvalidService
 

Public Types

using AdapterIdType = elt::mal::Uri
 The type used to distinguish between different adapters implementing ServiceRegistryIf.
 
using ServiceEndpoint = elt::mal::Uri
 

Public Member Functions

virtual ~ServiceRegistryIf ()=default
 virtual destructor
 
virtual std::vector< std::string > ListComponents (const std::string &service_type=COMPONENT_TYPE)=0
 Get known components.
 
virtual ServiceEndpoint GetOldbEndpoint ()=0
 Get the Oldb Endpoint from the service registry.
 
virtual ServiceEndpoint GetRuntimeRepoEndpoint ()=0
 Get the Runtime Repository Endpoint from the service registry.
 
virtual ServiceEndpoint GetPersistentRepoEndpoint ()=0
 Get the Persistent Repository Endpoint from the service registry.
 
virtual ServiceEndpoint Get (const std::string &comp_name, const std::string &service_name, const std::string &service_type=COMPONENT_TYPE, const bool health_check=true)=0
 Get endpoint of specific service of a specific component.
 

Static Public Member Functions

static std::unique_ptr< ServiceRegistryIfCreateAdapter (const elt::mal::Uri &uri)
 Factory method used to create the appropriate service registry adapter depending on the URI scheme.
 

Static Public Attributes

static const std::string REQ_REP_ENDPOINT = "req_rep_endpoint"
 the string used to identify the Request/Reply endpoint of a service when using the Get function.
 
static const std::string PUB_SUB_ENDPOINT = "pub_sub_endpoint"
 the string used to identify the PubSub endpoint of a service when using the Get function.
 
static const std::string COMPONENT_TYPE = "rtctk_component"
 the string for component type (default)
 

Detailed Description

Class that implements a service registry to be used by the service discovery.

Member Typedef Documentation

◆ AdapterIdType

The type used to distinguish between different adapters implementing ServiceRegistryIf.

This is used to specialise the FactoryRegistry to make it suitable for adapter factories discriminated using a URI to select different backend implementations of the repository service.

◆ ServiceEndpoint

Constructor & Destructor Documentation

◆ ~ServiceRegistryIf()

virtual rtctk::componentFramework::ServiceRegistryIf::~ServiceRegistryIf ( )
virtualdefault

virtual destructor

Member Function Documentation

◆ CreateAdapter()

std::unique_ptr< ServiceRegistryIf > rtctk::componentFramework::ServiceRegistryIf::CreateAdapter ( const elt::mal::Uri & uri)
static

Factory method used to create the appropriate service registry adapter depending on the URI scheme.

The URI schemes supported by the factory method include the following:

Parameters
[in]uriThe URI of the registry that needs to be accessed.
Returns
A unique pointer to the newly created adapter object. The caller must clean the object up once it is no longer needed.
Exceptions
UnsupportedUriExceptionIf the URI is not supported.
AdapterCreationExceptionIf the factory failed to create a new instance. This will contain nested exceptions caught from the adapter class constructor.
Thread Safety
thread-safe
Exception Safety
basic

◆ Get()

virtual ServiceEndpoint rtctk::componentFramework::ServiceRegistryIf::Get ( const std::string & comp_name,
const std::string & service_name,
const std::string & service_type = COMPONENT_TYPE,
const bool health_check = true )
pure virtual

Get endpoint of specific service of a specific component.

Parameters
comp_namename of the (component) instance
service_namename of the service, Must be one of the REQ_REP_ENDPOINT or PUB_SUB_ENDPOINT contants defined in ServiceRegistryIf
service_typetype of service e.g. rtctk_component
health_checkif should be checked for the health of component before returning a valid endpoint
Returns
ServiceEndpoint
Exceptions
InvalidServiceif service_name or InvalidComponent if comp_name invalid

Implemented in rtctk::componentFramework::ConsulServiceRegistryAdapter, and rtctk::componentFramework::FileServiceRegistryAdapter.

◆ GetOldbEndpoint()

virtual ServiceEndpoint rtctk::componentFramework::ServiceRegistryIf::GetOldbEndpoint ( )
pure virtual

Get the Oldb Endpoint from the service registry.

Implemented in rtctk::componentFramework::ConsulServiceRegistryAdapter, and rtctk::componentFramework::FileServiceRegistryAdapter.

◆ GetPersistentRepoEndpoint()

virtual ServiceEndpoint rtctk::componentFramework::ServiceRegistryIf::GetPersistentRepoEndpoint ( )
pure virtual

Get the Persistent Repository Endpoint from the service registry.

Implemented in rtctk::componentFramework::ConsulServiceRegistryAdapter, and rtctk::componentFramework::FileServiceRegistryAdapter.

◆ GetRuntimeRepoEndpoint()

virtual ServiceEndpoint rtctk::componentFramework::ServiceRegistryIf::GetRuntimeRepoEndpoint ( )
pure virtual

Get the Runtime Repository Endpoint from the service registry.

Implemented in rtctk::componentFramework::ConsulServiceRegistryAdapter, and rtctk::componentFramework::FileServiceRegistryAdapter.

◆ ListComponents()

virtual std::vector< std::string > rtctk::componentFramework::ServiceRegistryIf::ListComponents ( const std::string & service_type = COMPONENT_TYPE)
pure virtual

Get known components.

Use this method to retrieve all components known to the service registry

Parameters
service_typetype of service e.g. rtctk_component
Returns
vector of pairs containing the component names

Implemented in rtctk::componentFramework::ConsulServiceRegistryAdapter, and rtctk::componentFramework::FileServiceRegistryAdapter.

Member Data Documentation

◆ COMPONENT_TYPE

const std::string rtctk::componentFramework::ServiceRegistryIf::COMPONENT_TYPE = "rtctk_component"
static

the string for component type (default)

◆ PUB_SUB_ENDPOINT

const std::string rtctk::componentFramework::ServiceRegistryIf::PUB_SUB_ENDPOINT = "pub_sub_endpoint"
static

the string used to identify the PubSub endpoint of a service when using the Get function.

◆ REQ_REP_ENDPOINT

const std::string rtctk::componentFramework::ServiceRegistryIf::REQ_REP_ENDPOINT = "req_rep_endpoint"
static

the string used to identify the Request/Reply endpoint of a service when using the Get function.


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