RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
rtctk::componentFramework::ConsulServiceRegistryAdapter Class Reference

Class that implements a very basic service discovery mechanism using Consul. More...

#include <rtctk/componentFramework/consulServiceRegistryAdapter.hpp>

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

Public Member Functions

 ConsulServiceRegistryAdapter (const elt::mal::Uri &endpoint)
 
std::vector< std::string > ListComponents (const std::string &service_type=COMPONENT_TYPE) override
 Get known components.
 
ServiceEndpoint Get (const std::string &comp_name, const std::string &service_name, const std::string &service_type, const bool health_check) override
 Get endpoint of specific service of a specific component.
 
ServiceEndpoint GetOldbEndpoint () override
 Get the Oldb Endpoint from the service registry.
 
ServiceEndpoint GetRuntimeRepoEndpoint () override
 Get the Runtime Repository Endpoint from the service registry.
 
ServiceEndpoint GetPersistentRepoEndpoint () override
 Get the Persistent Repository Endpoint from the service registry.
 
bool IsComponent (const ppconsul::ServiceInfo &service_info, const std::string &service_type=COMPONENT_TYPE)
 
ppconsul::ServiceInfo GetComponentDefinedInConsul (const std::string &comp_name, const std::string &service_name, const std::string &service_type)
 
- Public Member Functions inherited from rtctk::componentFramework::ServiceRegistryIf
virtual ~ServiceRegistryIf ()=default
 virtual destructor
 

Static Public Attributes

static const std::string SUPPORTED_URI_SCHEME = "consul"
 
- Static Public Attributes inherited from rtctk::componentFramework::ServiceRegistryIf
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)
 

Additional Inherited Members

- Public Types inherited from rtctk::componentFramework::ServiceRegistryIf
using AdapterIdType = elt::mal::Uri
 The type used to distinguish between different adapters implementing ServiceRegistryIf.
 
using ServiceEndpoint = elt::mal::Uri
 
- Static Public Member Functions inherited from rtctk::componentFramework::ServiceRegistryIf
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.
 

Detailed Description

Class that implements a very basic service discovery mechanism using Consul.

Constructor & Destructor Documentation

◆ ConsulServiceRegistryAdapter()

rtctk::componentFramework::ConsulServiceRegistryAdapter::ConsulServiceRegistryAdapter ( const elt::mal::Uri & endpoint)

Member Function Documentation

◆ Get()

ConsulServiceRegistryAdapter::ServiceEndpoint rtctk::componentFramework::ConsulServiceRegistryAdapter::Get ( const std::string & comp_name,
const std::string & service_name,
const std::string & service_type,
const bool health_check )
overridevirtual

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

Implements rtctk::componentFramework::ServiceRegistryIf.

◆ GetComponentDefinedInConsul()

ppconsul::ServiceInfo rtctk::componentFramework::ConsulServiceRegistryAdapter::GetComponentDefinedInConsul ( const std::string & comp_name,
const std::string & service_name,
const std::string & service_type )

◆ GetOldbEndpoint()

ConsulServiceRegistryAdapter::ServiceEndpoint rtctk::componentFramework::ConsulServiceRegistryAdapter::GetOldbEndpoint ( )
overridevirtual

Get the Oldb Endpoint from the service registry.

Implements rtctk::componentFramework::ServiceRegistryIf.

◆ GetPersistentRepoEndpoint()

ConsulServiceRegistryAdapter::ServiceEndpoint rtctk::componentFramework::ConsulServiceRegistryAdapter::GetPersistentRepoEndpoint ( )
overridevirtual

Get the Persistent Repository Endpoint from the service registry.

Implements rtctk::componentFramework::ServiceRegistryIf.

◆ GetRuntimeRepoEndpoint()

ConsulServiceRegistryAdapter::ServiceEndpoint rtctk::componentFramework::ConsulServiceRegistryAdapter::GetRuntimeRepoEndpoint ( )
overridevirtual

Get the Runtime Repository Endpoint from the service registry.

Implements rtctk::componentFramework::ServiceRegistryIf.

◆ IsComponent()

bool rtctk::componentFramework::ConsulServiceRegistryAdapter::IsComponent ( const ppconsul::ServiceInfo & service_info,
const std::string & service_type = COMPONENT_TYPE )

◆ ListComponents()

std::vector< std::string > rtctk::componentFramework::ConsulServiceRegistryAdapter::ListComponents ( const std::string & service_type = COMPONENT_TYPE)
overridevirtual

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

Implements rtctk::componentFramework::ServiceRegistryIf.

Member Data Documentation

◆ SUPPORTED_URI_SCHEME

const std::string rtctk::componentFramework::ConsulServiceRegistryAdapter::SUPPORTED_URI_SCHEME = "consul"
inlinestatic

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