Socket
Socket
Sign inDemoInstall

aerospike

Package Overview
Dependencies
Maintainers
4
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aerospike - npm Package Compare versions

Comparing version 4.0.2 to 5.0.0

lib/.DS_Store

13

CHANGELOG.md

@@ -5,2 +5,15 @@ # Changelog

## [5.0.0]
* **New Features**
* [CLIENT-1713] - Node.js: Support batch apply command.
* [CLIENT-1712] - Node.js: Support batch remove operations.
* [CLIENT-1711] - Node.js: Support batch write operations.
* [CLIENT-1715] - Node.js: Support query partition.
* [CLIENT-1714] - Node.js: Support scan partition.
* **Updates**
* BREAKING: Remove deprecated PredicateExpression filtering which has been replaced by new Filter Expressions
* npm registry includes images for nodejs v17.8.0 and v18.0.0
## [4.0.1]

@@ -7,0 +20,0 @@

2

examples/batch.js

@@ -31,3 +31,3 @@ #!/usr/bin/env node

} else {
request.read_all_bins = true
request.readAllBins = true
}

@@ -34,0 +34,0 @@ return request

@@ -46,11 +46,2 @@ // *****************************************************************************

/**
* The {@link module:aerospike/predexp|predexp} module provides functions to
* create predicate expressions for use in query operations via the {@link
* Client#query} command.
*
* @summary {@link module:aerospike/predexp|aerospike/predexp} module
*/
exports.predexp = require('./predexp')
/**
* The {@link module:aerospike/exp|exp} module provides functions to

@@ -70,3 +61,2 @@ * create expressions for use in key operations via the {@link

*
* @see {@link module:aerospike/predexp.stringRegex} for usage.
*/

