aerospike
Advanced tools
Comparing version 5.0.3 to 5.1.0
@@ -141,3 +141,3 @@ // ***************************************************************************** | ||
/** | ||
* The {@link module:aerospike/exp_operations|ExpOperation} module provides functions | ||
* The {@link module:aerospike/exp/operations|ExpOperation} module provides functions | ||
* to create operations using <a href="https://docs.aerospike.com/guide/expressions">⇑Aerospike Expressions</a> | ||
@@ -147,3 +147,3 @@ * for the {@link Client#operate} command. | ||
* | ||
* @summary {@link module:aerospike/exp_operations|aerospike/exp_operations} module | ||
* @summary {@link module:aerospike/exp/operations|aerospike/exp/operations} module | ||
*/ | ||
@@ -210,5 +210,4 @@ exp.operations = require('./exp_operations') | ||
/** | ||
* The main interface of the Aerospike client. Through the Client class, | ||
* commands such as put, get or query can be sent to an Aerospike database | ||
* cluster. | ||
* The main interface of the Aerospike client. Commands such as put, get or query | ||
* can be sent to an Aerospike database cluster using the Client class. | ||
* | ||
@@ -358,14 +357,21 @@ * @summary {@link Client} class | ||
* const Aerospike = require('aerospike') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* log: { level: Aerospike.log.INFO } | ||
* hosts: '192.168.33.10:3000', | ||
* log: { level: Aerospike.log.DEBUG }, | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
* | ||
* var key = new Aerospike.Key('test', 'demo', 'k1') | ||
* client.get(key, (error, record) => { | ||
* client.put(key, {example: 31}, (error) => { | ||
* if (error) throw error | ||
* console.info(record) | ||
* client.close() | ||
* client.get(key, (error, record) => { | ||
* console.info(record) | ||
* client.close() | ||
* }) | ||
* }) | ||
@@ -395,4 +401,12 @@ * }) | ||
* const Key = Aerospike.Key | ||
* | ||
* Aerospike.connect((error, client) => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
@@ -403,3 +417,3 @@ * let key = new Key('test', 'demo', 'key1') | ||
* | ||
* client.put(key, record, meta, (error) => { | ||
* client.put(key, bins, meta, (error) => { | ||
* if (error) throw error | ||
@@ -461,9 +475,9 @@ * | ||
* <a href="http://www.aerospike.com/docs/guide/cdt-list.html" title="Aerospike List Data Type">⇑Lists</a>; | ||
* the index will be build over the individual entries of the list. | ||
* The index will be built over the individual entries of the list. | ||
* @property {number} MAPKEYS - SI for bins containing | ||
* <a href="http://www.aerospike.com/docs/guide/cdt-map.html" title="Aerospike Maps Data Type">⇑Maps</a>; | ||
* the index will be build over the individual keys of the map entries. | ||
* The index will be built over the individual keys of the map entries. | ||
* @property {number} MAPVALUES - SI for bins containing | ||
* <a href="http://www.aerospike.com/docs/guide/cdt-map.html" title="Aerospike Maps Data Type">⇑Maps</a>; | ||
* the index will be build over the individual values of the map entries. | ||
* The index will be built over the individual values of the map entries. | ||
* | ||
@@ -495,7 +509,2 @@ * @see {@link Client#createIndex} | ||
* | ||
* Calling `Aerospike.connect(config, (err, client) -> { ... })` is equivalent to calling | ||
* | ||
* const client = Aerospike.client(config) | ||
* client.connect((err) -> { ... }) | ||
* | ||
* @param {Config} [config] - The configuration for the client. | ||
@@ -506,8 +515,39 @@ * @param {connectCallback} [callback] - The function to call, once the client is connected to the cluster successfully. | ||
* a Promise resolving to the connected client. | ||
* @example <caption>Connection can be established using the {@link module:aerospike|aerospike} module.</caption> | ||
* | ||
* const Aerospike = require('aerospike') | ||
* | ||
* @example <caption>Using callback function</caption> | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* } | ||
* | ||
* Aerospike.connect(config, (err, client) => { | ||
* console.log("Connected. Closing now.") | ||
* client.close() | ||
* }) | ||
* | ||
* @example <caption>Connection can also be established using the {@link Client} module.</caption> | ||
* | ||
* const Aerospike = require('aerospike') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* } | ||
* | ||
* const client = Aerospike.client(config) | ||
* client.connect((err) => { | ||
* console.log("Connected. Closing now.") | ||
* client.close() | ||
* }) | ||
* | ||
* @example <caption>A connection established using callback function.</caption> | ||
* | ||
* const Aerospike = require('aerospike') | ||
* | ||
* let config = { ... } | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* } | ||
* Aerospike.connect(config, (error, client) => { | ||
@@ -519,2 +559,3 @@ * if (error) { | ||
* // client is ready to accept commands | ||
* console.log("Connected. Now closing connection.") | ||
* client.close() | ||
@@ -524,17 +565,14 @@ * } | ||
* | ||
* @example <caption>Returning a Promise</caption> | ||
* @example <caption>A connection established by returning a Promise.</caption> | ||
* | ||
* const Aerospike = require('aerospike') | ||
* | ||
* let config = { ... } | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* } | ||
* Aerospike.connect(config) | ||
* .then(client => { | ||
* // client is ready to accept commands | ||
* return client.get(key) | ||
* .then(record => console.info(record)) | ||
* .then(() => client.close()) | ||
* .catch(error => { | ||
* console.error('Failed to get record: %s', error.message) | ||
* client.close() | ||
* }) | ||
* console.log("Connected. Now Closing Connection.") | ||
* client.close() | ||
* }) | ||
@@ -582,5 +620,21 @@ * .catch(error => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* } | ||
* | ||
* Aerospike.setDefaultLogging({ | ||
* level: Aerospike.log.TRACE | ||
* }) | ||
* | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) { | ||
* console.error('Failed to connect to cluster: %s', error.message) | ||
* process.exit() | ||
* } else { | ||
* // client is ready to accept commands | ||
* console.log("Connected. Now closing connection.") | ||
* client.close() | ||
* } | ||
* }) | ||
*/ | ||
@@ -597,3 +651,3 @@ exports.setDefaultLogging = function (logInfo) { | ||
* different Aerospike clusters. The <code>setupGlobalCommandQueue</code> | ||
* method must be called before any clien} instances are connected. | ||
* method must be called before any client instances are connected. | ||
* | ||
@@ -610,7 +664,9 @@ * @param {CommandQueuePolicy} policy - Set of policy values governing the | ||
/** | ||
* @summary This module {@link module:aerospike/batchType|aerospike/batch_type} | ||
* contains a list of batch record types. | ||
* | ||
*/ | ||
* The {@link module:aerospike/batchType|aerospike/batch_type} | ||
* module contains a list of batch record types. | ||
* | ||
* @summary {@link module:aerospike/batchType|aerospike/batch_type} module | ||
*/ | ||
exports.batchType = require('./batch_type') | ||
@@ -617,0 +673,0 @@ |
@@ -25,3 +25,3 @@ // ***************************************************************************** | ||
* | ||
* @description batch record type. | ||
* @description Identifies batch record type with designated enumerated type | ||
*/ | ||
@@ -34,3 +34,3 @@ | ||
/** | ||
* An instance of class Record that is used in a batch for read operations. | ||
* An instance of class {@link Record} that is used in a batch for read operations. | ||
* @const {number} | ||
@@ -41,3 +41,3 @@ */ | ||
/** | ||
* An instance of class Record that is used in a batch for write operations. | ||
* An instance of class {@link Record} that is used in a batch for write operations. | ||
* @const {number} | ||
@@ -48,3 +48,3 @@ */ | ||
/** | ||
* An instance of class Record that is used in a batch for applying record. | ||
* An instance of class {@link Record} that is used in a batch for applying record. | ||
* @const {number} | ||
@@ -55,6 +55,8 @@ */ | ||
/** | ||
* An instance of class Record that is used in a batch for removal operations. | ||
* An instance of class {@link Record} that is used in a batch for removal operations. | ||
* @const {number} | ||
*/ | ||
BATCH_REMOVE: batchType.BATCH_REMOVE | ||
} |
@@ -45,3 +45,3 @@ // ***************************************************************************** | ||
/** | ||
* @class module:aerospike/bitwise~BitwiseOperation | ||
* @class aerospike/bitwise~BitwiseOperation | ||
* | ||
@@ -65,3 +65,3 @@ * @classdesc Use the methods in the {@link module:aerospike/bitwise|bitwise} | ||
/** | ||
* @class module:aerospike/bitwise~OverflowableBitwiseOp | ||
* @class aerospike/bitwise~OverflowableBitwiseOp | ||
* | ||
@@ -68,0 +68,0 @@ * @classdesc Bitwise operation variant that can overflow/underflow. |
@@ -96,3 +96,3 @@ // ***************************************************************************** | ||
/** | ||
* @summary yLookup map by index offset. | ||
* @summary Lookup map by index offset. | ||
* | ||
@@ -99,0 +99,0 @@ * @description If the index is negative, the resolved index starts backwards |
@@ -23,2 +23,4 @@ // ***************************************************************************** | ||
class Config { | ||
/** | ||
@@ -37,3 +39,3 @@ * @class Config | ||
* const Aerospike = require('aerospike') | ||
* | ||
* | ||
* let config = { | ||
@@ -45,3 +47,3 @@ * hosts: '192.168.1.10,192.168.1.11', | ||
* read: new Aerospike.ReadPolicy({ | ||
* totalTimeout: 500 | ||
* totalTimeout: 0 | ||
* }) | ||
@@ -63,9 +65,8 @@ * }, | ||
* }) | ||
* | ||
* | ||
* // Initializes a new client configuration from the given config values. | ||
* | ||
* @param {Object} [config] configuration values | ||
*/ | ||
class Config { | ||
/** | ||
* Initializes a new client configuration from the given config values. | ||
* | ||
* @param {Object} [config] configuration values | ||
*/ | ||
constructor (config) { | ||
@@ -266,9 +267,14 @@ config = config || {} | ||
* | ||
* let config = { | ||
* // 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 | ||
* key: Aerospike.policy.key.SEND, | ||
* socketTimeout : 0, | ||
* totalTimeout : 0 | ||
* }) | ||
* } | ||
* } | ||
* | ||
* let key = new Aerospike.Key('test', 'demo', 123) | ||
@@ -281,4 +287,4 @@ * | ||
* .catch(error => { | ||
* throw error | ||
* client.close() | ||
* throw error | ||
* }) | ||
@@ -307,6 +313,9 @@ * }) | ||
* const Aerospike = require('aerospike') | ||
* | ||
* const fs = require('fs') | ||
* | ||
* var debuglog = fs.openSync('./debug.log') | ||
* var debuglog = fs.openSync('./debug.log', 'w') | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* log: { | ||
@@ -319,3 +328,3 @@ * level: Aerospike.log.DEBUG, | ||
* if (err) throw err | ||
* // ... | ||
* console.log("Connected. Now closing connection.") | ||
* client.close() | ||
@@ -322,0 +331,0 @@ * }) |
@@ -35,26 +35,30 @@ // ***************************************************************************** | ||
* const Double = Aerospike.Double | ||
* const client = Aerospike.client().connect((error) => { | ||
* if (error) throw error | ||
* }) | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* // (1.0) must be wrapped with "Double" in order to be added to another double. | ||
* // (6.283) does not need to be wrapped, but it may be wrapped if convenient. | ||
* ops = [Aerospike.operations.incr('d', 6.283), | ||
* Aerospike.operations.incr('d', new Double(1.0))] | ||
* const key = new Aerospike.Key('test', 'demo', 'myDouble') | ||
* | ||
* var record = { d: 3.1415 } | ||
* client.put(key, record, (error) => { | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
* }) | ||
* | ||
* function incr (value) { | ||
* // wrap value in Double since we can't be sure it would be converted to | ||
* // double automatically, e.g. 1.0 | ||
* client.operate(key, [Aerospike.operations.incr('d', new Double(value))], (error) => { | ||
* client.put(key, record, (error) => { | ||
* if (error) throw error | ||
* client.operate(key, ops, (error) => { | ||
* if (error) throw error | ||
* client.get(key, (error, record) => { | ||
* console.log(record.bins.d) // => 10.4245 | ||
* client.close() | ||
* }) | ||
* }) | ||
* }) | ||
* } | ||
* | ||
* incr(6.283) | ||
* incr(1.0) | ||
* | ||
* client.get(key, (error, record) => { | ||
* console.log(record) | ||
* client.close() | ||
* }) | ||
@@ -61,0 +65,0 @@ */ |
@@ -31,2 +31,13 @@ // ***************************************************************************** | ||
* const Aerospike = require('aerospike') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* | ||
* let key = new Aerospike.Key('test', 'key', 'does_not_exist') | ||
@@ -156,4 +167,14 @@ * Aerospike.connect() | ||
* const Aerospike = require('aerospike') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* | ||
* Aerospike.connect(config).then(async client => { | ||
* await client.put(new Aerospike.Key('demo', 'test', 'foo'), { 'foo': 'bar' }) | ||
@@ -160,0 +181,0 @@ * client.close() |
@@ -20,3 +20,3 @@ // ***************************************************************************** | ||
/** | ||
* @module aerospike/exp_operations | ||
* @module aerospike/exp/operations | ||
* | ||
@@ -28,12 +28,21 @@ * @description This module provides functions to easily create read/write operations | ||
* @see {@link Client#operate} | ||
* @see {@link Aerospike#exp} | ||
* @see {@link module:aerospike/exp/operations|aerospike/exp/operations } | ||
* | ||
* @example | ||
* | ||
* const Aerospike = require('aerospike') | ||
* const op = Aerospike.operations | ||
* const exp = Aerospike.expressions | ||
* const exp = Aerospike.exp | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* const tempBin = 'ExpVar' // this bin is to hold expression read operation output | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* const config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* | ||
* var ops = [ | ||
@@ -45,6 +54,7 @@ * op.append('a', 'xyz'), | ||
* 0), | ||
* op.read('a'), | ||
* op.read('b') | ||
* ] | ||
* | ||
* Aerospike.connect((error, client) => { | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
@@ -55,3 +65,3 @@ * client.put(key, { a: 'abc', b: 42 }, (error) => { | ||
* if (error) throw error | ||
* console.log(record) // => { b: 52, ExpVar: 104 } | ||
* console.log(record.bins) // => { a: 'abcxyz', b: 52, ExpVar: 104 } | ||
* client.close() | ||
@@ -67,3 +77,4 @@ * }) | ||
/** | ||
* @class module:aerospike/exp_operations~ExpOperation | ||
* @protected | ||
* @class aerospike/exp_operations~ExpOperation | ||
* | ||
@@ -77,5 +88,3 @@ * @classdesc class for all expression operations executed with the {@link | ||
class ExpOperation { | ||
/** | ||
* @protected | ||
*/ | ||
constructor (op, bin, exp, flags, props) { | ||
@@ -82,0 +91,0 @@ this.op = op |
@@ -49,3 +49,3 @@ // ***************************************************************************** | ||
/** | ||
* @class module:aerospike/filter~SindexFilterPredicate | ||
* @class aerospike/filter~SindexFilterPredicate | ||
* @classdesc SI filter predicate to limit the scope of a {@link Query}. | ||
@@ -52,0 +52,0 @@ * |
@@ -40,4 +40,13 @@ // ***************************************************************************** | ||
* const Key = Aerospike.Key | ||
* | ||
* Aerospike.connect((error, client) => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* | ||
* } | ||
* } | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
@@ -48,3 +57,7 @@ * let key = new Key('test', 'demo', 'bob') | ||
* if (error) throw error | ||
* client.close() | ||
* client.get(key, (error, record) => { | ||
* if (error) throw error | ||
* console.log(record.bins.loc) // => {"type":"Point","coordinates":[103.913,1.308]} | ||
* client.close() | ||
* }) | ||
* }) | ||
@@ -51,0 +64,0 @@ * }) |
@@ -37,4 +37,12 @@ // ***************************************************************************** | ||
* const key = new Aerospike.Key('test', 'demo', 'hllDemo') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async client => { | ||
* const result = await client.operate(key, [ | ||
@@ -47,3 +55,3 @@ * hll.init('demo', 10), | ||
* ]) | ||
* console.info('Count:', result.bins) // => Count: 5 | ||
* console.log('Count:', result.bins.demo) // => Count: 5 | ||
* client.close() | ||
@@ -57,3 +65,10 @@ * }) | ||
* const ops = Aerospike.operations | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* const key1 = new Aerospike.Key('test', 'demo', 'hllDemo1') | ||
@@ -63,3 +78,3 @@ * const key2 = new Aerospike.Key('test', 'demo', 'hllDemo2') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* Aerospike.connect(config).then(async client => { | ||
* const { bins: { colors: colors1 } } = await client.operate(key1, [ | ||
@@ -82,3 +97,3 @@ * hll.add('colors', ['blue', 'green', 'orange', 'yellow'], 12), | ||
* | ||
* console.info('Count:', count) // => Count: 9 | ||
* console.log('Count:', count) // => Count: 9 | ||
* client.close() | ||
@@ -101,3 +116,3 @@ * }) | ||
/** | ||
* @class module:aerospike/hll~HLLOperation | ||
* @class aerospike/hll~HLLOperation | ||
* | ||
@@ -104,0 +119,0 @@ * @classdesc Use the methods in the {@link module:aerospike/hll|hll} |
@@ -35,25 +35,47 @@ // ***************************************************************************** | ||
* const Aerospike = require('aerospike') | ||
* | ||
* let binName = 'location' | ||
* let indexName = 'locationIndex' | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* | ||
* let binName = 'food' | ||
* let indexName = 'foodIndex' | ||
* let options = { | ||
* ns: 'test' | ||
* set: 'demo' | ||
* ns: 'test', | ||
* set: 'demo', | ||
* bin: binName, | ||
* index: indexName, | ||
* datatype: Aerospike.indexDataType.GEO2DSPHERE | ||
* datatype: Aerospike.indexDataType.STRING | ||
* } | ||
* | ||
* Aerospike.connect() | ||
* Aerospike.connect(config) | ||
* .then(client => { | ||
* client.createIndex(options) | ||
* .then(job => job.wait()) | ||
* .then(() => { | ||
* console.info('secondary index (SI) %s on %s was created successfully', indexName, binName) | ||
* client.close() | ||
* client.put(new Aerospike.Key('test', 'demo', 'mykey1'), {location: "Kale"}) | ||
* .then((result) => { | ||
* client.createIndex(options) | ||
* .then(job => job.wait()) | ||
* .then(() => { | ||
* console.info('secondary index (SI) %s on %s was created successfully', indexName, binName) | ||
* client.indexRemove('test', indexName) | ||
* .then(() => { | ||
* client.close() | ||
* }) | ||
* .catch(error => { | ||
* console.error('Error removing index:', error) | ||
* client.close() | ||
* }) | ||
* }) | ||
* .catch(error => { | ||
* console.error('Error creating index:', error) | ||
* client.close() | ||
* }) | ||
* }) | ||
* .catch(error => { | ||
* console.error('Error creating index:', error) | ||
* client.close() | ||
* }) | ||
* console.error('Error writing record:', error) | ||
* client.close() | ||
* }) | ||
* }) | ||
@@ -60,0 +82,0 @@ * .catch(error => console.error('Error connecting to cluster:', error)) |
@@ -35,3 +35,8 @@ // ***************************************************************************** | ||
* const Aerospike = require('aerospike') | ||
* Aerospike.connect((error, client) => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* } | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
@@ -236,3 +241,5 @@ * | ||
/** Returns a new string with the last character removed */ | ||
/** Returns a new string with the last character removed | ||
* @private | ||
* */ | ||
function chop (str) { | ||
@@ -239,0 +246,0 @@ return str.substring(0, str.length - 1) |
@@ -105,4 +105,12 @@ // ***************************************************************************** | ||
* const Aerospike = require('aerospike') | ||
* | ||
* Aerospike.connect((error, client) => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* scan : new Aerospike.ScanPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* } | ||
* } | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
@@ -109,0 +117,0 @@ * |
394
lib/lists.js
@@ -64,3 +64,3 @@ // ***************************************************************************** | ||
/** | ||
* @class module:aerospike/lists~ListOperation | ||
* @class aerospike/lists~ListOperation | ||
* | ||
@@ -86,4 +86,12 @@ * @classdesc Use the methods in the {@link module:aerospike/lists|lists} | ||
* const key = new Aerospike.Key('test', 'demo', 'listsTest') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async client => { | ||
* await client.put(key, { list: [32, 5, 85, 16, 22] }) | ||
@@ -95,3 +103,3 @@ * const ops = [ | ||
* const result = await client.operate(key, ops) | ||
* console.info('Result:', result.bins.list) // => Result: [ 16, 22 ] | ||
* console.log('Result:', result.bins.list) // => Result: [ 16, 22 ] | ||
* client.close() | ||
@@ -120,4 +128,12 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'listsTest') | ||
* | ||
* Aerospike.connect().then(async (client) => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async (client) => { | ||
* await client.put(key, { list: [[32, 5, 85], [16, 22]] }) | ||
@@ -129,3 +145,3 @@ * const ops = [ | ||
* const result = await client.operate(key, ops) | ||
* console.info('Result:', result.bins.list) // => Result: 16 | ||
* console.log('Result:', result.bins.list) // => Result: 16 | ||
* client.close() | ||
@@ -140,4 +156,12 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'listsTest') | ||
* | ||
* Aerospike.connect().then(async (client) => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async (client) => { | ||
* await client.put(key, { map: { nested: [32, 5, 85, 16, 22] } }) | ||
@@ -150,3 +174,3 @@ * const context = new Context().addMapKey('nested') | ||
* const result = await client.operate(key, ops) | ||
* console.info('Result:', result.bins.map) // => Result: 22 | ||
* console.log('Result:', result.bins.map) // => Result: 22 | ||
* client.close() | ||
@@ -181,4 +205,12 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'listsTest') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async client => { | ||
* await client.put(key, { tags: ['blue', 'yellow', 'pink'] }) | ||
@@ -191,3 +223,3 @@ * const ops = [ | ||
* const record = await client.get(key) | ||
* console.info('Result:', record.bins.tags) // => Result: [ 'yellow' ] | ||
* console.log('Result:', record.bins.tags) // => Result: [ 'yellow' ] | ||
* client.close() | ||
@@ -219,3 +251,3 @@ * }) | ||
* @summary List order. | ||
* @description The order determines what kind of index the Aerospike server | ||
* @description The order determines what kind of indices the Aerospike server | ||
* maintains for the list. | ||
@@ -282,3 +314,3 @@ * | ||
/** | ||
* @summary Sets the list order. | ||
* @summary Sets the list order to <code>ORDERED</code> or <code>UNORDERED</code> | ||
* @description This operation does not return any result. | ||
@@ -327,6 +359,14 @@ * | ||
* const Aerospike = require('aerospike') | ||
* const op = Aerospike.operator | ||
* const op = Aerospike.operations | ||
* const lists = Aerospike.lists | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -337,3 +377,3 @@ * lists.append('tags', 'orange'), | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -344,3 +384,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(result.tags) // => [ 'blue', 'yellow', 'pink', 'orange' ] | ||
* console.log(result.bins.tags) // => [ 'blue', 'yellow', 'pink', 'orange' ] | ||
* client.close() | ||
@@ -371,6 +411,14 @@ * }) | ||
* const Aerospike = require('aerospike') | ||
* const op = Aerospike.operator | ||
* const op = Aerospike.operations | ||
* const lists = Aerospike.lists | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -381,3 +429,3 @@ * lists.appendItems('tags', ['orange', 'green']), | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -388,3 +436,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(result.tags) // => [ 'blue', 'yellow', 'pink', 'orange', 'green' ] | ||
* console.log(result.bins.tags) // => [ 'blue', 'yellow', 'pink', 'orange', 'green' ] | ||
* client.close() | ||
@@ -416,6 +464,15 @@ * }) | ||
* const Aerospike = require('aerospike') | ||
* const op = Aerospike.operator | ||
* const op = Aerospike.operations | ||
* const lists = Aerospike.lists | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* | ||
* var ops = [ | ||
@@ -426,3 +483,3 @@ * lists.insert('tags', 2, 'orange'), | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -433,3 +490,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(result.tags) // => [ 'blue', 'yellow', 'orange', 'pink' ] | ||
* console.log(result.bins.tags) // => [ 'blue', 'yellow', 'orange', 'pink' ] | ||
* client.close() | ||
@@ -461,6 +518,14 @@ * }) | ||
* const Aerospike = require('aerospike') | ||
* const op = Aerospike.operator | ||
* const op = Aerospike.operations | ||
* const lists = Aerospike.lists | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -471,3 +536,3 @@ * lists.insertItems('tags', 2, ['orange', 'green']), | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -478,3 +543,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(result.tags) // => [ 'blue', 'yellow', 'orange', 'green', 'pink' ] | ||
* console.log(result.bins.tags) // => [ 'blue', 'yellow', 'orange', 'green', 'pink' ] | ||
* client.close() | ||
@@ -503,10 +568,20 @@ * }) | ||
* const Aerospike = require('aerospike') | ||
* const op = Aerospike.operator | ||
* const op = Aerospike.operations | ||
* const lists = Aerospike.lists | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
* lists.pop('tags', 1) | ||
* ] | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -517,6 +592,6 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(result.tags) // => [ 'yellow' ] | ||
* console.log(result.bins.tags) // => yellow | ||
* client.get(key, (error, record) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: [ 'blue', 'pink' ] } | ||
* console.log(record.bins.tags) // => { [ 'blue', 'pink' ] } | ||
* client.close() | ||
@@ -535,3 +610,3 @@ * }) | ||
/** | ||
* @summary Removes and returns the list elements at the specified range. | ||
* @summary Removes and returns the list elements in the specified range. | ||
* | ||
@@ -548,3 +623,12 @@ * @param {string} bin - The name of the bin. The bin must contain a List value. | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -554,3 +638,3 @@ * lists.popRange('tags', 0, 2) | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -561,6 +645,6 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(result.tags) // => [ 'blue', 'yellow' ] | ||
* console.log(result.bins.tags) // => [ 'blue', 'yellow' ] | ||
* client.get(key, (error, record) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: [ 'pink' ] } | ||
* console.log(record.bins.tags) // => { [ 'pink' ] } | ||
* client.close() | ||
@@ -593,3 +677,12 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -599,3 +692,3 @@ * lists.remove('tags', 1) | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -608,3 +701,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: [ 'blue', 'pink' ] } | ||
* console.log(record.bins.tags) // => { [ 'blue', 'pink' ] } | ||
* client.close() | ||
@@ -623,3 +716,3 @@ * }) | ||
/** | ||
* @summary Removes the list elements at the specified range. | ||
* @summary Removes the list elements in the specified range. | ||
* @description This operation returns the number of elements removed from the | ||
@@ -638,3 +731,12 @@ * list. | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -644,3 +746,3 @@ * lists.removeRange('tags', 0, 2) | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -653,3 +755,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: [ 'pink' ] } | ||
* console.log(record.bins.tags) // => { [ 'pink' ] } | ||
* client.close() | ||
@@ -692,4 +794,12 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'listsTest') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async client => { | ||
* await client.put(key, { tags: ['blue', 'yellow', 'pink'] }) | ||
@@ -701,5 +811,5 @@ * const ops = [ | ||
* const result = await client.operate(key, ops) | ||
* console.info('Result:', result.bins.tags) // => Result: yellow | ||
* console.log('Result:', result.bins.tags) // => Result: yellow | ||
* const record = await client.get(key) | ||
* console.info('Record:', record.bins.tags) // => Record: [ 'blue', 'pink' ] | ||
* console.log('Record:', record.bins.tags) // => Record: [ 'blue', 'pink' ] | ||
* client.close() | ||
@@ -877,4 +987,13 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'listKey') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async client => { | ||
* await client.put(key, { list: [0, 4, 5, 9, 11, 15] }) | ||
@@ -884,5 +1003,5 @@ * let result = await client.operate(key, [ | ||
* .andReturn(lists.returnType.VALUE)]) | ||
* console.info(result.bins.list) // => [ 11, 15 ] | ||
* console.log(result.bins.list) // => [ 11, 15 ] | ||
* let record = await client.get(key) | ||
* console.info(record.bins.list) // => [ 0, 4, 5, 9 ] | ||
* console.log(record.bins.list) // => [ 0, 4, 5, 9 ] | ||
* client.close() | ||
@@ -967,3 +1086,12 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -973,3 +1101,3 @@ * lists.clear('tags') | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -982,3 +1110,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: [ ] } | ||
* console.log(record.bins.tags) // => { [ ] } | ||
* client.close() | ||
@@ -1004,3 +1132,3 @@ * }) | ||
* | ||
* @example | ||
* @console.log | ||
* | ||
@@ -1010,3 +1138,13 @@ * const Aerospike = require('aerospike') | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency varies with hardware selection. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout: 0}), | ||
* write : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout: 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout: 0}) | ||
* | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -1016,3 +1154,3 @@ * lists.set('tags', 1, 'green') | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -1025,3 +1163,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: [ 'blue', 'green', 'pink' ] } | ||
* console.log(record.bins) // => { tags: [ 'blue', 'green', 'pink' ] } | ||
* client.close() | ||
@@ -1038,3 +1176,3 @@ * }) | ||
/** | ||
* @summary Removes all list elements **not** within the specified range. | ||
* @summary Removes all list elements that are not within the specified range. | ||
* @description This operation returns the number of list elements removed. | ||
@@ -1052,3 +1190,12 @@ * | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -1058,3 +1205,3 @@ * lists.trim('tags', 1, 1) | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -1067,3 +1214,3 @@ * client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: [ 'yellow' ] } | ||
* console.log(record.bins.tags) // => { ['yellow'] } | ||
* client.close() | ||
@@ -1094,3 +1241,11 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -1100,13 +1255,11 @@ * lists.get('tags', 0) | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
* client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* client.operate(key, ops, (error) => { | ||
* client.operate(key, ops, (error, result) => { | ||
* if (error) throw error | ||
* client.get(key, (error, record) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: 'blue' } | ||
* client.close() | ||
* }) | ||
* console.log(result.bins) // => { tags: 'blue' } | ||
* client.close() | ||
* | ||
* }) | ||
@@ -1123,3 +1276,3 @@ * }) | ||
/** | ||
* @summary Returns the list element at the specified range. | ||
* @summary Returns the list element in the specified range. | ||
* | ||
@@ -1136,3 +1289,11 @@ * @param {string} bin - The name of the bin. The bin must contain a List value. | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -1142,13 +1303,11 @@ * lists.getRange('tags', 1) | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
* client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* client.operate(key, ops, (error) => { | ||
* client.operate(key, ops, (error, result) => { | ||
* if (error) throw error | ||
* client.get(key, (error, record) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: [ 'yellow', 'pink' ] } | ||
* client.close() | ||
* }) | ||
* console.log(result.bins.tags) // => { [ 'yellow', 'pink' ] } | ||
* client.close() | ||
* | ||
* }) | ||
@@ -1166,3 +1325,3 @@ * }) | ||
/** | ||
* @summary Retrieves a single list element identified by its index from the list. | ||
* @summary Retrieves a single list element from the list using a specified index. | ||
* @description This operation returns the data specified by <code>returnType</code>. | ||
@@ -1190,4 +1349,12 @@ * | ||
* const key = new Aerospike.Key('test', 'demo', 'listsTest') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async client => { | ||
* await client.put(key, { tags: ['blue', 'yellow', 'pink'] }) | ||
@@ -1199,3 +1366,3 @@ * const ops = [ | ||
* const result = await client.operate(key, ops) | ||
* console.info('Result:', result.bins.tags) // => Result: yellow | ||
* console.log('Result:', result.bins.tags) // => Result: yellow | ||
* client.close() | ||
@@ -1373,4 +1540,12 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'listKey') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async client => { | ||
* await client.put(key, { list: [0, 4, 5, 9, 11, 15] }) | ||
@@ -1381,3 +1556,3 @@ * await client.operate(key, [ lists.setOrder('list', lists.order.ORDERED) ]) | ||
* .andReturn(lists.returnType.VALUE)]) | ||
* console.info(result.bins.list) // => [ 4, 5 ] | ||
* console.log(result.bins.list) // => [ 4, 5 ] | ||
* client.close() | ||
@@ -1471,4 +1646,15 @@ * }) | ||
* ] | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
@@ -1479,6 +1665,6 @@ * client.put(key, { counters: [1, 2, 3] }, (error) => { | ||
* if (error) throw error | ||
* console.log(result['counters']) => 5 | ||
* console.log(result['bins']['counters']) // => 5 | ||
* client.get(key, (error, record) => { | ||
* if (error) throw error | ||
* console.log(record) // => { counters: [1, 5, 3] } | ||
* console.log(record['bins']['counters']) // => { [1, 5, 3] } | ||
* client.close() | ||
@@ -1509,3 +1695,11 @@ * }) | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -1515,9 +1709,9 @@ * lists.size('tags') | ||
* | ||
* Aerospike.client().connect((error, client) => { | ||
* Aerospike.client(config).connect((error, client) => { | ||
* if (error) throw error | ||
* client.put(key, { tags: ['blue', 'yellow', 'pink'] }, (error) => { | ||
* if (error) throw error | ||
* client.operate(key, ops, (error) => { | ||
* client.operate(key, ops, (error, result) => { | ||
* if (error) throw error | ||
* console.log(record) // => { tags: 3 } | ||
* console.log(result.bins.tags) // => { 3 } | ||
* client.close() | ||
@@ -1524,0 +1718,0 @@ * }) |
114
lib/maps.js
@@ -84,3 +84,14 @@ // ***************************************************************************** | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* remove : new Aerospike.RemovePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* | ||
* Aerospike.connect(config).then(async client => { | ||
* let ops = [ | ||
@@ -110,3 +121,3 @@ * maps.put('map', 'e', 5, { | ||
/** | ||
* @class module:aerospike/maps~MapOperation | ||
* @class aerospike/maps~MapOperation | ||
* | ||
@@ -133,4 +144,13 @@ * @classdesc Use the methods in the {@link module:aerospike/maps|maps} | ||
* const key = new Aerospike.Key('test', 'demo', 'mapKey') | ||
* | ||
* Aerospike.connect().then(async client => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async client => { | ||
* await client.put(key, { map: { a: 1, b: 2, c: 3, d: 4, e: 5 } }) | ||
@@ -166,4 +186,12 @@ * const ops = [ | ||
* const key = new Aerospike.Key('test', 'demo', 'mapsTest') | ||
* | ||
* Aerospike.connect().then(async (client) => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async (client) => { | ||
* await client.put(key, { maps: [{ a: 1, b: 2 }, { b: 3, c: 4 }] }) | ||
@@ -186,4 +214,12 @@ * const ops = [ | ||
* const key = new Aerospike.Key('test', 'demo', 'listsTest') | ||
* | ||
* Aerospike.connect().then(async (client) => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async (client) => { | ||
* await client.put(key, { maps: { alpha: { a: 1, b: 2 }, beta: { b: 3, c: 4 } } }) | ||
@@ -228,6 +264,3 @@ * const context = new Context().addMapKey('alpha') | ||
* | ||
* @description The write mode determines whether a write operation succeeds, | ||
* depending on whether the map key(s) to be written already exist. It also | ||
* determines whether a new map will be created automatically if the record | ||
* bin, which the map operation is targeting, is currently empty. | ||
* @description Write mode is used to determine the criteria for a successful operation. | ||
* | ||
@@ -254,6 +287,3 @@ * Map write mode should only be used for server versions prior to v4.3. For | ||
* | ||
* @description The write flags determine whether a write operation succeeds, | ||
* depending on whether the map key(s) to be written already exist. They also | ||
* determine whether a new map will be created automatically if the record bin, | ||
* which the map operation is targeting, is currently empty. | ||
* @description Write flags are used to determine the criteria for a successful operation. | ||
* | ||
@@ -351,3 +381,3 @@ * Map write flags require server version v4.3 or later. For earier server | ||
* | ||
* @description Depending on the map policy and whether an entry with the same | ||
* @description For each item, depending on the map policy and whether an entry with the same | ||
* key already exists in the map, a new entry will be added to the map or the | ||
@@ -567,4 +597,13 @@ * existing entry with the same key will be updated. If the bin does not yet | ||
* const key = new Aerospike.Key('test', 'demo', 'mapKey') | ||
* | ||
* Aerospike.connect() | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config) | ||
* .then(async client => { | ||
@@ -707,3 +746,13 @@ * await client.put(key, { map: { a: 17, e: 2, f: 15, j: 10 } }) | ||
* | ||
* Aerospike.connect() | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config) | ||
* .then(async client => { | ||
@@ -938,4 +987,12 @@ * await client.put(key, { map: { e: 2, j: 10, f: 15, a: 17 } }) | ||
* const key = new Aerospike.Key('test', 'demo', 'mapKey') | ||
* | ||
* Aerospike.connect() | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config) | ||
* .then(async client => { | ||
@@ -1051,4 +1108,13 @@ * await client.put(key, { map: { a: 17, e: 2, f: 15, j: 10 } }) | ||
* const key = new Aerospike.Key('test', 'demo', 'mapKey') | ||
* | ||
* Aerospike.connect() | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* | ||
* } | ||
* } | ||
* Aerospike.connect(config) | ||
* .then(async client => { | ||
@@ -1055,0 +1121,0 @@ * await client.put(key, { map: { e: 2, j: 10, f: 15, a: 17 } }) |
@@ -32,3 +32,11 @@ // ***************************************************************************** | ||
* const key = new Aerospike.Key('test', 'demo', 'mykey1') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* } | ||
* } | ||
* var ops = [ | ||
@@ -40,3 +48,3 @@ * op.append('a', 'xyz'), | ||
* | ||
* Aerospike.connect((error, client) => { | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
@@ -47,3 +55,3 @@ * client.put(key, { a: 'abc', b: 42 }, (error) => { | ||
* if (error) throw error | ||
* console.log(record) // => { b: 52 } | ||
* console.log(record.bins) // => { b: 52 } | ||
* client.close() | ||
@@ -54,22 +62,19 @@ * }) | ||
*/ | ||
const as = require('bindings')('aerospike.node') | ||
const ops = as.scalarOperations | ||
/** | ||
* @class module:aerospike/operations~Operation | ||
* | ||
* @classdesc Base class for all operations executed with the {@link | ||
* Client#operate} command. | ||
* | ||
* Operations can be created using the methods in one of the following modules: | ||
* * {@link module:aerospike/operations} - General operations on all types. | ||
* * {@link module:aerospike/lists} - Operations on CDT List values. | ||
* * {@link module:aerospike/maps} - Operations on CDT Map values. | ||
* * {@link module:aerospike/bitwise} - Operations on Bytes values. | ||
*/ | ||
* @class aerospike/operations~Operation | ||
* @protected | ||
* @classdesc Base class for all operations executed with the {@link | ||
* Client#operate} command. | ||
* | ||
* Operations can be created using the methods in one of the following modules: | ||
* * {@link module:aerospike/operations} - General operations on all types. | ||
* * {@link module:aerospike/lists} - Operations on CDT List values. | ||
* * {@link module:aerospike/maps} - Operations on CDT Map values. | ||
* * {@link module:aerospike/bitwise} - Operations on Bytes values. | ||
* | ||
*/ | ||
class Operation { | ||
/** | ||
* @protected | ||
*/ | ||
constructor (op, bin, props) { | ||
@@ -115,3 +120,3 @@ this.op = op | ||
* @param {string} bin - The name of the bin. | ||
* @param {(number|Object)} value - The number|{@link Double} value to increment the bin by. | ||
* @param {(number|Object)} value - The <code>number</code>|{@link Double} value to increment the bin by. | ||
* @returns {Operation} Operation that can be passed to the {@link Client#operate} command. | ||
@@ -118,0 +123,0 @@ */ |
@@ -103,12 +103,4 @@ // ***************************************************************************** | ||
* | ||
* // Set default policies for read and write commands | ||
* const defaults = { | ||
* socketTimeout: 50, | ||
* totalTimeout: 100 | ||
* } | ||
* const config = { | ||
* policies: { | ||
* read: new Aerospike.ReadPolicy(defaults), | ||
* write: new Aerospike.WritePolicy(defaults) | ||
* } | ||
* hosts: '192.168.33.10:3000' | ||
* } | ||
@@ -125,3 +117,5 @@ * | ||
* exists: Aerospike.policy.exists.CREATE, | ||
* key: Aerospike.policy.key.SEND | ||
* key: Aerospike.policy.key.SEND, | ||
* socketTimeout: 0, | ||
* totalTimeout: 0 | ||
* }) | ||
@@ -163,4 +157,11 @@ * | ||
* const key = new Aerospike.Key('test', 'test', 'myKey') | ||
* | ||
* Aerospike.connect().then(async (client) => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* Aerospike.connect(config).then(async (client) => { | ||
* await client.put(key, { foo: 'bar' }) | ||
@@ -295,3 +296,3 @@ * | ||
/** | ||
* A policy affecting the behavior of most operations. | ||
* A base class extended to client policies. | ||
* | ||
@@ -298,0 +299,0 @@ * @summary {@link BasePolicy} class |
@@ -43,3 +43,13 @@ // ***************************************************************************** | ||
* const Aerospike = require('aerospike') | ||
* Aerospike.connect((error, client) => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* scan : new Aerospike.ScanPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* } | ||
* } | ||
* | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
@@ -46,0 +56,0 @@ * var recordsSeen = 0 |
@@ -23,7 +23,9 @@ // ***************************************************************************** | ||
* | ||
* @summary Construct a new Aerospike Record instance. | ||
* | ||
* | ||
* A record with the Aerospike database consists of one or more record "bins" | ||
* (name-value pairs) and meta-data, including time-to-live and generation; a | ||
* record is uniquely identified by it's key within a given namespace. | ||
* | ||
* @summary Construct a new Aerospike Record instance. | ||
* | ||
@@ -33,3 +35,12 @@ * @example <caption>Writing a new record with 5 bins while setting a record TTL.</caption> | ||
* const Aerospike = require('aerospike') | ||
* | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* } | ||
* } | ||
* | ||
* let bins = { | ||
@@ -48,10 +59,21 @@ * int: 123, | ||
* | ||
* Aerospike.connect() | ||
* Aerospike.connect(config) | ||
* .then(client => { | ||
* return client.put(key, bins, meta) | ||
* .then(() => client.close()) | ||
* .then(() => { | ||
* client.get(key) | ||
* .then((record) => { | ||
* console.log(record) | ||
* client.close() | ||
* }) | ||
* .catch(error => { | ||
* console.log(record) | ||
* client.close() | ||
* return Promise.reject(error) | ||
* }) | ||
* }) | ||
* .catch(error => { | ||
* client.close() | ||
* return Promise.reject(error) | ||
* }) | ||
* }) | ||
@@ -64,7 +86,19 @@ * .catch(error => console.error('Error:', error)) | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* } | ||
* } | ||
* | ||
* let key = new Aerospike.Key('test', 'demo', 'myKey') | ||
* | ||
* Aerospike.connect() | ||
* Aerospike.connect(config) | ||
* .then(client => { | ||
* client.get(key) | ||
* client.put(key, {tags : ['blue', 'pink']}) | ||
* .then(() => { | ||
* client.get(key) | ||
* .then(record => { | ||
@@ -80,4 +114,9 @@ * console.info('Key:', record.key) | ||
* return Promise.reject(error) | ||
* }) | ||
* }) | ||
* }) | ||
* }) | ||
* .catch(error => { | ||
* client.close() | ||
* return Promise.reject(error) | ||
* }) | ||
* }) | ||
* .catch(error => console.error('Error:', error)) | ||
@@ -90,8 +129,21 @@ * | ||
* const Aerospike = require('aerospike') | ||
* const op = Aerospike.operations | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* batch : new Aerospike.BatchPolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* | ||
* } | ||
* } | ||
* | ||
* var batchRecords = [ | ||
* { type: batchType.BATCH_READ, | ||
* { type: Aerospike.batchType.BATCH_READ, | ||
* key: new Aerospike.Key('test', 'demo', 'key1'), bins: ['i', 's'] }, | ||
* { type: batchType.BATCH_READ, | ||
* { type: Aerospike.batchType.BATCH_READ, | ||
* key: new Aerospike.Key('test', 'demo', 'key2'), readAllBins: true }, | ||
* { type: batchType.BATCH_READ, | ||
* { type: Aerospike.batchType.BATCH_READ, | ||
* key: new Aerospike.Key('test', 'demo', 'key3'), | ||
@@ -102,3 +154,3 @@ * ops:[ | ||
* ] | ||
* Aerospike.connect(function (error, client) { | ||
* Aerospike.connect(config, function (error, client) { | ||
* if (error) throw error | ||
@@ -109,4 +161,7 @@ * client.batchRead(batchRecords, function (error, results) { | ||
* console.log(result) | ||
* | ||
* }) | ||
* client.close() | ||
* }) | ||
* | ||
* }) | ||
@@ -119,2 +174,14 @@ * | ||
* const Aerospike = require('aerospike') | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* read : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* write : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* | ||
* } | ||
* } | ||
* | ||
* const batchType = Aerospike.batchType | ||
@@ -157,3 +224,3 @@ * var batchRecords = [ | ||
* ] | ||
* Aerospike.connect(function (error, client) { | ||
* Aerospike.connect(config, function (error, client) { | ||
* if (error) throw error | ||
@@ -160,0 +227,0 @@ * client.batchApply(batchRecords, udf, function (error, results) { |
@@ -83,3 +83,12 @@ // ***************************************************************************** | ||
* | ||
* Aerospike.connect((error, client) => { | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* scan : new Aerospike.ScanPolicy({socketTimeout : 0, totalTimeout : 0}), | ||
* } | ||
* } | ||
* | ||
* Aerospike.connect(config, (error, client) => { | ||
* if (error) throw error | ||
@@ -263,4 +272,13 @@ * | ||
* const Aerospike = require('aerospike') | ||
* | ||
* Aerospike.connect().then(async (client) => { | ||
* | ||
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE! | ||
* var config = { | ||
* hosts: '192.168.33.10:3000', | ||
* // Timeouts disabled, latency dependent on server location. Configure as needed. | ||
* policies: { | ||
* scan : new Aerospike.ScanPolicy({socketTimeout : 0, totalTimeout : 0}) | ||
* } | ||
* } | ||
* | ||
* Aerospike.connect(config).then(async (client) => { | ||
* const scan = client.scan('namespace', 'set') | ||
@@ -267,0 +285,0 @@ * const ops = [Aerospike.operations.incr('count', 1)] |
@@ -174,3 +174,3 @@ // ***************************************************************************** | ||
/** | ||
* Record being (re-)written cannot fit in a storage write block. | ||
* Record being written (or updated) cannot fit in a storage write block. | ||
* @const {number} | ||
@@ -224,3 +224,3 @@ */ | ||
/** | ||
* Sent too-long bin name or exceeded namespace's bin name quota. | ||
* Sent bin name that is too long or exceeded namespace's bin name quota. | ||
* @const {number} | ||
@@ -396,3 +396,3 @@ */ | ||
/** | ||
* Batch max. requests have been exceeded. | ||
* Maximum number of batch requests has been exceeded. | ||
* @const {number} | ||
@@ -451,3 +451,3 @@ */ | ||
/** | ||
* System alrady has maximum allowed indeces. | ||
* System alrady has maximum allowed indices. | ||
* @const {number} | ||
@@ -454,0 +454,0 @@ */ |
@@ -227,19 +227,2 @@ // ***************************************************************************** | ||
/** | ||
* @typedef {object} ApplyPolicy | ||
* @typedef {object} BatchPolicy | ||
* @typedef {object} InfoPolicy | ||
* @typedef {object} OperatePolicy | ||
* @typedef {object} ReadPolicy | ||
* @typedef {object} RemovePolicy | ||
* @typedef {object} ScanPolicy | ||
* @typedef {object} QueryPolicy | ||
* @typedef {object} WritePolicy | ||
* @typedef {object} BitwisePolicy | ||
* @typedef {object} MapPolicy | ||
* @typedef {object} CommandQueuePolicy | ||
* | ||
* @summary Aerospike Policy objects | ||
* | ||
*/ | ||
@@ -258,2 +241,5 @@ /** | ||
* @property {WritePolicy} write - Default write policy | ||
* @property {MapPolicy} map - Default map policy | ||
* @property {ListPolicy} list - Default list policy | ||
* @property {CommandQueuePolicy} commandQueue - Default command queue policy | ||
*/ | ||
@@ -268,15 +254,3 @@ | ||
/** | ||
* @typedef {object} Client | ||
* | ||
* @summary Aerospike Client object | ||
* | ||
*/ | ||
/** | ||
* @typedef {object} Key | ||
* | ||
* @summary Aerospike Key object | ||
* | ||
*/ | ||
@@ -283,0 +257,0 @@ /** |
{ | ||
"name": "aerospike", | ||
"version": "5.0.3", | ||
"version": "5.1.0", | ||
"description": "Aerospike Client Library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -22,5 +22,12 @@ # Aerospike Node.js Client [![travis][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] | ||
// INSERT HOSTNAME AND PORT NUMBER OF AEROPSIKE SERVER NODE HERE! | ||
const config = { | ||
hosts: '192.168.33.10:3000' | ||
hosts: '192.168.33.10:3000', | ||
// Timeouts disabled, latency varies with hardware selection. Configure as needed. | ||
policies: { | ||
read : new Aerospike.WritePolicy({socketTimeout : 0, totalTimeout: 0}), | ||
write : new Aerospike.ReadPolicy({socketTimeout : 0, totalTimeout: 0}) | ||
} | ||
} | ||
const key = new Aerospike.Key('test', 'demo', 'demo') | ||
@@ -41,3 +48,6 @@ | ||
const policy = new Aerospike.WritePolicy({ | ||
exists: Aerospike.policy.exists.CREATE_OR_REPLACE | ||
exists: Aerospike.policy.exists.CREATE_OR_REPLACE, | ||
// Timeouts disabled, latency varies with hardware selection. Configure as needed. | ||
socketTimeout : 0, | ||
totalTimeout: 0 | ||
}) | ||
@@ -44,0 +54,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31012
328
1726960
264
1
4