|
| 1 | +=================== |
| 2 | +flux_conf_create(3) |
| 3 | +=================== |
| 4 | + |
| 5 | +.. default-domain:: c |
| 6 | + |
| 7 | +SYNOPSIS |
| 8 | +======== |
| 9 | + |
| 10 | +.. code-block:: c |
| 11 | +
|
| 12 | + #include <flux/conf.h> |
| 13 | +
|
| 14 | + flux_conf_t *flux_conf_create (void); |
| 15 | +
|
| 16 | + const flux_conf_t *flux_conf_incref (const flux_conf_t *conf); |
| 17 | +
|
| 18 | + void flux_conf_decref (const flux_conf_t *conf); |
| 19 | +
|
| 20 | + flux_conf_t *flux_conf_copy (const flux_conf_t *conf); |
| 21 | +
|
| 22 | + int flux_conf_unpack (const flux_conf_t *conf, |
| 23 | + flux_error_t *error, |
| 24 | + const char *fmt, |
| 25 | + ...); |
| 26 | +
|
| 27 | + flux_conf_t *flux_conf_pack (const char *fmt, ...); |
| 28 | +
|
| 29 | + flux_conf_t *flux_conf_parse (const char *path, flux_error_t *error); |
| 30 | +
|
| 31 | +Link with :command:`-lflux-conf`. |
| 32 | + |
| 33 | +DESCRIPTION |
| 34 | +=========== |
| 35 | + |
| 36 | +Flux configuration is represented by a :type:`flux_conf_t` object. |
| 37 | + |
| 38 | +:func:`flux_conf_create` creates an empty object with a reference |
| 39 | +count of one. |
| 40 | + |
| 41 | +:func:`flux_conf_incref` increments the object reference count. |
| 42 | +:func:`flux_conf_decref` decrements the object reference count |
| 43 | +and destroys it when the count reaches zero. |
| 44 | + |
| 45 | +:func:`flux_conf_copy` duplicates an object. |
| 46 | + |
| 47 | +:func:`flux_conf_unpack` unpacks an object using Jansson |
| 48 | +:func:`json_unpack` style arguments. |
| 49 | + |
| 50 | +:func:`flux_conf_pack` creates an object using Jansson |
| 51 | +:func:`json_pack` style arguments. |
| 52 | + |
| 53 | +:func:`flux_conf_parse` parse a TOML configuration file at :var:`path` |
| 54 | +and creates a config object that contains the result. |
| 55 | + |
| 56 | +ENCODING JSON PAYLOADS |
| 57 | +====================== |
| 58 | + |
| 59 | +.. include:: common/json_pack.rst |
| 60 | + |
| 61 | +DECODING JSON PAYLOADS |
| 62 | +====================== |
| 63 | + |
| 64 | +.. include:: common/json_unpack.rst |
| 65 | + |
| 66 | +RETURN VALUE |
| 67 | +============ |
| 68 | + |
| 69 | +:func:`flux_conf_create`, :func:`flux_conf_copy`, :func:`flux_conf_pack`, |
| 70 | +and :func:`flux_conf_incref` return a :type:`flux_conf_t` object on success. |
| 71 | +On error, NULL is returned, and :var:`errno` is set. |
| 72 | + |
| 73 | +:func:`flux_conf_unpack` returns 0 on success, or -1 on failure with |
| 74 | +:var:`errno` set. |
| 75 | + |
| 76 | +:func:`flux_conf_parse` returns 0 on success. On error, it returns -1, |
| 77 | +:var:`errno` set, and if :var:`error` is non-NULL, it is filled with |
| 78 | +a human readable error message. |
| 79 | + |
| 80 | +ERRORS |
| 81 | +====== |
| 82 | + |
| 83 | +EINVAL |
| 84 | + Invalid argument. |
| 85 | + |
| 86 | +ENOMEM |
| 87 | + Out of memory. |
| 88 | + |
| 89 | +RESOURCES |
| 90 | +========= |
| 91 | + |
| 92 | +.. include:: common/resources.rst |
| 93 | + |
| 94 | +TOML: Tom's Oblivious, Minimal Language https://github.com/toml-lang/toml |
0 commit comments