GATE
microservices.h File Reference

Generic microservice interfaces. More...

#include "gate/tech/gate_tech_api.h"
#include "gate/strings.h"
#include "gate/objects.h"
#include "gate/properties.h"
#include "gate/values.h"

Classes

struct  gate_microservice_base_class
 

Macros

#define GATE_INTERFACE_NAME_MICROHOST   GATE_INTERFACE_NAME_OBJECT GATE_INTERFACE_NAME_SEPARATOR "microhost"
 
#define GATE_MICROSERVICE_STATUS_UNKNOWN   0x00
 
#define GATE_MICROSERVICE_STATUS_OFFLINE   0x01
 
#define GATE_MICROSERVICE_STATUS_ONLINE   0x02
 
#define GATE_MICROSERVICE_STATUS_ERROR   0x04
 
#define GATE_MICROSERVICE_STATUS_SWITCHING   0x08
 
#define GATE_MICROSERVICE_STATUS_STARTING   (GATE_MICROSERVICE_STATUS_SWITCHING | GATE_MICROSERVICE_STATUS_ONLINE)
 
#define GATE_MICROSERVICE_STATUS_STOPPING   (GATE_MICROSERVICE_STATUS_SWITCHING | GATE_MICROSERVICE_STATUS_OFFLINE)
 
#define GATE_MICROSERVICE_STATUS_CONFIGURE   0x10
 
#define GATE_MICROSERVICE_CONDITION_INITIALIZING   0x000001
 
#define GATE_MICROSERVICE_CONDITION_INIT_ERROR   0x000002
 
#define GATE_MICROSERVICE_CONDITION_PARAM_ERROR   0x000004
 
#define GATE_MICROSERCICE_CONDITION_ACCESS_ERROR   0x000008
 
#define GATE_MICROSERVICE_CONDITION_FULL_OPERATIONAL   0x010000
 
#define GATE_MICROSERVICE_CONDITION_PARTIAL_OPERATIONAL   0x020000
 
#define GATE_MICROSERVICE_CONDITION_MALFUNCTION   0x100000
 
#define GATE_MICROSERVICE_CONDITION_DISCONNECTED   0x040000
 
#define GATE_MICROSERVICE_CONDITION_TEMPORARY_DOWN   0x080000
 
#define GATE_MICROSERVICE_LOGTYPE_DEBUG   0 /* development debugging info */
 
#define GATE_MICROSERVICE_LOGTYPE_INFO   1 /* operation progress notification info */
 
#define GATE_MICROSERVICE_LOGTYPE_STATUS   2 /* operation success or status notification info */
 
#define GATE_MICROSERVICE_LOGTYPE_WARNING   3 /* continueable/ignorable warning notification */
 
#define GATE_MICROSERVICE_LOGTYPE_ERROR   4 /* error notification */
 
#define GATE_MICROSERVICE_LOGTYPE_ALERT   5 /* critical error notification */
 
#define gate_microhost_publish_message(host, source_service, publish_channel, msg_id, message)    ((gate_microhost_t*)(host))->vtbl->publish_message((host), (source_service), (publish_channel), (msg_id), (message))
 
#define gate_microhost_publish_object(host, source_service, publish_channel, obj_id, ptr_obj)    ((gate_microhost_t*)(host))->vtbl->publish_object((host), (source_service), (publish_channel), (obj_id), (ptr_obj))
 
#define gate_microhost_subscribe_messages(host, source_service, publish_channel, msg_id, subscriber, user_data)    ((gate_microhost_t*)(host))->vtbl->subscribe_messages((host), (source_service), (publish_channel), (msg_id), (subscriber), (user_data))
 
#define gate_microhost_unsubscribe_messages(host, source_service, publish_channel, msg_id, subscriber, user_data)    ((gate_microhost_t*)(host))->vtbl->unsubscribe_messages((host), (source_service), (publish_channel), (msg_id), (subscriber), (user_data))
 
#define gate_microhost_subscribe_objects(host, source_service, publish_channel, obj_id, subscriber, user_data)    ((gate_microhost_t*)(host))->vtbl->subscribe_objects((host), (source_service), (publish_channel), (obj_id), (subscriber), (user_data))
 
