1CMAP_SET(3) Corosync Cluster Engine Programmer's Manual CMAP_SET(3)
2
3
4
6 cmap_set - Store value in CMAP
7
8
10 #include <corosync/cmap.h>
11
12
13 cs_error_t cmap_set (cmap_handle_t handle, const char *key_name, const
14 void *value, size_t value_len, cmap_value_types_t type);
15
16 Also shortcuts for different types are defined
17
18 cs_error_t cmap_set_int8(cmap_handle_t handle, const char *key_name,
19 int8_t value);
20
21 cs_error_t cmap_set_uint8(cmap_handle_t handle, const char *key_name,
22 uint8_t value);
23
24 cs_error_t cmap_set_int16(cmap_handle_t handle, const char *key_name,
25 int16_t value);
26
27 cs_error_t cmap_set_uint16(cmap_handle_t handle, const char *key_name,
28 uint16_t value);
29
30 cs_error_t cmap_set_int32(cmap_handle_t handle, const char *key_name,
31 int32_t value);
32
33 cs_error_t cmap_set_uint32(cmap_handle_t handle, const char *key_name,
34 uint32_t value);
35
36 cs_error_t cmap_set_int64(cmap_handle_t handle, const char *key_name,
37 int64_t value);
38
39 cs_error_t cmap_set_uint64(cmap_handle_t handle, const char *key_name,
40 uint64_t value);
41
42 cs_error_t cmap_set_float(cmap_handle_t handle, const char *key_name,
43 float value);
44
45 cs_error_t cmap_set_double(cmap_handle_t handle, const char *key_name,
46 double value);
47
48 cs_error_t cmap_set_string(cmap_handle_t handle, const char *key_name,
49 const char *value);
50
51
53 The cmap_set function is used to store key inside cmap. The handle
54 argument is connection to CMAP database obtained by calling cmap_ini‐
55 tialize(3) function. key_name is name of key to set value. Key name is
56 limited by minimal (CMAP_KEYNAME_MINLEN, currently 3) and maximal
57 (CMAP_KEYNAME_MAXLEN, currently 255) length. Also key can contain only
58 limited set of characters expressed by regexp [a-zA-Z0-9._-/:]*. value
59 is pointer to allocated data which will be stored inside CMAP. Length
60 of value (number of bytes) is supplied as value_len parameter. Last
61 parameter is type which gives type of value. It may be one of:
62
63 CMAP_VALUETYPE_INT8 - 8-bit signed integer
64
65 CMAP_VALUETYPE_UINT8 - 8-bit unsigned integer
66
67 CMAP_VALUETYPE_INT16 - 16-bit signed integer
68
69 CMAP_VALUETYPE_UINT16 - 16-bit unsigned integer
70
71 CMAP_VALUETYPE_INT32 - 32-bit signed integer
72
73 CMAP_VALUETYPE_UINT32 - 32-bit unsigned integer
74
75 CMAP_VALUETYPE_INT64 - 64-bit signed integer
76
77 CMAP_VALUETYPE_UINT64 - 64-bit unsigned integer
78
79 CMAP_VALUETYPE_FLOAT - Float value
80
81 CMAP_VALUETYPE_DOUBLE - Double value
82
83 CMAP_VALUETYPE_STRING - C-style string
84
85 CMAP_VALUETYPE_BINARY - Binary data, byte with zero value has no spe‐
86 cial meaning
87
88
89
91 This call returns the CS_OK value if successful. If value or key_name
92 are unspecified, CS_ERR_INVALID_PARAM is returned. Too short or too
93 long key_name returns CS_ERR_NAME_TOO_LONG error code. Some of keys may
94 be tagged read-only directly in corosync and setting such key will
95 result in CS_ERR_ACCESS error.
96
97
99 cmap_get(3), cmap_initialize(3), cmap_overview(3)
100
101 CS_ERR_TRY_AGAIN Resource temporarily unavailable
102
103 CS_ERR_INVALID_PARAM Invalid argument
104
105 CS_ERR_ACCESS Permission denied
106
107 CS_ERR_LIBRARY The connection failed
108
109 CS_ERR_INTERRUPT System call interrupted by a signal
110
111 CS_ERR_NOT_SUPPORTED The requested protocol/functionality not supported
112
113 CS_ERR_MESSAGE_ERROR Incorrect auth message received
114
115 CS_ERR_NO_MEMORY Not enough memory to complete the requested task
116
117
118
119corosync Man Page 23/01/2012 CMAP_SET(3)