Go to main content

man pages section 3: Extended Library Functions, Volume 4

Exit Print View

Updated: Thursday, June 13, 2019
 
 

sstore_resource_add (3SSTORE)

Name

sstore_resource_add, sstore_resource_remove - interfaces to add and remove resources from the statistics store namespace

Synopsis

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);

Parameters

hdl

Handle to libsstore

ids

Array of stats store identifiers

id_count

Total number of statistics store identifiers

json_meta_arr

Optional additional resource metadata

Description

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().

Return Values

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.

Errors

The sstore_resource_add() and sstore_resource_remove() functions will fail if:

ESSTORE_ARG_INVALID

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.

ESSTORE_HANDLE_INVALID

The handle is invalid

ESSTORE_RETRY

The statistics store daemon is busy. Retry later

ESSTORE_CONNECTION_FAILED

Failed to connect to the statistics store daemon

ESSTORE_UNAUTHORIZED

The caller is not authorized

ESSTORE_NOMEM

No memory is available.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Safe

See Also

libsstore(3LIB), sstore_alloc(3SSTORE), sstore_data_attach(3SSTORE), sstore_data_update(3SSTORE), sstore_err_action(3SSTORE), attributes(7), ssid(7), ssid-metadata(7)