Socket
Socket
Sign inDemoInstall

aerospike

Package Overview
Dependencies
Maintainers
3
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.1.0

benchmarks/package-lock.json

38

benchmarks/package.json
{
"name" : "aerospike-benchmark",
"version" : "v0.1.0",
"description" : "Aerospike Client Benchmark",
"tags" : [ "aerospike", "database", "nosql" ],
"engines" : {
"node" : ">=0.10"
"name": "aerospike-benchmark",
"version": "v0.1.0",
"description": "Aerospike Client Benchmark",
"keywords": [
"aerospike",
"database",
"nosql",
"benchmark"
],
"engines": {
"node": ">=4"
},
"os" : [ "linux" ],
"cpu" : [ "x64" ],
"repository" : {
"type" : "git",
"url" : "https://github.com/aerospike/aerospike-client-nodejs"
"os": [
"linux",
"darwin"
],
"cpu": [
"x64"
],
"repository": {
"type": "git",
"url": "https://github.com/aerospike/aerospike-client-nodejs"
},
"dependencies": {
"aerospike": ">0",
"aerospike": "^3.0.2",
"cli-table": "0.2.0",
"colors": "0.6.2",
"yargs":"1.2.1",
"winston": "0.7.2"
"winston": "0.7.2",
"yargs": "1.2.1"
},
"main": "main.js"
}

@@ -20,4 +20,3 @@ // *****************************************************************************

const OPERATION_STATUS = 0
const OPERATION_TIME_START = 1
const OPERATION_TIME_END = 2
const OPERATION_TIME_DIFF = 1

@@ -73,7 +72,4 @@ // histograms

function duration (start, end) {
var s = (end[0] - start[0]) * 1000000000
var ns = s + end[1] - start[1]
var ms = ns / 1000000
return ms
function duration (time) {
return (time[0] * 1000) + (time[1] / 1000000)
}

@@ -103,23 +99,24 @@

function timeHistogram (operations) {
operations.map(function (op) {
return duration(op[OPERATION_TIME_START], op[OPERATION_TIME_END])
}).forEach(function (dur) {
var d = Math.floor(dur)
if (d > 32) {
timeHist['> 32']++
}
if (d > 16) {
timeHist['> 16']++
} else if (d > 8) {
timeHist['> 8']++
} else if (d > 4) {
timeHist['> 4']++
} else if (d > 2) {
timeHist['> 2']++
} else if (d > 1) {
timeHist['> 1']++
} else {
timeHist['<= 1']++
}
})
operations
.map(op => {
let elapsed = op[OPERATION_TIME_DIFF]
return Math.floor(duration(elapsed))
})
.forEach(d => {
if (d > 32) {
timeHist['> 32']++
} else if (d > 16) {
timeHist['> 16']++
} else if (d > 8) {
timeHist['> 8']++
} else if (d > 4) {
timeHist['> 4']++
} else if (d > 2) {
timeHist['> 2']++
} else if (d > 1) {
timeHist['> 1']++
} else {
timeHist['<= 1']++
}
})
}

@@ -263,4 +260,4 @@

function stop () {
var endTime = process.hrtime()
totalDuration = duration(startTime, endTime)
let elapsed = process.hrtime(startTime)
totalDuration = duration(elapsed)
}

@@ -267,0 +264,0 @@

@@ -74,5 +74,9 @@ // *****************************************************************************

var config = {
let defaultPolicy = {
totalTimeout: argv.timeout
}
let config = {
policies: {
timeout: argv.timeout
read: defaultPolicy,
write: defaultPolicy
},

@@ -161,7 +165,6 @@ sharedMemory: {

function get (key, done) {
var timeStart = process.hrtime()
client.get(key, function (_error, _record, _metadata, _key) {
var timeEnd = process.hrtime()
var status = (_error && _error.code) || 0
done(status, timeStart, timeEnd, READ)
let timeStart = process.hrtime()
client.get(key, function (error) {
let status = (error && error.code) || 0
done(status, process.hrtime(timeStart), READ)
})

@@ -171,6 +174,6 @@ }

function getPromise (key, done) {
var timeStart = process.hrtime()
let timeStart = process.hrtime()
client.get(key)
.then(() => done(0, timeStart, process.hrtime(), READ))
.catch((err) => done(err.code, timeStart, process.hrtime(), READ))
.then(() => done(0, process.hrtime(timeStart), READ))
.catch((err) => done(err.code, process.hrtime(timeStart), READ))
}

@@ -184,7 +187,6 @@

function put (options, done) {
var timeStart = process.hrtime()
client.put(options.key, options.record, metadata, function (_error, _record, _metadata, _key) {
var timeEnd = process.hrtime()
var status = (_error && _error.code) || 0
done(status, timeStart, timeEnd, WRITE)
let timeStart = process.hrtime()
client.put(options.key, options.record, metadata, function (error) {
let status = (error && error.code) || 0
done(status, process.hrtime(timeStart), WRITE)
})

@@ -194,6 +196,6 @@ }

function putPromise (options, done) {
var timeStart = process.hrtime()
let timeStart = process.hrtime()
client.put(options.key, options.record, metadata)
.then(() => done(0, timeStart, process.hrtime(), WRITE))
.catch((err) => done(err.code, timeStart, process.hrtime(), WRITE))
.then(() => done(0, process.hrtime(timeStart), WRITE))
.catch((err) => done(err.code, process.hrtime(timeStart), WRITE))
}

@@ -219,4 +221,4 @@

function done (opStatus, opTimeStart, opTimeEnd, opType) {
operations[completed] = [opStatus, opTimeStart, opTimeEnd]
function done (opStatus, elapsed, opType) {
operations[completed] = [opStatus, elapsed]
intervalData[opType][TPS]++

@@ -223,0 +225,0 @@ if (opStatus === status.ERR_TIMEOUT) {

@@ -0,1 +1,15 @@

v3.1.0 / 2017-12-18
===================
* **New Features**
* Logging improvements: C client logs enabled by default; log level can be controlled through new, global log settings. [PR #231](https://github.com/aerospike/aerospike-client-nodejs/pull/231)
* Support "exists" policy for operate command. [PR #233](https://github.com/aerospike/aerospike-client-nodejs/pull/233)
* Support "linearize read" policy for Strong Consistency mode. (Requires Aerospike server v4.0.)
* **Updates**
* Add support for Node.js v9.x
* Update C client library to [v4.3.1](http://www.aerospike.com/download/client/c/notes.html#4.3.1). [PR #232](https://github.com/aerospike/aerospike-client-nodejs/pull/232)
* Update to C client's new package format.
* Add support for Debian 9 ("Stretch")
v3.0.2 / 2017-10-09

@@ -2,0 +16,0 @@ ===================

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

* @property {number} WARN
* @property {number} INFO
* @property {number} DEBUG

@@ -392,1 +393,28 @@ * @property {number} DETAIL

}
/**
* Sets the global, default log level and destination. The default log settings
* are used for all new client instances, unless different log settings are
* supplied in the client's configuration.
*
* The global log settings are also used to control the logging of the Aerospike
* C client SDK which is included in the <code>aerospike</code> native add-on.
* The C client SDK log settings are global and cannot be set separately per
* {@link Client} instance.
*
* @param {Object} log
* @param {Number} [log.level] - Log level; see {@link module:aerospike.log}
* for details.
* @param {Number} [log.file] - File descriptor returned by
* <code>fs.open()</code> or one of <code>process.stdout.fd</code> or
* <code>process.stderr.fd</code>.
*/
exports.setDefaultLogging = function (logInfo) {
as.setDefaultLogging(logInfo)
}
// Set default log level
as.setDefaultLogging({
level: as.log.INFO,
file: process.stderr.fd
})

@@ -209,6 +209,7 @@ // *****************************************************************************

*
* @property {number} [log.level] - Log level; see {@link
* @property {Number} [log.level] - Log level; see {@link
* module:aerospike.log} for details.
* @property {number} [log.file] - File descriptor opened using fs.open();
* specify 1 for stdout and 2 for stdin.
* @property {Number} [log.file] - File descriptor returned by
* <code>fs.open()</code> or one of <code>process.stdout.fd</code> or
* <code>process.stderr.fd</code>.
*

@@ -215,0 +216,0 @@ * @example <caption>Enabling debug logging to a separate log file</caption>

@@ -24,5 +24,11 @@ // *****************************************************************************

*
* @extends ApplyPolicy
* @extends BasePolicy
* @since v3.0.0
*/
class ApplyPolicy extends BasePolicy {
/**
* Initializes a new ApplyPolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -74,2 +80,11 @@ props = props || {}

this.durableDelete = props.durableDelete
/**
* Force reads to be linearized for server namespaces that support strong
* consistency (aka CP mode).
*
* @type boolean
* @default <code>false</code>
*/
this.linearizeRead = props.linearizeRead
}

@@ -76,0 +91,0 @@ }

@@ -20,3 +20,7 @@ // *****************************************************************************

/**
* Generic policy fields shared among all policies.
* Base class for all client policies. The base policy defines general policy
* values that are supported by all client policies, including timeout and
* retry handling.
*
* @since v3.0.0
*/

@@ -23,0 +27,0 @@ class BasePolicy {

@@ -25,4 +25,10 @@ // *****************************************************************************

* @extends BasePolicy
* @since v3.0.0
*/
class BatchPolicy extends BasePolicy {
/**
* Initializes a new BatchPolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -61,2 +67,11 @@ props = props || {}

this.sendSetName = props.sendSetName
/**
* Force reads to be linearized for server namespaces that support strong
* consistency (aka CP mode).
*
* @type boolean
* @default <code>false</code>
*/
this.linearizeRead = props.linearizeRead
}

@@ -63,0 +78,0 @@ }

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

* A policy affecting the behavior of info operations.
*
* Please note that `InfoPolicy` does not derive from {@link BasePolicy} and that
* info commands do not support automatic retry.
*
* @since v3.0.0
*/
class InfoPolicy {
/**
* Initializes a new InfoPolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -25,0 +35,0 @@ props = props || {}

@@ -20,9 +20,11 @@ // *****************************************************************************

/**
* A policy affecting the behavior of map operations.
* A policy affecting the behavior of map operations.
*
* @since v3.0.0
*/
class MapPolicy {
/**
* Initialize a new map policy.
* Initializes a new MapPolicy from the provided policy values.
*
* @param {Objecct} props - Policy values
* @param {Object} [props] - Policy values
*/

@@ -29,0 +31,0 @@ constructor (props) {

@@ -25,4 +25,10 @@ // *****************************************************************************

* @extends BasePolicy
* @since v3.0.0
*/
class OperatePolicy extends BasePolicy {
/**
* Initializes a new OperatePolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -49,2 +55,10 @@ props = props || {}

/**
* Specifies the behavior for the existence of the record.
*
* @type number
* @see {@link module:aerospike/policy.exists} for supported policy values.
*/
this.exists = props.exists
/**
* Specifies the replica to be consulted for the read operation.

@@ -86,2 +100,11 @@ *

this.durableDelete = props.durableDelete
/**
* Force reads to be linearized for server namespaces that support strong
* consistency (aka CP mode).
*
* @type boolean
* @default <code>false</code>
*/
this.linearizeRead = props.linearizeRead
}

@@ -88,0 +111,0 @@ }

@@ -25,4 +25,10 @@ // *****************************************************************************

* @extends BasePolicy
* @since v3.0.0
*/
class QueryPolicy extends BasePolicy {
/**
* Initializes a new QueryPolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -29,0 +35,0 @@ props = props || {}

@@ -25,4 +25,10 @@ // *****************************************************************************

* @extends BasePolicy
* @since v3.0.0
*/
class ReadPolicy extends BasePolicy {
/**
* Initializes a new ReadPolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -57,2 +63,11 @@ props = props || {}

this.consistencyLevel = props.consistencyLevel
/**
* Force reads to be linearized for server namespaces that support strong
* consistency (aka CP mode).
*
* @type boolean
* @default <code>false</code>
*/
this.linearizeRead = props.linearizeRead
}

@@ -59,0 +74,0 @@ }

@@ -25,4 +25,10 @@ // *****************************************************************************

* @extends BasePolicy
* @since v3.0.0
*/
class RemovePolicy extends BasePolicy {
/**
* Initializes a new RemovePolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -29,0 +35,0 @@ props = props || {}

@@ -25,4 +25,10 @@ // *****************************************************************************

* @extends BasePolicy
* @since v3.0.0
*/
class ScanPolicy extends BasePolicy {
/**
* Initializes a new ScanPolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -29,0 +35,0 @@ props = props || {}

@@ -25,4 +25,10 @@ // *****************************************************************************

* @extends BasePolicy
* @since v3.0.0
*/
class WritePolicy extends BasePolicy {
/**
* Initializes a new WritePolicy from the provided policy values.
*
* @param {Object} [props] - Policy values
*/
constructor (props) {

@@ -29,0 +35,0 @@ props = props || {}

@@ -36,4 +36,48 @@ // *****************************************************************************

* @description The policy module defines policies and policy values that
* define the behavior of database operations.
* define the behavior of database operations. Most {@link Client} methods,
* including scans and queries, accept a policy object, that affects how the
* database operation is executed, by specifying timeouts, transactional
* behavior, etc. Global defaults for specific types of database operations can
* also be set through the client config, when a new {@link Client} instance is
* created.
*
* Different policies apply to different types of database operations:
*
* * {@link ApplyPolicy} - Applies to {@link Client#apply}.
* * {@link BatchPolicy} - Applies to {@link Client#batchRead} as well as the
* deprecated {@link Client#batchExists}, {@link Client#batchGet}, and {@link
* Client#batchSelect} operations.
* * {@link InfoPolicy} - Applies to {@link Client#info}, {@link
* Client#infoAny}, {@link Client#infoAll} as well as {@link
* Client#createIndex}, {@link Client#indexRemove}, {@link Client#truncate},
* {@link Client#udfRegister} and {@link Client#udfRemove}.
* * {@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` and `MapPolicy`).
*
* This module also defines global values for the following policy settings:
*
* * {@link module:aerospike/policy.commitLevel|commitLevel} - Specifies the
* number of replicas required to be successfully committed before returning
* success in a write operation to provide the desired consistency guarantee.
* * {@link module:aerospike/policy.consistencyLevel|consistencyLevel} -
* Specifies the number of replicas to be consulted in a read operation to
* provide the desired consistency guarantee.
* * {@link module:aerospike/policy.exists|exists} - Specifies the behavior for
* writing the record depending whether or not it exists.
* * {@link module:aerospike/policy.gen|gen} - Specifies the behavior of record
* modifications with regard to the generation value.
* * {@link module:aerospike/policy.key|key} - Specifies the behavior for
* whether keys or digests should be sent to the cluster.
* * {@link module:aerospike/policy.replica|replica} - Specifies which
* partition replica to read from.
*
* @example

@@ -43,3 +87,3 @@ *

*
* // global policy, applied to all commands that do not override it
* // Set default policies for read and write commands
* let defaults = {

@@ -62,3 +106,3 @@ * socketTimeout: 50,

*
* // override policy for put command
* // Override policy for put command
* let policy = new Aerospike.policy.WritePolicy({

@@ -65,0 +109,0 @@ * exists: Aerospike.policy.exists.CREATE,

@@ -143,6 +143,6 @@ // *****************************************************************************

/**
* XDR not available for the cluster.
* Client is attempting an operation which is not allowed under current configuration.
* @const {number}
*/
exports.ERR_NO_XDR = exports.AEROSPIKE_ERR_NO_XDR = as.status.AEROSPIKE_ERR_NO_XDR
exports.ERR_ALWAYS_FORBIDDEN = exports.AEROSPIKE_ERR_ALWAYS_FORBIDDEN = as.status.AEROSPIKE_ERR_ALWAYS_FORBIDDEN

@@ -520,4 +520,4 @@ /**

case exports.ERR_NO_XDR:
return 'XDR not available for the cluster.'
case exports.ERR_ALWAYS_FORBIDDEN:
return 'Client is attempting an operation which is not allowed under current configuration.'

@@ -524,0 +524,0 @@ case exports.ERR_CLUSTER:

{
"name": "aerospike",
"version": "3.0.2",
"version": "3.1.0",
"description": "Aerospike Client Library",

@@ -33,3 +33,3 @@ "keywords": [

"posttest": "standard",
"coverage": "nyc npm test; nyc --reporter=lcov report",
"coverage": "nyc npm test && nyc --reporter=lcov report",
"codecov": "codecov",

@@ -42,3 +42,3 @@ "prepush": "npm test",

"bindings": "^1.3.0",
"nan": "~2.3.0"
"nan": "^2.8.0"
},

@@ -48,4 +48,4 @@ "devDependencies": {

"expect.js": "^0.3",
"ink-docstrap": "^1.1.0",
"jsdoc": "^3.4.0",
"ink-docstrap": "^1.3.0",
"jsdoc": "^3.5.5",
"mocha": "^3.5.3",

@@ -52,0 +52,0 @@ "nyc": "^11.2.1",

@@ -28,3 +28,3 @@ # Aerospike Node.js Client [![travis][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url]

- [Custom Search Path](#Custom-Search-Path)
- [Documentaion](#Documentation)
- [Documentation](#Documentation)
- [Tests](#Tests)

@@ -31,0 +31,0 @@ - [Benchmarks](#Benchmarks)

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

const Aerospike = require('../lib/aerospike')
const AerospikeError = Aerospike.AerospikeError
const Client = Aerospike.Client

@@ -25,0 +24,0 @@ const helper = require('./test_helper')

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

context('exists policy', function () {
context('policy.exists.UPDATE', function () {
it('does not create a key that does not exist yet', function () {
let notExistentKey = keygen.string(helper.namespace, helper.set, {prefix: 'test/operate/doesNotExist'})()
let ops = [op.write('i', 49)]
let policy = new Aerospike.policy.OperatePolicy({
exists: Aerospike.policy.exists.UPDATE
})
return client.operate(notExistentKey, ops, {}, policy)
.catch(error => expect(error.code).to.be(status.ERR_RECORD_NOT_FOUND))
.then(() => client.exists(notExistentKey))
.then(exists => expect(exists).to.be(false))
})
})
})
it('sends meta data and applies an operate policy', function () {

@@ -233,0 +250,0 @@ let ops = [

@@ -459,2 +459,33 @@ // *****************************************************************************

context('exists policy', function () {
context('policy.exists.UPDATE', function () {
it('does not create a key that does not exist yet', function () {
let key = keygen.integer(helper.namespace, helper.set)()
let policy = new Aerospike.policy.WritePolicy({
exists: Aerospike.policy.exists.UPDATE
})
return client.put(key, {i: 49}, {}, policy)
.catch(error => expect(error.code).to.be(status.ERR_RECORD_NOT_FOUND))
.then(() => client.exists(key))
.then(exists => expect(exists).to.be(false))
})
})
context('policy.exists.CREATE', function () {
it('does not update a record if it already exists', function () {
let key = keygen.integer(helper.namespace, helper.set)()
let policy = new Aerospike.policy.WritePolicy({
exists: Aerospike.policy.exists.CREATE
})
return client.put(key, {i: 49}, {}, policy)
.then(() => client.put(key, {i: 50}, {}, policy))
.catch(error => expect(error.code).to.be(status.ERR_RECORD_EXISTS))
.then(() => client.get(key))
.then(record => expect(record.bins.i).to.be(49))
})
})
})
context('gen policy', function () {

@@ -461,0 +492,0 @@ it('updates record if generation matches', function () {

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

Aerospike.setDefaultLogging(config.log)
const client = Aerospike.client(config)

@@ -44,0 +46,0 @@ exports.client = client

@@ -52,3 +52,3 @@ // *****************************************************************************

alias: 'l',
default: Aerospike.log.INFO,
default: Aerospike.log.WARN,
describe: 'Log level [0-5]'

@@ -55,0 +55,0 @@ },

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc