corosync 3.1.9
|
Data Structures | |
struct | cmap_notify_value |
Structure passed as new_value and old_value in change callback. More... | |
Macros | |
#define | CMAP_KEYNAME_MAXLEN 255 |
#define | CMAP_KEYNAME_MINLEN 3 |
#define | CMAP_TRACK_ADD 4 |
#define | CMAP_TRACK_DELETE 1 |
#define | CMAP_TRACK_MODIFY 2 |
#define | CMAP_TRACK_PREFIX 8 |
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ... applies). | |
Typedefs | |
typedef uint64_t | cmap_handle_t |
typedef uint64_t | cmap_iter_handle_t |
typedef uint64_t | cmap_track_handle_t |
typedef void(* | cmap_notify_fn_t) (cmap_handle_t cmap_handle, cmap_track_handle_t cmap_track_handle, int32_t event, const char *key_name, struct cmap_notify_value new_value, struct cmap_notify_value old_value, void *user_data) |
Prototype for notify callback function. | |
Enumerations | |
enum | cmap_value_types_t { CMAP_VALUETYPE_INT8 = 1 , CMAP_VALUETYPE_UINT8 = 2 , CMAP_VALUETYPE_INT16 = 3 , CMAP_VALUETYPE_UINT16 = 4 , CMAP_VALUETYPE_INT32 = 5 , CMAP_VALUETYPE_UINT32 = 6 , CMAP_VALUETYPE_INT64 = 7 , CMAP_VALUETYPE_UINT64 = 8 , CMAP_VALUETYPE_FLOAT = 9 , CMAP_VALUETYPE_DOUBLE = 10 , CMAP_VALUETYPE_STRING = 11 , CMAP_VALUETYPE_BINARY = 12 } |
Possible types of value. More... | |
enum | cmap_map_t { CMAP_MAP_DEFAULT = 0 , CMAP_MAP_ICMAP = 0 , CMAP_MAP_STATS = 1 } |
#define CMAP_TRACK_PREFIX 8 |
typedef void(* cmap_notify_fn_t) (cmap_handle_t cmap_handle, cmap_track_handle_t cmap_track_handle, int32_t event, const char *key_name, struct cmap_notify_value new_value, struct cmap_notify_value old_value, void *user_data) |
Prototype for notify callback function.
Even is one of CMAP_TRACK_* event, key_name is changed key, new and old_value contains values or are zeroed (in other words, type is non existing 0 type) if there were no old (creating of key) or new (deleting of key) value. user_data are passed when adding tracking.
Possible types of value.
Binary is raw data without trailing zero with given length
|
extern |
cmap_context_get
handle | |
context |
Definition at line 352 of file lib/cmap.c.
References cmap_inst::context, CS_OK, hdb_error_to_cs(), and nodeid.
|
extern |
cmap_context_set
handle | |
context |
Definition at line 371 of file lib/cmap.c.
References cmap_inst::context, CS_OK, hdb_error_to_cs(), and nodeid.
|
extern |
Decrement value of key_name if it is [u]int* type.
handle | cmap handle |
key_name | key name |
Definition at line 817 of file lib/cmap.c.
|
extern |
Deletes key from cmap database.
handle | cmap handle |
key_name | name of key to delete |
Definition at line 507 of file lib/cmap.c.
References cmap_inst::c, CS_ERR_INVALID_PARAM, CS_ERR_NAME_TOO_LONG, CS_IPC_TIMEOUT_MS, CS_MAX_NAME_LENGTH, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_DELETE, nodeid, and qb_to_cs_error().
|
extern |
Dispatch data from service.
handle | cmap handle initialized by cmap_initialize |
dispatch_types | one of standard corosync dispatch values |
Definition at line 229 of file lib/cmap.c.
References cmap_inst::c, CS_DISPATCH_ALL, CS_DISPATCH_ONE, CS_DISPATCH_ONE_NONBLOCKING, CS_ERR_BAD_HANDLE, CS_ERR_LIBRARY, CS_ERR_TRY_AGAIN, CS_OK, cmap_inst::finalize, hdb_error_to_cs(), IPC_DISPATCH_SIZE, MESSAGE_RES_CMAP_NOTIFY_CALLBACK, res_lib_cmap_notify_callback::new_value, nodeid, cmap_track_inst::notify_fn, qb_to_cs_error(), cmap_track_inst::track_handle, and cmap_track_inst::user_data.
|
extern |
Get a file descriptor on which to poll.
cmap_handle_t is NOT a file descriptor and may not be used directly.
handle | cmap handle initialized by cmap_initialize |
fd | file descriptor for poll |
Definition at line 212 of file lib/cmap.c.
References cmap_inst::c, CS_OK, hdb_error_to_cs(), nodeid, and qb_to_cs_error().
|
extern |
Close the cmap handle.
handle | cmap handle |
Definition at line 173 of file lib/cmap.c.
References cmap_inst::c, cmap_track_inst::c, CS_ERR_BAD_HANDLE, CS_OK, cmap_inst::finalize, hdb_error_to_cs(), and nodeid.
|
extern |
Retrieve value of key key_name and store it in user preallocated value pointer.
value can be NULL, and then only value_len and/or type is returned (both of them can also be NULL). If value is not NULL, actual length of value in map is checked against value_len. If *value_len is shorter then length of value in map, error CS_ERR_INVALID_PARAM is returned. After successful copy of value, value_len is set to actual length of value in map.
handle | cmap handle |
key_name | name of key where to get value |
value | pointer to store data (or NULL) |
value_len | pointer with length of value (value != NULL), or pointer where value length will be returned (value == NULL) or NULL. |
type | type of value in cmap |
Definition at line 553 of file lib/cmap.c.
References cmap_inst::c, CS_ERR_INVALID_PARAM, CS_ERR_NAME_TOO_LONG, CS_ERR_NO_MEMORY, CS_IPC_TIMEOUT_MS, CS_MAX_NAME_LENGTH, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_GET, nodeid, qb_to_cs_error(), type, and value.
Referenced by cmap_get_string().
|
extern |
Definition at line 721 of file lib/cmap.c.
References CMAP_VALUETYPE_DOUBLE.
|
extern |
Definition at line 715 of file lib/cmap.c.
References CMAP_VALUETYPE_FLOAT, and nodeid.
|
extern |
Definition at line 679 of file lib/cmap.c.
References CMAP_VALUETYPE_INT16, and nodeid.
|
extern |
Definition at line 691 of file lib/cmap.c.
References CMAP_VALUETYPE_INT32, and nodeid.
|
extern |
Definition at line 703 of file lib/cmap.c.
References CMAP_VALUETYPE_INT64, and nodeid.
|
extern |
Definition at line 667 of file lib/cmap.c.
References CMAP_VALUETYPE_INT8, and nodeid.
|
extern |
Shortcut for cmap_get for string type.
Returned string is newly allocated and caller is responsible for freeing memory
handle | cmap handle |
key_name | name of key to get value from |
str | pointer where char pointer will be stored |
Definition at line 727 of file lib/cmap.c.
References cmap_get(), CMAP_VALUETYPE_STRING, CS_ERR_INVALID_PARAM, CS_ERR_NO_MEMORY, CS_OK, nodeid, and type.
|
extern |
Definition at line 685 of file lib/cmap.c.
References CMAP_VALUETYPE_UINT16, and nodeid.
|
extern |
Definition at line 697 of file lib/cmap.c.
References CMAP_VALUETYPE_UINT32, and nodeid.
|
extern |
Definition at line 709 of file lib/cmap.c.
References CMAP_VALUETYPE_UINT64, and nodeid.
|
extern |
Definition at line 673 of file lib/cmap.c.
References CMAP_VALUETYPE_UINT8, and nodeid.
|
extern |
Increment value of key_name if it is [u]int* type.
handle | cmap handle |
key_name | key name |
Definition at line 811 of file lib/cmap.c.
|
extern |
Create a new cmap connection.
handle | will be filled with handle to be used for all following operations with cht. |
Definition at line 89 of file lib/cmap.c.
References cmap_inst::c, CS_OK, cmap_inst::finalize, hdb_error_to_cs(), IPC_REQUEST_SIZE, nodeid, and qb_to_cs_error().
Referenced by cmap_initialize_map().
|
extern |
Create a new cmap connection on a specified map.
handle | will be filled with handle to be used for all following operations with cht. |
map | is the 'map' to use for this connection |
Definition at line 124 of file lib/cmap.c.
References cmap_inst::c, cmap_initialize(), CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_SET_CURRENT_MAP, nodeid, and qb_to_cs_error().
|
extern |
Finalize iterator.
handle | |
iter_handle |
Definition at line 938 of file lib/cmap.c.
References cmap_inst::c, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_ITER_FINALIZE, nodeid, and qb_to_cs_error().
|
extern |
Initialize iterator with given prefix.
handle | cmap handle |
prefix | prefix to iterate on |
cmap_iter_handle | value used for getting next value of iterator and/or deleting iteration |
Definition at line 823 of file lib/cmap.c.
References cmap_inst::c, CS_ERR_INVALID_PARAM, CS_ERR_NAME_TOO_LONG, CS_IPC_TIMEOUT_MS, CS_MAX_NAME_LENGTH, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_ITER_INIT, nodeid, and qb_to_cs_error().
|
extern |
Return next item in iterator iter.
value_len and type are optional (= can be NULL), but if set, length of returned value and/or type is returned.
handle | cmap handle |
iter_handle | handle of iteration returned by cmap_iter_init |
key_name | place to store name of key. Maximum length is CMAP_KEYNAME_MAXLEN and trailing zero is always added so size of the buffer has to be at least CMAP_KEYNAME_MAXLEN + 1. |
value_len | length of value |
type | type of value |
Definition at line 878 of file lib/cmap.c.
References cmap_inst::c, CS_ERR_INVALID_PARAM, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_ITER_NEXT, nodeid, qb_to_cs_error(), and type.
|
extern |
Store value in cmap.
handle | cmap handle |
key_name | name of key where to store value |
value | value to store |
value_len | length of value to store |
type | type to store |
Definition at line 390 of file lib/cmap.c.
References cmap_inst::c, CS_ERR_INVALID_PARAM, CS_ERR_NAME_TOO_LONG, CS_IPC_TIMEOUT_MS, CS_MAX_NAME_LENGTH, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_SET, nodeid, qb_to_cs_error(), type, and value.
Referenced by cmap_set_double(), cmap_set_float(), cmap_set_int16(), cmap_set_int32(), cmap_set_int64(), cmap_set_int8(), cmap_set_string(), cmap_set_uint16(), cmap_set_uint32(), cmap_set_uint64(), and cmap_set_uint8().
|
extern |
Definition at line 492 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_DOUBLE, and value.
|
extern |
Definition at line 487 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_FLOAT, and value.
|
extern |
Definition at line 457 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_INT16, and value.
|
extern |
Definition at line 467 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_INT32, and value.
|
extern |
Definition at line 477 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_INT64, and value.
|
extern |
Definition at line 447 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_INT8, and value.
|
extern |
Definition at line 497 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_STRING, CS_ERR_INVALID_PARAM, nodeid, and value.
|
extern |
Definition at line 462 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_UINT16, and value.
|
extern |
Definition at line 472 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_UINT32, and value.
|
extern |
Definition at line 482 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_UINT64, and value.
|
extern |
Definition at line 452 of file lib/cmap.c.
References cmap_set(), CMAP_VALUETYPE_UINT8, and value.
|
extern |
Add tracking function for given key_name.
Tracked changes (add|modify|delete) depend on track_type, which is bitwise or of CMAP_TRACK_* values. notify_fn is called on change, where user_data pointer is passed (unchanged). Value which can be used to delete tracking is passed as cmap_track.
handle | cmap handle |
key_name | name of key to track changes on |
track_type | bitwise-or of CMAP_TRACK_* values |
notify_fn | function to be called on change of key |
user_data | given pointer is unchanged passed to notify_fn |
cmap_track_handle | handle used for removing of newly created track |
Definition at line 977 of file lib/cmap.c.
References cmap_inst::c, cmap_track_inst::c, CS_ERR_INVALID_PARAM, CS_ERR_NAME_TOO_LONG, CS_IPC_TIMEOUT_MS, CS_MAX_NAME_LENGTH, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_TRACK_ADD, nodeid, cmap_track_inst::notify_fn, qb_to_cs_error(), cmap_track_inst::track_handle, cmap_track_inst::user_data, and user_data.
|
extern |
Delete track created previously by cmap_track_add.
handle | cmap handle |
track_handle | Track handle |
Definition at line 1068 of file lib/cmap.c.
References cmap_inst::c, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_CMAP_TRACK_DELETE, nodeid, and qb_to_cs_error().