@@ -155,3 +145,3 @@ exports.regex = {

/**
* The {@link module:aerospike/expoperations|ExpOperations} 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">&uArr;Aerospike Expressions</a>

@@ -161,3 +151,3 @@ * for the {@link Client#operate} command.

*
* @summary {@link module:aerospike/operations|aerospike/exp_operations} module
* @summary {@link module:aerospike/exp_operations|aerospike/exp_operations} module
*/

@@ -176,8 +166,5 @@ exp.operations = require('./exp_operations')

// short-cuts to the policy classes defined under the policy module
exports.BasePolicy = policy.BasePolicy
exports.ApplyPolicy = policy.ApplyPolicy
exports.BatchPolicy = policy.BatchPolicy
exports.CommandQueuePolicy = policy.CommandQueuePolicy
exports.InfoPolicy = policy.InfoPolicy
exports.ListPolicy = policy.ListPolicy
exports.MapPolicy = policy.MapPolicy
exports.OperatePolicy = policy.OperatePolicy

@@ -189,2 +176,10 @@ exports.QueryPolicy = policy.QueryPolicy

exports.WritePolicy = policy.WritePolicy
exports.BatchApplyPolicy = policy.BatchApplyPolicy
exports.BatchReadPolicy = policy.BatchReadPolicy
exports.BatchRemovePolicy = policy.BatchRemovePolicy
exports.BatchWritePolicy = policy.BatchWritePolicy
exports.CommandQueuePolicy = policy.CommandQueuePolicy
exports.InfoPolicy = policy.InfoPolicy
exports.ListPolicy = policy.ListPolicy
exports.MapPolicy = policy.MapPolicy

@@ -191,0 +186,0 @@ /**

@@ -32,2 +32,5 @@ // *****************************************************************************

exports.BatchRead = class BatchReadCommand extends BatchCommand('batchRead') { }
exports.BatchWrite = class BatchWriteCommand extends BatchCommand('batchWrite') { }
exports.BatchApply = class BatchApplyCommand extends BatchCommand('batchApply') { }
exports.BatchRemove = class BatchRemoveCommand extends BatchCommand('batchRemove') { }
exports.BatchSelect = class BatchSelectCommand extends BatchCommand('batchSelect') { }

@@ -34,0 +37,0 @@ exports.Connect = class ConnectCommand extends ConnectCommandBase('connect') { }

@@ -27,3 +27,3 @@ // *****************************************************************************

function hasFilter (queryOrScan) {
return notEmpty(queryOrScan.filters) || notEmpty(queryOrScan.predexp)
return notEmpty(queryOrScan.filters)
}

@@ -30,0 +30,0 @@

@@ -63,3 +63,3 @@ // *****************************************************************************

/**
* @class module:aerospike/expoperations~ExpOperation
* @class module:aerospike/exp_operations~ExpOperation
*

@@ -66,0 +66,0 @@ * @classdesc class for all expression operations executed with the {@link

@@ -23,2 +23,4 @@ // *****************************************************************************

* retry handling.
* Applies to {@link ApplyPolicy}, {@link BatchPolicy}, {@link OperatePolicy},
* {@link QueryPolicy}, {@link ReadPolicy}, {@link RemovePolicy}, {@link ScanPolicy} and {@link WritePolicy}.
*

@@ -91,25 +93,7 @@ * @since v3.0.0

/**
* Use zlib compression on write or batch read commands when the command
* buffer size is greater than 128 bytes. In addition, tell the server to
* compress it's response on read commands. The server response compression
* threshold is also 128 bytes.
* Optional expression filter. If filter exp exists and evaluates to false, the
* transaction is ignored. This can be used to eliminate a client/server roundtrip
* in some cases.
*
* This option will increase cpu and memory usage (for extra compressed
* buffers), but decrease the size of data sent over the network.
*
* Requires Enterprise Server version >= 4.8.
*
* @type boolean
* @default: false
* @since v3.14.0
*/
this.compress = props.compress
/**
* Optional predicate expression filter list in postfix notation. If the
* predicate expression exists and evaluates to false on the server, the
* transaction is ignored. This can be used to eliminate a client/server
* roundtrip in some cases.
*
* Predicate expression filters can only be applied to the following commands:
* expression filters can only be applied to the following commands:
* * {@link Client#apply}

@@ -126,30 +110,21 @@ * * {@link Client#batchExists}

* * {@link Client#select}
*
* @type Predicate[]
* @since v3.14.0
*/
this.predexp = props.predexp
this.filterExpression = props.filterExpression
/**
* Optional expression filter. If filter exp exists and evaluates to false, the
* transaction is ignored. This can be used to eliminate a client/server roundtrip
* in some cases.
* Use zlib compression on write or batch read commands when the command
* buffer size is greater than 128 bytes. In addition, tell the server to
* compress it's response on read commands. The server response compression
* threshold is also 128 bytes.
*
* predexp and filter_exp are mutually exclusive. If both are defined, predexp
* will be ignored.
* This option will increase cpu and memory usage (for extra compressed
* buffers), but decrease the size of data sent over the network.
*
* expression filters can only be applied to the following commands:
* * {@link Client#apply}
* * {@link Client#batchExists}
* * {@link Client#batchGet}
* * {@link Client#batchRead}
* * {@link Client#batchSelect}
* * {@link Client#exists}
* * {@link Client#get}
* * {@link Client#operate}
* * {@link Client#put}
* * {@link Client#remove}
* * {@link Client#select}
* Requires Enterprise Server version >= 4.8.
*
* @type boolean
* @default: false
* @since v3.14.0
*/
this.filterExpression = props.filterExpression
this.compress = props.compress
}

@@ -156,0 +131,0 @@ }

@@ -38,11 +38,40 @@ // *****************************************************************************

