Go to main content

man pages section 3: Extended Library Functions, Volume 4

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

sstore_value_alloc (3SSTORE)

Name

sstore_value_alloc, sstore_value_free - alloc/free an sstore_value_t

Synopsis

cc [ flag... ] file... -lsstore [ library... ]
#include <libsstore.h>

typedef struct sstore_histogram *sstore_histogram_t;
typedef enum {
      SSTORE_VALUE_UNKNOWN = 0,
      SSTORE_VALUE_BOOLEAN,
      SSTORE_VALUE_DICTIONARY,
      SSTORE_VALUE_DICTIONARY_ARRAY,
      SSTORE_VALUE_NUMBER,
      SSTORE_VALUE_NUMBER_ARRAY,
      SSTORE_VALUE_PARTITION,
      SSTORE_VALUE_STRING,
      SSTORE_VALUE_STRING_ARRAY,
      SSTORE_VALUE_NODATA,
      SSTORE_VALUE_NODATA_YET
      SSTORE_VALUE_HISTOGRAM

} sstore_value_type_t;

typedef struct sstore_value {
    sstore_value_type_t sv_type;
    uint32_t sv_arr_len;
    union {
        boolean_t           boolean;
        uint64_t            num;
        uint64_t            *num_arr;
        double              real;
        double              *real_arr;
        char                *str;
        char                **str_arr;
        nvlist_t            *dict;
        nvlist_t            **dict_arr;
        sstore_partition_t  part;
        sstore_histogram_t  hist;
    } sv_value;
} *sstore_value_t;

sstore_value_t sstore_value_alloc();

void sstore_value_free(sstore_value_t val);

Parameters

val

sstore_value_t to be freed

Description

sstore_value_t is used for reading the value or metadata of a statistic while iterating through all the data through the sstore_data_iter_next() or sstore_info_iter_next() function. It allows user applications to update application statistics using sstore_data_update() or sstore_data_bulk_update() function.

sstore_value_t is a typed union, which contains type and corresponding data member for each supported type except SSTORE_VALUE_NODATA and SSTORE_VALUE_NODATA_YET. These are special types and have a meaning associated with it.

SSTORE_VALUE_NODATA means there is no value recorded for the statistic at the given timestamp. SSTORE_VALUE_NODATA_YET is used as a placeholder for a value that will be recorded when the value for the timestamp is received from its provider. In future, sstore_value_t may add support for more data types in which case the corresponding data members for the new types will be added at the end of the union 'sv_value' in order to maintain compatibility. The struct may grow in size in order to support the new types.

The user-applications trying to update statistics must use the sstore_value_alloc() and sstore_value_free() functions to allocate and free the sstore_value_t() function respectively to avoid any compatibility issues when the struct definition changes.

Return Values

The value types SSTORE_VALUE_PARTITION and SSTORE_VALUE_HISTOGRAM are used only for providing application statistics to sstored using the sstore_data_update() and sstore_data_bulk_update() functions as opposed to other types that may also be used for reading value or metadata for a statistic or event.

See Also

libsstore(3LIB), sstore_data_read(3SSTORE), sstore_data_update(3SSTORE), sstore_partition_alloc(3SSTORE), sstore_histogram_init(3SSTORE), attributes(7)