#define gate_microhost_unsubscribe_objects(host, source_service, publish_channel, obj_id, subscriber, user_data)    ((gate_microhost_t*)(host))->vtbl->unsubscribe_objects((host), (source_service), (publish_channel), (obj_id), (subscriber), (user_data))
 
#define gate_microhost_remote_invoke(host, destination_service, method, input_data, output_data)    ((gate_microhost_t*)(host))->vtbl->remote_invoke((host), (destination_service), (method), (input_data), (output_data))
 
#define gate_microhost_log(host, log_type, result_code, native_code, origin, message)    ((gate_microhost_t*)(host))->vtbl->log((host), (log_type), (result_code), (native_code), (origin), (message))
 
#define GATE_INTERFACE_NAME_MICROSERVICE   GATE_INTERFACE_NAME_STARTABLE GATE_INTERFACE_NAME_SEPARATOR "microservice"
 
#define gate_microservice_start(service)   gate_startable_start(service)
 
#define gate_microservice_stop(service)   gate_startable_stop(service)
 
#define gate_microservice_get_status(service)   gate_startable_get_status(service)
 
#define gate_microservice_setup(service, instance_address, host)    ((gate_microservice_t*)(service))->vtbl->setup((service), (instance_address), (host))
 
#define gate_microservice_get_address(service, ptr_name)    ((gate_microservice_t*)(service))->vtbl->get_address((service), (ptr_name))
 
#define gate_microservice_get_condition_bits(service, ptr_bits)    ((gate_microservice_t*)(service))->vtbl->get_condition_bits((service), (ptr_bits))
 
#define gate_microservice_process_message(service, source_service, publish_channel, msg_id, message, user_param)    ((gate_microservice_t*)(service))->vtbl->process_message((service), (source_service), (publish_channel), (msg_id), (message), (user_param))
 
#define gate_microservice_process_object(service, source_service, publish_channel, obj_id, ptr_object, user_param)    ((gate_microservice_t*)(service))->vtbl->process_object((service), (source_service), (publish_channel), (obj_id), (ptr_object), (user_param))
 
#define gate_microservice_invoke(service, method, request, response)    ((gate_microservice_t*)(service))->vtbl->invoke((service), (method), (request), (response))
 
#define gate_microservice_get_parameter_names(service, ptr_output_names)    ((gate_microservice_t*)(service))->vtbl->get_parameter_names((service), (ptr_output_names))
 
#define gate_microservice_get_parameter_type(service, name, ptr_type)    ((gate_microservice_t*)(service))->vtbl->get_parameter_type((service), (name), (ptr_type))
 
#define gate_microservice_get_parameter(service, name, ptr_value)    ((gate_microservice_t*)(service))->vtbl->get_parameter((service), (name), (ptr_value))
 
#define gate_microservice_set_parameter(service, name, value)    ((gate_microservice_t*)(service))->vtbl->set_parameter((service), (name), (value))
 
#define GATE_INTERFACE_NAME_MICROFACTORY   GATE_INTERFACE_NAME_OBJECT GATE_INTERFACE_NAME_SEPARATOR "microfactory"
 
#define gate_microfactory_supported_service_names(factory, ptr_output_names)    ((gate_microfactory_t*)(factory))->vtbl->supported_service_names((factory), (ptr_output_names))
 
#define gate_microfactory_create_service(factory, service_name, ptr_service)    ((gate_microfactory_t*)(factory))->vtbl->create_service((factory), (service_name), (ptr_service))
 

Typedefs

typedef gate_microservice_t *(* gate_microservice_creator_t) ()
 
typedef struct gate_microservice_base_class gate_microservice_base_t
 

Functions

 GATE_INTERFACE_STRUCT (gate_microservice)
 
 GATE_INTERFACE (gate_microhost)
 
 GATE_INTERFACE (gate_microservice)
 
 GATE_INTERFACE (gate_microfactory)
 
GATE_TECH_API gate_microservice_base_tgate_microservice_base_create (gate_size_t data_size, void *user_param)
 
GATE_TECH_API gate_result_t gate_microservice_base_set_condition_bits (gate_microservice_base_t *service, gate_uint32_t bits)
 
GATE_TECH_API gate_result_t gate_microservice_base_clear_condition_bits (gate_microservice_base_t *service, gate_uint32_t bits)
 