/**
* Should CDT data types (Lists / Maps) be deserialized to JS data types
* (Arrays / Objects) or returned as raw bytes (Buffer).
* Algorithm used to determine target node.
* @type number
* @default Aerospike.policy.replica.MASTER
* @see {@link module:aerospike/policy.replica} for supported policy values.
*/
this.replica = props.replica
/**
* Read policy for AP (availability) namespaces.
*
* @type number
* @default Aerospike.policy.readModeAP.ONE
* @see {@link module:aerospike/policy.readModeAP} for supported policy values.
*/
this.readModeAP = props.readModeAP
/**
* Read policy for SC (strong consistency) namespaces.
*
* @type number
* @default Aerospike.policy.readModeSC.SESSION
* @see {@link module:aerospike/policy.readModeSC} for supported policy values.
*/
this.readModeSC = props.readModeSC
/**
* Determine if batch commands to each server are run in parallel threads.
*
* Values:
* false: Issue batch commands sequentially. This mode has a performance advantage for small
* to medium sized batch sizes because commands can be issued in the main transaction thread.
* This is the default.
* true: Issue batch commands in parallel threads. This mode has a performance
* advantage for large batch sizes because each node can process the command immediately.
* The downside is extra threads will need to be created (or taken from
* a thread pool).
* @type boolean
* @default <code>true</code>
* @since v3.7.0
* @default <code>false</code>
*/
this.deserialize = props.deserialize
this.concurrent = props.concurrent
/**

@@ -57,2 +86,36 @@ * Allow batch to be processed immediately in the server's receiving thread

this.allowInline = props.allowInline
/**
* Allow batch to be processed immediately in the server's receiving thread for SSD
* namespaces. If false, the batch will always be processed in separate service threads.
* Server versions &lt; 6.0 ignore this field.
*
* Inline processing can introduce the possibility of unfairness because the server
* can process the entire batch before moving onto the next command.
*
* @type boolean
* @default <code>false</code>
*/
this.allowInlineSSD = props.allowInlineSSD
/**
* Should all batch keys be attempted regardless of errors. This field is used on both
* the client and server. The client handles node specific errors and the server handles
* key specific errors.
*
* If true, every batch key is attempted regardless of previous key specific errors.
* Node specific errors such as timeouts stop keys to that node, but keys directed at
* other nodes will continue to be processed.
*
* If false, the server will stop the batch to its node on most key specific errors.
* The exceptions are AEROSPIKE_ERR_RECORD_NOT_FOUND and AEROSPIKE_FILTERED_OUT
* which never stop the batch. The client will stop the entire batch on node specific
* errors for sync commands that are run in sequence (concurrent == false). The client
* will not stop the entire batch for async commands or sync commands run in parallel.
*
* Server versions &lt; 6.0 do not support this field and treat this value as false
* for key specific errors.
*
* @type boolean
* @default <code>true</code>
*/
this.respondAllKeys = props.respondAllKeys

@@ -70,18 +133,10 @@ /**

/**
* Read policy for AP (availability) namespaces.
* Should CDT data types (Lists / Maps) be deserialized to JS data types
* (Arrays / Objects) or returned as raw bytes (Buffer).
*
* @type number
* @default Aerospike.policy.readModeAP.ONE
* @see {@link module:aerospike/policy.readModeAP} for supported policy values.
* @type boolean
* @default <code>true</code>
* @since v3.7.0
*/
this.readModeAP = props.readModeAP
/**
* Read policy for SC (strong consistency) namespaces.
*
* @type number
* @default Aerospike.policy.readModeSC.SESSION
* @see {@link module:aerospike/policy.readModeSC} for supported policy values.
*/
this.readModeSC = props.readModeSC
this.deserialize = props.deserialize
}

@@ -88,0 +143,0 @@ }

@@ -25,3 +25,3 @@ // *****************************************************************************

