Interface ConfigPolicies

Global client policies.

The configuration defines default policies for the application. Policies define the behavior of the client, which can be global for all uses of a single type of command, or local to a single use of an command.

Each database command accepts a policy for that command as an argument. This is considered a local policy, and is a single use policy. This local 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 command. If the global policy for that command is undefined, then the global default value will be used.

If you find that you have behavior that you want every use of an command to utilize, then you can specify the default policy as Config#policies.

For example, the Client#put command takes a WritePolicy parameter. If you find yourself setting the WritePolicy#key policy value for every call to Client.put, then you may find it beneficial to set the global WritePolicy in Config#policies, which all commands will use.

const Aerospike = require('aerospike')

// INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
var config = {
hosts: '192.168.33.10:3000',
policies: {
write: new Aerospike.WritePolicy({
key: Aerospike.policy.key.SEND,
socketTimeout : 0,
totalTimeout : 0
})
}
}

let key = new Aerospike.Key('test', 'demo', 123)

Aerospike.connect(config)
.then(client => {
return client.put(key, {int: 42})
.then(() => client.close())
.catch(error => {
throw error
client.close()
})
})
.catch(console.error)
interface ConfigPolicies {
    apply?: policy.ApplyPolicy;
    batch?: policy.BasePolicy;
    batchParentWrite?: policy.BatchPolicy;
    info?: policy.InfoPolicy;
    operate?: policy.OperatePolicy;
    query?: policy.QueryPolicy;
    read?: policy.ReadPolicy;
    remove?: policy.RemovePolicy;
    scan?: policy.ScanPolicy;
    write?: policy.WritePolicy;
}

Properties

Apply policy. For more information, see ApplyPolicy

Batch policy. For more information, see BasePolicy

batchParentWrite?: policy.BatchPolicy

Batch parent write policy. For more information, see BatchPolicy

Info policy. For more information, see InfoPolicy

Operate policy. For more information, see OperatePolicy

Query policy. For more information, see QueryPolicy

Read policy. For more information, see ReadPolicy

Remove policy. For more information, see RemovePolicy

Scan policy. For more information, see ScanPolicy

Write policy. For more information, see WritePolicy

MMNEPVFCICPMFPCPTTAAATR