sstore_resource_add, sstore_resource_remove - interfaces to add and remove resources from the statistics store namespace
cc [ flag... ] file... -lsstore [ library... ] #include <libsstore.h> sstore_err_t sstore_resource_add(sstore_handle_t hdl, const char **ids, uint32_t id_count, const char *json_meta_arr); sstore_err_t sstore_resource_remove(sstore_handle_t hdl, const char **ids, uint32_t id_count);
Handle to libsstore
Array of stats store identifiers
Total number of statistics store identifiers
Optional additional resource metadata
The utility of these functions is for controller or coordinator type processes that create administrator visible system resources, but may not be in the business of gathering statistics on these resources.
Simpler programs looking to manage a single resource and some number of statistics should use sstore_data_update(3SSTORE) or sstore_data_attach(3SSTORE) directly.
sstore_resource_add() creates and activates a set of resource nodes within the statistics store namespace. The ids argument should contain a list of strings in the form:
//:class.<class>//:res.<resource>
where one can choose the values of <class> and <resource> within the limits set by ssid(7). The class metadata for this resource should already exist in the default json metadata directory. Any statistics specified in the class metadata will also be created upon initialization of the resource, and attempts to capture these statistics before any data has been provided will result in NO_DATA. Attempts to add resources that violate namespace rules set by the class metadata will cause resource_add() to fail.
json_meta_arr allows the user to add additional metadata on top of the base metadata inherited from the class. The format of the json is the same as json files in the default json metadata directory, described in ssid(7).
sstore_resource_remove() deactivates resources in the statistics store namespace. Attempts to deactivate resources with active statistics or events will not fail, but the resource won't deactivate until all statistics and events are no longer active.
Resource remove will fail if called on ids that were not created through a previous call to sstore_resource_add().
Upon successful completion, sstore_resource_add() and sstore_resource_remove() return ESSTORE_OK. Otherwise, they return an error code, which is also cached in the libsstore handle.
The sstore_resource_add() and sstore_resource_remove() functions will fail if:
One of the following reasons:
ssids are syntactically incorrect or missing the required metadata .
The ssid contains a wildcard slice, or is not a resource.
The handle is invalid
The statistics store daemon is busy. Retry later
Failed to connect to the statistics store daemon
The caller is not authorized
No memory is available.
See attributes(7) for descriptions of the following attributes:
|
libsstore(3LIB), sstore_alloc(3SSTORE), sstore_data_attach(3SSTORE), sstore_data_update(3SSTORE), sstore_err_action(3SSTORE), attributes(7), ssid(7), ssid-metadata(7)