* Not all client commands use the command queue. Only single-key commands
* (e.g. Put, Get, etc.), the BatchRead command, and {@link Query#foreach},
* (e.g. Put, Get, etc.), the BatchRead, BatchWrite commands, and {@link Query#foreach},
* {@link Scan#foreach} commands use the command queue (if enabled).

@@ -28,0 +28,0 @@ *

@@ -38,10 +38,2 @@ // *****************************************************************************

/**
* Do not use predexp property inherited from BasePolicy on queries. Use
* Query#where instead.
*
* @member QueryPolicy#predexp
* @ignore
*/
/**
* Should CDT data types (Lists / Maps) be deserialized to JS data types

@@ -48,0 +40,0 @@ * (Arrays / Objects) or returned as raw bytes (Buffer).

@@ -38,10 +38,2 @@ // *****************************************************************************

/**
* Do not use predexp property inherited from BasePolicy on scans. Use a
* Query instead.
*
* @member ScanPolicy#predexp
* @ignore
*/
/**
* Specifies whether a {@link

@@ -48,0 +40,0 @@ * http://www.aerospike.com/docs/guide/durable_deletes.html|tombstone}

@@ -21,8 +21,4 @@ // *****************************************************************************

const BasePolicy = require('./policies/base_policy')
const ApplyPolicy = require('./policies/apply_policy')
const BatchPolicy = require('./policies/batch_policy')
const CommandQueuePolicy = require('./policies/command_queue_policy')
const InfoPolicy = require('./policies/info_policy')
const ListPolicy = require('./policies/list_policy')
const MapPolicy = require('./policies/map_policy')
const OperatePolicy = require('./policies/operate_policy')

@@ -34,3 +30,13 @@ const QueryPolicy = require('./policies/query_policy')

const WritePolicy = require('./policies/write_policy')
const BatchPolicy = require('./policies/batch_policy')
const BatchApplyPolicy = require('./policies/batch_apply_policy')
const BatchReadPolicy = require('./policies/batch_read_policy')
const BatchRemovePolicy = require('./policies/batch_remove_policy')
const BatchWritePolicy = require('./policies/batch_write_policy')
const CommandQueuePolicy = require('./policies/command_queue_policy')
const HLLPolicy = require('./policies/hll_policy')
const InfoPolicy = require('./policies/info_policy')
const ListPolicy = require('./policies/list_policy')
const MapPolicy = require('./policies/map_policy')
/**

@@ -50,5 +56,18 @@ * @module aerospike/policy

* * {@link ApplyPolicy} - Applies to {@link Client#apply}.
* * {@link OperatePolicy} - Applies to {@link Client#operate} as well as {@link Client#append}, {@link Client#prepend} and {@link Client#add}.
* * {@link QueryPolicy} - Applies to {@link Query#apply}, {@link Query#background} and {@link Query#foreach}.
* * {@link ReadPolicy} - Applies to {@link Client#exists}, {@link Client#get} and {@link Client#select}.
* * {@link RemovePolicy} - Applies to {@link Client#remove}.
* * {@link ScanPolicy} - Applies to {@link Scan#background} and {@link Scan#foreach}.
* * {@link WritePolicy} - Applies to {@link Client#put}.
* * {@link BatchPolicy} - Applies to {@link Client#batchRead} as well as the
* deprecated {@link Client#batchExists}, {@link Client#batchGet}, and {@link
* Client#batchSelect} operations.
* * {@link BatchApplyPolicy} - Applies to {@link Client#batchApply}.
* * {@link BatchReadPolicy} - Applies to {@link Client#batchRead}.
* * {@link BatchRemovePolicy} - Applies to {@link Client#batchRemove}.
* * {@link BatchWritePolicy} - Applies to {@link Client#batchWrite}.
* * {@link CommandQueuePolicy} - Applies to global command queue {@link module:aerospike.setupGlobalCommandQueue
* Aerospike.setupGlobalCommandQueue}
* * {@link HLLPolicy} - Applies to {@link module:aerospike/hll|HLL} operations
* * {@link InfoPolicy} - Applies to {@link Client#info}, {@link

@@ -60,12 +79,6 @@ * Client#infoAny}, {@link Client#infoAll} as well as {@link

* * {@link MapPolicy} - Applies to Map operations defined in {@link module:aerospike/maps}.
* * {@link OperatePolicy} - Applies to {@link Client#operate} as well as {@link Client#append}, {@link Client#prepend} and {@link Client#add}.
* * {@link QueryPolicy} - Applies to {@link Query#apply}, {@link Query#background} and {@link Query#foreach}.
* * {@link ReadPolicy} - Applies to {@link Client#exists}, {@link Client#get} and {@link Client#select}.
* * {@link RemovePolicy} - Applies to {@link Client#remove}.
* * {@link ScanPolicy} - Applies to {@link Scan#background} and {@link Scan#foreach}.
* * {@link WritePolicy} - Applies to {@link Client#put}.
*
* All client policy classes are derives from the common {@link BasePolicy}
* class which defines common policy values that apply to all database
* operations (except `InfoPolicy`, `MapPolicy` and `ListPolicy`).
* Base policy {@link BasePolicy} class which defines common policy
* values that apply to all database operations
* (except `InfoPolicy`, `MapPolicy` and `ListPolicy`).
*

@@ -283,2 +296,9 @@ * This module also defines global values for the following policy settings:

/**
* A policy affecting the behavior of most operations.
*
* @summary {@link BasePolicy} class
*/
exports.BasePolicy = BasePolicy
/**
* A policy affecting the behavior of apply operations.

@@ -291,83 +311,118 @@ *

/**
* A policy affecting the behavior of batch operations.
* A policy affecting the behavior of operate operations.
*
* @summary {@link BatchPolicy} class
* @summary {@link OperatePolicy} class
*/
exports.BatchPolicy = BatchPolicy
exports.OperatePolicy = OperatePolicy
/**
* A policy affecting the use of the global command queue.
* A policy affecting the behavior of query operations.
*
* @summary {@link QueryPolicy} class
*/
exports.QueryPolicy = QueryPolicy
/**
* A policy affecting the behavior of read operations.
*
* @summary {@link ReadPolicy} class
*/
exports.ReadPolicy = ReadPolicy
/**
* A policy affecting the behavior of remove operations.
*
* @summary {@link RemovePolicy} class
*/
exports.RemovePolicy = RemovePolicy
/**
* A policy affecting the behavior of scan operations.
*
* @summary {@link ScanPolicy} class
*/
exports.ScanPolicy = ScanPolicy
/**
* A policy affecting the behavior of write operations.
*
* @summary {@link WritePolicy} class
*/
exports.WritePolicy = WritePolicy
/**
* A policy affecting the behavior of batch operations.
*
* @summary {@link CommandQueuePolicy} class
* @summary {@link BatchPolicy} class
*/
exports.CommandQueuePolicy = CommandQueuePolicy
exports.BatchPolicy = BatchPolicy
/**
* A policy affecting the behavior of info operations.
* A policy affecting the behavior of batchApply operations.
*
* @summary {@link InfoPolicy} class
* @summary {@link BatchApplyPolicy} class
*/
exports.InfoPolicy = InfoPolicy
exports.BatchApplyPolicy = BatchApplyPolicy
/**
* A policy affecting the behavior of list operations.
* A policy affecting the behavior of batchRead operations.
*
* @summary {@link ListPolicy} class
* @summary {@link BatchReadPolicy} class
*/
exports.ListPolicy = ListPolicy
exports.BatchReadPolicy = BatchReadPolicy
/**
* A policy affecting the behavior of map operations.
* A policy affecting the behavior of batchRemove operations.
*
* @summary {@link MapPolicy} class
* @summary {@link BatchRemovePolicy} class
*/
exports.MapPolicy = MapPolicy
exports.BatchRemovePolicy = BatchRemovePolicy
/**
* A policy affecting the behavior of operate operations.
* A policy affecting the behavior of batchWrite operations.
*
* @summary {@link OperatePolicy} class
* @summary {@link BatchWritePolicy} class
*/
exports.OperatePolicy = OperatePolicy
exports.BatchWritePolicy = BatchWritePolicy
/**
* A policy affecting the behavior of query operations.
* A policy affecting the use of the global command queue.
*
* @summary {@link QueryPolicy} class
* @summary {@link CommandQueuePolicy} class
*/
exports.QueryPolicy = QueryPolicy
exports.CommandQueuePolicy = CommandQueuePolicy
/**
* A policy affecting the behavior of read operations.
* A policy affecting the behavior of HLL operations.
*
* @summary {@link ReadPolicy} class
* @summary {@link HLLPolicy} class
*/
exports.ReadPolicy = ReadPolicy
exports.HLLPolicy = HLLPolicy
/**
* A policy affecting the behavior of remove operations.
* A policy affecting the behavior of info operations.
*
* @summary {@link RemovePolicy} class
* @summary {@link InfoPolicy} class
*/
exports.RemovePolicy = RemovePolicy
exports.InfoPolicy = InfoPolicy
/**
* A policy affecting the behavior of scan operations.
* A policy affecting the behavior of list operations.
*
* @summary {@link ScanPolicy} class
* @summary {@link ListPolicy} class
*/
exports.ScanPolicy = ScanPolicy
exports.ListPolicy = ListPolicy
/**
* A policy affecting the behavior of write operations.
* A policy affecting the behavior of map operations.
*
* @summary {@link WritePolicy} class
* @summary {@link MapPolicy} class
*/
exports.WritePolicy = WritePolicy
exports.MapPolicy = MapPolicy
function policyClass (type) {
switch (type) {
case 'base': return BasePolicy
case 'apply': return ApplyPolicy
case 'batch': return BatchPolicy
case 'info': return InfoPolicy
case 'operate': return OperatePolicy

@@ -379,2 +434,11 @@ case 'query': return QueryPolicy

case 'write': return WritePolicy
case 'batchRead': return BatchReadPolicy
case 'batchRemove': return BatchRemovePolicy
case 'batchWrite': return BatchWritePolicy
case 'batchApply': return BatchApplyPolicy
case 'commandQueue': return CommandQueuePolicy
case 'hll': return HLLPolicy
case 'info': return InfoPolicy
case 'list': return ListPolicy
case 'map': return MapPolicy
default:

@@ -381,0 +445,0 @@ throw new TypeError(`Unknown policy type: "${type}"`)

@@ -22,3 +22,2 @@ // *****************************************************************************

const filter = require('./filter')
const predexp = require('./predexp')

@@ -66,21 +65,6 @@ const assert = require('assert')

* Currently, only a single SI filter predicate is supported for
* each query. To do more advanced filtering, a predicate expression can be
* applied to the query (see below). Alternatively, User-Defined Functions
* each query. To do more advanced filtering, a expressions can be
* applied to the query using policy (see below). Alternatively, User-Defined Functions
* (UDFs) can be used to further process the query results on the server.
*
* #### Predicate Filter Expressions
*
* Using Aerospike Predicate Filtering (deprecated in server 5.2;
* removed in server 6.0), you can:
*
* - Filter out records based on record meta data, such as last-update-time or
* storage-size.
* - Filter out records based on bin data, such as integer greater/less or
* regexp on string bins.
*
* Predicate filter expressions can be combined with a SI filter.
*
* See {@link module:aerospike/predexp} for a list of deprecated predicate
* expressions.
*
* For more information about Predicate Filtering, please refer to the <a

@@ -177,5 +161,6 @@ * href="https://www.aerospike.com/docs/guide/predicate.html">&uArr;Predicate

* var query = client.query('test', 'demo')
* const queryPolicy = { filterExpression: exp.keyExist('uniqueExpKey') }
* query.select('id', 'tags')
* query.where(Aerospike.filter.contains('tags', 'green', Aerospike.indexType.LIST))
* var stream = query.foreach()
* var stream = query.foreach(queryPolicy)
* stream.on('error', (error) => {

@@ -233,13 +218,2 @@ * console.error(error)

/**
* Sequence (array) of predicate expressions to apply to the query.
*
* @member {Predicate[]} Query#predexp
*
* @see Use {@link Query#where} to add a predicate expression to the query.
* @see Use {@link module:aerospike/predexp} to create the sequence of
* predicate expressions
*/
this.predexp = options.predexp
/**
* List of bin names to be selected by the query. If a query specifies bins to

@@ -270,2 +244,10 @@ * be selected, then only those bins will be returned. If no bins are

this.udf = options.udf
/**
* If set to <code>true</code>, the scan will return only those belongs to partitions.
*
* @member {boolean} Query#pfEnabled
* @private
*/
this.pfEnabled = false
}

@@ -295,15 +277,9 @@

*
* @summary Applies a SI filter and/or a predicate expression to
* the query.
* @summary Applies a SI to the query.
*
* @description Use a SI filter, a predicate expression, or both,
* to limit the results returned by the query. This method takes either a
* SI filter created using the {@link
* module:aerospike/filter|filter module}, or a sequence of predicate
* expressions created using the {@link module:aerospike/predexp|predexp
* module} as argument. It can also be called multiple times to add both kinds
* of filters to the same query. (Max. one of each kind.)
* @description Use a SI to limit the results returned by the query.
* This method takes SI created using the {@link
* module:aerospike/filter|filter module} as argument.
*
* @param {module:aerospike/filter~SindexFilterPredicate |
* module:aerospike/predexp~PredicateExpression[]} predicate - The filter to
* @param {module:aerospike/filter~SindexFilterPredicate} predicate - The filter to
* apply to the function.

@@ -329,11 +305,4 @@ *

* @see {@link module:aerospike/filter} to create SI filters.
* @see {@link module:aerospike/predexp} to create predicate expression filters.
*
* @example <caption>Applying a predicate expression in addition to a secondary
* index filter to find only record where the 'tags' list bin contains the
* value 'blue' but also contains at least one other value that is not
* 'blue':</caption>
*
* const Aerospike = require('aerospike')
* const predexp = Aerospike.predexp
*

@@ -346,12 +315,2 @@ * Aerospike.connect().then(client => {

*
* let tagsPredexp = [
* predexp.stringVar('tag'),
* predexp.stringValue('blue'),
* predexp.stringEqual(),
* predexp.listBin('tags'),
* predexp.listIterateAnd('tag'),
* predexp.not()
* ]
* query.where(tagsPredexp)
*
* let stream = query.foreach()

@@ -364,6 +323,6 @@ * stream.on('data', record => { console.info(record.bins.tags) })

Query.prototype.where = function (predicate) {
if (Array.isArray(predicate) && predicate[0] instanceof predexp.PredicateExpression) {
this.setPredexpFilter(predicate)
} else if (predicate instanceof filter.SindexFilterPredicate) {
if (predicate instanceof filter.SindexFilterPredicate) {
this.setSindexFilter(predicate)
} else {
throw new TypeError('predicate should be a SindexFilterPredicate')
}

@@ -377,6 +336,2 @@ }

Query.prototype.setPredexpFilter = function (predexpFilter) {
this.predexp = predexpFilter
}
/**

@@ -400,2 +355,22 @@ * @function Query#setUdf

/**
* @function Query#partitions
*
* @summary Specify the begin and count of the partitions
* to be scanned by the Query foreach op.
*
* @description If a Query specifies partitions begin and count,
* then only those partitons will be scanned and returned.
* If no partitions are specified,
* then all partitions will be scanned and returned.
*
* @param {int} begin - Start partition number to scan.
* @param {int} count - Number of partitions from the start to scan.
* @param {string} digest - Start from this digest if it is specified.
*/
Query.prototype.partitions = function (begin, count, digest) {
this.partFilter = { begin: begin, count: count, digest: digest }
this.pfEnabled = true
}
/**
* @function Query#foreach

@@ -402,0 +377,0 @@ *

@@ -77,4 +77,5 @@ // *****************************************************************************

/** @private */
constructor (key, bins, metadata) {
constructor (key, bins, metadata, type, props) {
metadata = metadata || {}
props = props || {}

@@ -109,2 +110,40 @@ /**

this.gen = metadata.gen
/**
* Batch record type. Values: BATCH_READ, BATCH_WRITE, BATCH_APPLY or BATCH_REMOVE
*
* @member {number} Record#type
*/
this.type = type
/**
* Optional batch read/write/apply/remove policy
*
* @member {object} Record#policy
*/
this.policy = props.policy
/**
* batch read option
* If true, ignore bin_names and read all bins.
* If false and bin_names are set, read specified bin_names.
* If false and bin_names are not set, read record header (generation, expiration) only.
* @member {bool} Record#readAllBins
*/
this.readAllBins = props.readAllBins
/**
* Read or write operations for this key.
* For BATCH_READ, ops are mutually exclusive with bin_names.
*
* @member {object} Record#ops
*/
this.ops = props.ops
/**
* lua module, function and optional arg list udf object
*
* @member {object} Record#udf
*/
this.udf = props.udf
}

@@ -111,0 +150,0 @@ }

@@ -25,2 +25,5 @@ // *****************************************************************************

* @class Scan
*
* @deprecated since server 6.0
*
* @classdesc The scan object created by calling {@link Client#scan} is used

@@ -31,2 +34,3 @@ * for executing record scans on the specified namespace and set (optional).

*
* Scan is depricated in server 6.0. Use Query methods implemented by {@link Client#query}
* For more information, please refer to the section on

@@ -141,2 +145,10 @@ * <a href="http://www.aerospike.com/docs/guide/scan.html">&uArr;Scans</a>

this.concurrent = options.concurrent
/**
* If set to <code>true</code>, the scan will return only those belongs to partitions.
*
* @member {boolean} Scan#pfEnabled
* @private
*/
this.pfEnabled = false
}

@@ -164,2 +176,22 @@

/**
* @function Scan#partitions
*
* @summary Specify the begin and count of the partitions
* to be scanned by the scan foreach op.
*
* @description If a scan specifies partitions begin and count,
* then only those partitons will be scanned and returned.
* If no partitions are specified,
* then all partitions will be scanned and returned.
*
* @param {int} begin - Start partition number to scan.
* @param {int} count - Number of partitions from the start to scan.
* @param {string} digest - Start from this digest if it is specified.
*/
Scan.prototype.partitions = function (begin, count, digest) {
this.partFilter = { begin: begin, count: count, digest: digest }
this.pfEnabled = true
}
/**
* @function Scan#background

@@ -166,0 +198,0 @@ *

@@ -262,3 +262,3 @@ // *****************************************************************************

/**
* The transaction was not performed because the predexp was false.
* The transaction was not performed because the exp was false.
* @const {number}

@@ -265,0 +265,0 @@ */

{
"name": "aerospike",
"version": "4.0.2",
"version": "5.0.0",
"description": "Aerospike Client Library",

@@ -5,0 +5,0 @@ "keywords": [

@@ -113,5 +113,5 @@ // *****************************************************************************

const batchRecords = [
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/1'), read_all_bins: true },
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/3'), read_all_bins: true },
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/5'), read_all_bins: true }
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/1'), readAllBins: true },
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/3'), readAllBins: true },
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/5'), readAllBins: true }
]

@@ -134,5 +134,5 @@

const batchRecords = [
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/1'), read_all_bins: true },
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/3'), read_all_bins: false, bins: ['i'] },
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/5'), read_all_bins: false }
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/1'), readAllBins: true },
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/3'), readAllBins: false, bins: ['i'] },
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/5'), readAllBins: false }
]

@@ -172,3 +172,3 @@

key: new Key(helper.namespace, helper.set, 'test/batch_read/1'),
read_all_bins: true
readAllBins: true
}]

@@ -190,3 +190,3 @@

const batchRecords = [
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/1'), read_all_bins: true }
{ key: new Key(helper.namespace, helper.set, 'test/batch_read/1'), readAllBins: true }
]

@@ -193,0 +193,0 @@

@@ -249,19 +249,2 @@ // *****************************************************************************

})
context('minConnsPerNode', function () {
it('connects to the server and establishes the minimum number of connections', async function () {
const test = async function (Aerospike, config) {
Object.assign(config, { minConnsPerNode: 5, log: { level: 0 } })
const client = await Aerospike.connect(config)
// give client enough time to establish the requested min. connections
await new Promise((resolve) => setTimeout(resolve, 10))
const stats = client.stats()
client.close()
return stats
}
const stats = await helper.runInNewProcess(test, helper.config)
expect(stats.nodes[0].asyncConnections.inPool).to.equal(5)
})
})
})

@@ -227,2 +227,30 @@ // *****************************************************************************

context('with partitions settings', function () {
helper.skipUnlessVersion('>= 6.0.0', this)
it('returns the key if it was stored on the given partitions', function (done) {
const uniqueKey = 'test/query/record_with_stored_key'
const key = new Aerospike.Key(helper.namespace, testSet, uniqueKey)
const record = { name: uniqueKey }
const meta = { ttl: 300 }
const policy = new Aerospike.WritePolicy({
key: Aerospike.policy.key.SEND
})
client.put(key, record, meta, policy, function (err) {
if (err) throw err
const query = client.query(helper.namespace, testSet)
query.where(Aerospike.filter.equal('name', uniqueKey))
query.partitions(0, 4096)
const stream = query.foreach()
let count = 0
stream.on('data', record => {
expect(++count).to.equal(1)
expect(record.key).to.be.instanceof(Key)
expect(record.key.key).to.equal(uniqueKey)
})
stream.on('end', done)
})
})
})
it('returns the key matching the expression', function (done) {

@@ -229,0 +257,0 @@ const uniqueExpKey = 'test/query/record_with_stored_key'

@@ -115,2 +115,14 @@ // *****************************************************************************

it('retrieves all records from the given partitions', function (done) {
const scan = client.scan(helper.namespace, testSet)
let recordsReceived = 0
scan.partitions(0, 4096)
const stream = scan.foreach()
stream.on('data', () => recordsReceived++)
stream.on('end', () => {
expect(recordsReceived).to.equal(numberOfRecords)
done()
})
})
it('returns the key if it is stored on the server', function (done) {

@@ -149,4 +161,4 @@ this.timeout(10000) // 10 second timeout

const policy = new Aerospike.ScanPolicy({
totalTimeout: 1000,
socketTimeout: 1000,
totalTimeout: 10000,
socketTimeout: 10000,
durableDelete: true,

@@ -153,0 +165,0 @@ recordsPerSecond: 50,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc