Get/Set Library Options.
The lcb_cntl() function and its various helpers are the means by which to modify settings within the library
- See also
- <cntl.h>
This function exposes an ioctl/fcntl-like interface to read and write various configuration properties to and from an lcb_t handle.
- Parameters
-
instance | The instance to modify |
mode | One of LCB_CNTL_GET (to retrieve a setting) or LCB_CNTL_SET (to modify a setting). Note that not all configuration properties support SET. |
cmd | The specific command/property to modify. This is one of the LCB_CNTL_* constants defined in this file. Note that it is safe (and even recommanded) to use the raw numeric value (i.e. to be backwards and forwards compatible with libcouchbase versions), as they are not subject to change. |
Using the actual value may be useful in ensuring your application will still compile with an older libcouchbase version (though you may get a runtime error (see return) if the command is not supported
- Parameters
-
arg | The argument passed to the configuration handler. The actual type of this pointer is dependent on the command in question. Typically for GET operations, the value of 'arg' is set to the current configuration value; and for SET operations, the current configuration is updated with the contents of *arg. |
- Returns
- LCB_NOT_SUPPORTED if the code is unrecognized
-
LCB_EINVAL if there was a problem with the argument (typically for LCB_CNTL_SET) other error codes depending on the command.
The following error codes are returned if the LCB_CNTL_DETAILED_ERRCODES are enabled.
- Returns
- LCB_ECTL_UNKNOWN if the code is unrecognized
-
LCB_ECTL_UNSUPPMODE An invalid mode was passed
-
LCB_ECTL_BADARG if the value was invalid
- Stability
- Committed:
- See also
- lcb_cntl_setu32()
-
lcb_cntl_string()
lcb_error_t lcb_cntl_string |
( |
lcb_t |
instance, |
|
|
const char * |
key, |
|
|
const char * |
value |
|
) |
| |
Alternate way to set configuration settings by passing a string key and value.
This may be used to provide a simple interface from a command line or higher level language to allow the setting of specific key-value pairs.
The format for the value is dependent on the option passed, the following value types exist:
- Timeout. A timeout value can either be specified as fractional seconds (
"1.5"
for 1.5 seconds), or in microseconds ("1500000"
).
- Number. This is any valid numerical value. This may be signed or unsigned depending on the setting.
- Boolean. This specifies a boolean. A true value is either a positive numeric value (i.e.
"1"
) or the string "true"
. A false value is a zero (i.e. "0"
) or the string "false"
.
- Float. This is like a Number, but also allows fractional specification, e.g.
"2.4"
.
- Stability
- Committed:
- Note, the actual API call is considered committed and will not disappear, however the existence of the various string settings are dependendent on the actual settings they map to. It is recommended that applications use the numerical lcb_cntl() as the string names are subject to change.
- See also
- lcb_cntl()
-
lcb-cntl-settings
Convenience function to set a value as an lcb_U32.
- Parameters
-
instance | |
cmd | setting to modify |
arg | the new value |
- Returns
- see lcb_cntl() for details
- Stability
- Committed:
lcb_U32 lcb_cntl_getu32 |
( |
lcb_t |
instance, |
|
|
int |
cmd |
|
) |
| |
Retrieve an lcb_U32 setting.
- Parameters
-
instance | |
cmd | setting to retrieve |
- Returns
- the value.
- Warning
- This function does not return an error code. Ensure that the cntl is correct for this version, or use lcb_cntl() directly.
- Stability
- Committed:
int lcb_cntl_exists |
( |
int |
ctl | ) |
|
Determine if a specific control code exists.
- Parameters
-
- Returns
- 0 if it does not exist, nonzero if it exists.