![]() |
The as_config
contains the settings for the aerospike
client. Including default policies, seed hosts in the cluster and other settings.
Before using as_config, you must first initialize it. This will setup the default values.
Once initialized, you can populate the values.
The client will require at least one seed host defined in the configuration. The seed host is defined in as_config.hosts
.
You can define up to 16 hosts for the seed. The client will iterate over the list until it connects with one of the hosts.
The configuration also defines default policies for the application. The as_config_init()
function already presets default values for the policies.
Policies define the behavior of the client, which can be global across operations, global to a single operation, or local to a single use of an operation.
Each database operation accepts a policy for that operation as an a argument. This is considered a local policy, and is a single use policy. This policy supersedes any global policy defined.
If a value of the policy is not defined, then the rule is to fallback to the global policy for that operation. If the global policy for that operation is undefined, then the global default value will be used.
If you find that you have behavior that you want every use of an operation to utilize, then you can specify the default policy in as_config.policies.
For example, the aerospike_key_put()
operation takes an as_policy_write
policy. If you find yourself setting the key
policy value for every call to aerospike_key_put()
, then you may find it beneficial to set the global as_policy_write
in as_policies.write
, which all write operations will use.
If you find that you want to use a policy value across all operations, then you may find it beneficial to set the default policy value for that policy value.
For example, if you keep setting the key policy value to AS_POLICY_KEY_SEND
, then you may want to just set as_policies.key
. This will set the global default value for the policy value. So, if an global operation policy or a local operation policy does not define a value, then this value will be used.
Global default policy values:
Global operation policies:
If you are using using user-defined functions (UDF) for processing query results (i.e aggregations), then you will find it useful to set the mod_lua
settings. Of particular importance is the mod_lua.user_path
, which allows you to define a path to where the client library will look for Lua files for processing.
Definition at line 201 of file as_config.h.
#include "as_config.h"
Data Fields | |
as_config_host | hosts [AS_CONFIG_HOSTS_SIZE] |
as_config_lua | lua |
as_policies | policies |
uint32_t | tender_interval |
Related Functions | |
(Note that these are not member functions.) | |
as_config * | as_config_init (as_config *c) |
Initialize the configuration to default values.
You should do this to ensure the configuration has valid values, before populating it with custom options.
c | The configuration to initialize. |
as_config_host as_config::hosts[AS_CONFIG_HOSTS_SIZE] |
(seed) hosts Populate with one or more hosts in the cluster that you intend to connect with.
Definition at line 218 of file as_config.h.
as_config_lua as_config::lua |
lua config
Definition at line 223 of file as_config.h.
as_policies as_config::policies |
Client policies
Definition at line 211 of file as_config.h.
uint32_t as_config::tender_interval |
Polling interval in milliseconds for cluster tender
Definition at line 206 of file as_config.h.