GATE_TECH_API gate_result_t gate_microservice_encode_address (gate_string_t const *name, gate_string_t const *instance, gate_string_t *output_address)
 
GATE_TECH_API gate_result_t gate_microservice_decode_address (gate_string_t const *address, gate_string_t *output_name, gate_string_t *output_instance)
 

Detailed Description

Generic microservice interfaces.

Macro Definition Documentation

◆ GATE_MICROSERCICE_CONDITION_ACCESS_ERROR

#define GATE_MICROSERCICE_CONDITION_ACCESS_ERROR   0x000008

access to a required resource was denied, service possible malfunctioning

◆ GATE_MICROSERVICE_CONDITION_DISCONNECTED

#define GATE_MICROSERVICE_CONDITION_DISCONNECTED   0x040000

service is disconnected from a required resource

◆ GATE_MICROSERVICE_CONDITION_FULL_OPERATIONAL

#define GATE_MICROSERVICE_CONDITION_FULL_OPERATIONAL   0x010000

service is fully functional

◆ GATE_MICROSERVICE_CONDITION_INIT_ERROR

#define GATE_MICROSERVICE_CONDITION_INIT_ERROR   0x000002

initialization has failed, service possible malfunctioning

◆ GATE_MICROSERVICE_CONDITION_INITIALIZING

#define GATE_MICROSERVICE_CONDITION_INITIALIZING   0x000001

service is initializing, other status values may be wrong

◆ GATE_MICROSERVICE_CONDITION_MALFUNCTION

#define GATE_MICROSERVICE_CONDITION_MALFUNCTION   0x100000

service is failing

◆ GATE_MICROSERVICE_CONDITION_PARAM_ERROR

#define GATE_MICROSERVICE_CONDITION_PARAM_ERROR   0x000004

parameter values are invalid, service possible malfunctioning

◆ GATE_MICROSERVICE_CONDITION_PARTIAL_OPERATIONAL

#define GATE_MICROSERVICE_CONDITION_PARTIAL_OPERATIONAL   0x020000

service is partially functional, some features are unavailable

◆ GATE_MICROSERVICE_CONDITION_TEMPORARY_DOWN

#define GATE_MICROSERVICE_CONDITION_TEMPORARY_DOWN   0x080000

service is temporary unavailable but tries to recover

◆ GATE_MICROSERVICE_STATUS_CONFIGURE

#define GATE_MICROSERVICE_STATUS_CONFIGURE   0x10

service is reconfigured

◆ GATE_MICROSERVICE_STATUS_ERROR

#define GATE_MICROSERVICE_STATUS_ERROR   0x04

service is in error state

◆ GATE_MICROSERVICE_STATUS_OFFLINE

#define GATE_MICROSERVICE_STATUS_OFFLINE   0x01

service is stopped

◆ GATE_MICROSERVICE_STATUS_ONLINE

#define GATE_MICROSERVICE_STATUS_ONLINE   0x02

service is running

◆ GATE_MICROSERVICE_STATUS_STARTING

#define GATE_MICROSERVICE_STATUS_STARTING   (GATE_MICROSERVICE_STATUS_SWITCHING | GATE_MICROSERVICE_STATUS_ONLINE)

service is switching from offline to running

◆ GATE_MICROSERVICE_STATUS_STOPPING

#define GATE_MICROSERVICE_STATUS_STOPPING   (GATE_MICROSERVICE_STATUS_SWITCHING | GATE_MICROSERVICE_STATUS_OFFLINE)

service is switching from running to offline

◆ GATE_MICROSERVICE_STATUS_SWITCHING

#define GATE_MICROSERVICE_STATUS_SWITCHING   0x08

service is currently in status switching mode

◆ GATE_MICROSERVICE_STATUS_UNKNOWN

#define GATE_MICROSERVICE_STATUS_UNKNOWN   0x00

service is in unknown state

Function Documentation

◆ GATE_INTERFACE()

GATE_INTERFACE ( gate_microservice )

< connects service with a host

< returns service address

< get internal operational status flags

< deliver a communication message

< deliver a communication object

< execute a remote procedure call

< return all supported parameter names

< return the property data type of a parameter

< return a parameter as a property value

< update a parameter with a property value