Go to main content

man pages section 3: Extended Library Functions, Volume 4

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

sstore_iter_free (3SSTORE)

Name

sstore_iter_free, sstore_iter_export, sstore_iter_type - Duplicate, free, or export an iterator

Synopsis

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

     void sstore_iter_free(sstore_iter_t iter);

     sstore_iter_type_t sstore_iter_type(sstore_iter_t iter);

     sstore_err_t sstore_iter_export(sstore_handle_t hdl,
         sstore_iter_t iter, sstore_format_t fmt, void **bufp,
         size_t *bud_szp);

Parameters

iter

Handle to an iterator.

hdl

Handle to libsstore.

fmt

Format type of the export. The following formats are supported:

SSTORE_FMT_NVLIST

Pointer to an nvlist_t. See the libnvpair(3LIB) man page for information about nvlist format.

SSTORE_FMT_JSON

JavaScript Object Notation. See sstore.json(5) for information about the JSON format.

SSTORE_FMT_CSV

Comma Separated Values. For csv output, sstore must always be queried with a time range and a granularity, or step in seconds. See the sstore.csv(5) man page for information about the CSV format.

bufp

Address to store the starting address of the formatted result.

buf_szp

Address to store the size of the result in bufp.

Description

sstore_iter_free() frees the iterator.

sstore_iter_type() returns the type of an iterator.

sstore_iter_export() formats the data in an iterator in the requested format. sstore_iter_export() stores the formatted data in bufp and the size of the formatted data in buf_szp. For information about the data format, see the sstore.json(5) and sstore.csv(5) man pages.

Return Values

sstore_iter_type() returns an enumerated data type sstore_iter_type_t. Possible values for sstore_iter_type_t are:

  • SSTORE_ITER_TYPE_UNKNOWN

  • SSTORE_ITER_TYPE_DATA

  • SSTORE_ITER_TYPE_INFO

  • SSTORE_ITER_TYPE_COLLECTION

  • SSTORE_ITER_TYPE_NAMESPACE

Upon successful completion, sstore_iter_export() returns ESSTORE_OK. Otherwise, it returns an error code, which is also cached in the given libsstore handle.

Errors

The sstore_iter_export() function will fail if:

ESSTORE_ARG_INVALID

Some arguments are invalid.

ESSTORE_HANDLE_INVALID

The libsstore handle is invalid.

ESSTORE_NOMEM

There is insufficient memory.

Examples

See sstore_info_read(3SSTORE) and sstore_data_read(3SSTORE) for examples.

Attributes

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

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Safe

See Also

libnvpair(3LIB), libsstore(3LIB), sstore_alloc(3SSTORE), sstore_err_action(3SSTORE), attributes(7)