Asynchronous registry interface

Asynchronous registry interface —

Synopsis


#include <monitor/producer/prod_registry.h>


int         prod_metric_def_get             (const char *name,
                                             mon_metric_def **def_ptr,
                                             mon_ctx *ctx);
int         prod_ctrl_def_get               (const char *name,
                                             mon_metric_def **def_ptr,
                                             mon_ctx *ctx);
            prod_registry_module;
#define     PROD_REGISTRY_API
#define     PROD_SYMBOL_REGISTRY
#define     PROD_REGISTRY_MODULE            (desc)
int         prod_registry_add               (prod_registry_module *registry,
                                             prod_module_type type);
void        prod_registry_ref               (prod_registry_module *registry);
void        prod_registry_done              (prod_registry_module *registry);
int         prod_registry_register          (mon_module *module);
void        prod_registry_unregister        (mon_module *module);

Description

Details

prod_metric_def_get ()

int         prod_metric_def_get             (const char *name,
                                             mon_metric_def **def_ptr,
                                             mon_ctx *ctx);

Retrieves a metric definition asynchronously.

name :the name of the metric.
def_ptr :where to store the retrieved definition.
ctx :the mon_ctx to use for execution.
Returns :0 if the metric was found, MON_CONTINUE if the execution was suspended or an error code.

prod_ctrl_def_get ()

int         prod_ctrl_def_get               (const char *name,
                                             mon_metric_def **def_ptr,
                                             mon_ctx *ctx);

Retrieves a control definition asynchronously.

name :the name of the control.
def_ptr :where to store the retrieved definition.
ctx :the mon_ctx to use for execution.
Returns :0 if the metric was found, MON_CONTINUE if the execution was suspended or an error code.

prod_registry_module

typedef struct {
	mon_module		header;

	const char		*name_glob;
	int			(*lookup)(prod_registry_module *registry,
					mon_metric_def_domain domain,
					const char *name,
					mon_metric_def **def_ptr,
					mon_ctx *ctx);
} prod_registry_module;

Describes an asynchronous registry module.

mon_module header;the generic module headers.
const char *name_glob;shell-like glob expression matching the metric/control names server by this module.
lookup ()the lookup function for retrieving metric/control definitions.

PROD_REGISTRY_API

#define PROD_REGISTRY_API	1

Defines the async. registry API version implemented by the library.


PROD_SYMBOL_REGISTRY

#define PROD_SYMBOL_REGISTRY	MON_MODSYM(prod_module_registry)

Defines the symbol name of the async. registry module descriptor table in a loadable module.


PROD_REGISTRY_MODULE()

#define     PROD_REGISTRY_MODULE(desc)

Declares an async. registry module.

desc :the name of the prod_registry_module descriptor.

prod_registry_add ()

int         prod_registry_add               (prod_registry_module *registry,
                                             prod_module_type type);

Registers a new async. registry module.

registry :a prod_registry_module to register.
type :the type of the module.
Returns :0 if successful or an error code.

prod_registry_ref ()

void        prod_registry_ref               (prod_registry_module *registry);

Increments the reference count of a prod_registry_module.

registry :a prod_registry_module.

prod_registry_done ()

void        prod_registry_done              (prod_registry_module *registry);

Decrements the reference count for a prod_registry_module. If the reference count reaches zero, the module is deallocated (or unloaded if it was a DSO).

registry :a prod_registry_module.

prod_registry_register ()

int         prod_registry_register          (mon_module *module);

Wrapper around prod_registry_add() for registering dynamically loaded modules.

module :a prod_registry_module to register.
Returns :0 if successful or an error code.

prod_registry_unregister ()

void        prod_registry_unregister        (mon_module *module);

Unregisters an async. registry module.

module :a prod_registry_module to unregister.