Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aerospike

Package Overview
Dependencies
Maintainers
3
Versions
138
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 1.0.55 to 1.0.56

aerospike-1.0.56.tgz

3

docs/client.md

@@ -889,2 +889,5 @@ # Client Class

```
Note: The client does not perform any automatic data type conversions. Attempting to write an unsupported data type (e.g. boolean) into a record bin will cause an error to be returned. Setting an `undefined` value will also cause an error.
<!--

@@ -891,0 +894,0 @@ ################################################################################

@@ -12,3 +12,3 @@ # Data Model

A record is how the data is represented and stored in the database. A record represented as an object. The keys of the object are the names of the fields (bins) of a record. The values for each field can either be Number, String, Array, Buffer or an Object itself. Aerospike supports Integer, double, string, bytes, array and map datatypes. All the decimal values with valid fractions `(123.45, 123.4)` will be stored as double in aerospike. To store decimal values with 0 fraction as double, [`aerospike.Double()`](aerospike.md#Double).
A record is how the data is represented and stored in the database. A record represented as an object. The keys of the object are the names of the fields (bins) of a record. The values for each field can either be Number, String, Array, Buffer or an Object itself. Aerospike supports integer, double, string, bytes, array and map datatypes. All the decimal values with valid fractions `(123.45, 123.4)` will be stored as double in aerospike. To store decimal values with 0 fraction as double, [`aerospike.Double()`](aerospike.md#Double).

@@ -29,2 +29,6 @@ Note: Array can contain an array or an object as a value in it. Similarly the object can contain an array or an object as a value in it. Essentially nesting of arrays in an object, and nesting of objects in an array is allowed.

### Unsupported Data Types
Aerospike does currently not support a boolean data type. To store boolean values in the database the application needs to convert them to a supported data type as the client does not do any automatica data type conversions. Attempting to store a boolean value in a record bin will lead to a parameter error being returned by the client.
<!--

@@ -31,0 +35,0 @@ ################################################################################

2

docs/largelist.md

@@ -210,3 +210,3 @@ # LargeList Class

```js
llist.delete({'key': 'ldt_key'}, function (error, response){
llist.remove({'key': 'ldt_key'}, function (error, response){
if (error && error.code !== status.AEROSPIKE_OK) {

@@ -213,0 +213,0 @@ // handle failure

@@ -0,1 +1,17 @@

1.0.56 / 2016-02-11
===================
* **Improvements**
* Support `operator.incr()` operation on double values.
* Refactor test suite to improve performance and maintainability.
* **Fixes**
* Fix segfault when `client.connect()` is called without callback function.
* **Documentation**
* Fix wrong method name in llist documentation. Thanks to @srinivasiyer!
* Update build dependencies for CentOS/RHEL 6.
* Clarify supported data types and (lack of) automatic data type conversions.
* Update supported Node.js versions.
1.0.55 / 2016-01-15

@@ -2,0 +18,0 @@ ===================

{
"name": "aerospike",
"version": "1.0.55",
"version": "1.0.56",
"description": "Aerospike Client Library",

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

@@ -8,3 +8,3 @@ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

This module is compatible with Node.js v0.10.x, v0.12.x, io.js, v4.x, v5.x and supports the following operating systems:
CentOS/RHEL 6.x, Debian 6+, Ubuntu 12.04+, Fedora20, Fedora21, Fedora 22, Linuxmint and Mac OS X.
CentOS/RHEL 6.x, Debian 6+, Ubuntu 12.04+, Fedora 20/21/22, Linuxmint and Mac OS X.

@@ -81,13 +81,17 @@ - [Usage](#Usage)

[Node.js](http://nodejs.org) version v0.10.x or v0.12.x is required.
The aerospike package supports Node.js v0.10.x,
v0.12.x, v4.2.x (LTS) and v5.x as well as io.js. To download and install the
latest stable version of Node.js, visit [nodejs.org](http://nodejs.org/) or use
the version that comes bundled with your operating system.
Aerospike is an addon module written using V8. To compile V8 g++ must be installed in
the system.
The Aerospike package includes a native addon. `gcc`/`g++` v4.8 or newer or
`clang`/`clang++` v3.4 or newer are required to build the addon with Node.js
v4.x/v5.x.
To install the latest stable version of Node.js, visit
[http://nodejs.org/download/](http://nodejs.org/download/)
The Aerospike addon depends on the Aerospike C client library, which gets
downloaded during package installation. Either the cURL or Wget command line tool
is required for this. See ["C Client Resolution"](#C-Client-Resolution) below for
further information.
Aerospike Node.js has a dependency on Aerospike C client, which is
downloaded during the installation. To Download Aerospike C client, curl is required.
The client library requires the following libraries to be present on the machine for building and running.
The package has the following compile time/run time dependencies:

@@ -102,3 +106,3 @@ | Library Name | .rpm Package | Description |

- CentOS/RHEL 6.x
### CentOS/RHEL 6.x

@@ -111,8 +115,8 @@ To install library prerequisites via `yum`:

Some CentOS installation paths do not include necessary C development tools. You may need the following packages:
Note: The `gcc` tool chain included in CentOS/RHEL 6.x is gcc-4.4. To build the
Aerospike addon using Node.js v4/v5, gcc-4.8 or later is required. To update
the gcc tool chain you may have to install a recent version of the [Red Hat Developer Toolset](https://access.redhat.com/documentation/en/red-hat-developer-toolset/)
or a compatible devtoolset version for CentOS.
```bash
sudo yum install gcc gcc-c++
```
- Debian 6+
### Debian 6+

@@ -131,4 +135,5 @@ To install library prerequisites via `apt-get`:

```
- Ubuntu 12.04+
### Ubuntu 12.04+
To install library prerequisites via `apt-get`:

@@ -147,5 +152,6 @@

- Mac OS X
### Mac OS X
Before starting with the Aerospike Nodejs Client, please make sure the following prerequisites are met:
- Mac OS X 10.8 or greater.

@@ -155,3 +161,3 @@ - Xcode 5 or greater.

####Openssl library installation in Mac OS X.
#### Openssl library installation in Mac OS X.

@@ -163,3 +169,3 @@ ```bash

#####Lua Installation in Mac OS X
#### Lua Installation in Mac OS X

@@ -288,4 +294,5 @@ Lua is required for performing aggregations on results returned from the database. The following are instruction for installing Lua 5.1:

<a name="Aerospike with Aggregation">
<a name="Aerospike with Aggregation"></a>
### Aerospike with Aggregation
Aerospike nodejs client does not include LUA by default during installation. Application can set

@@ -292,0 +299,0 @@ an environment variable `USELUA` to inclue LUA library, and can use the Aggregation feature in

@@ -17,34 +17,20 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
var putgen = require('./generators/put')
var valgen = require('./generators/value')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
const putgen = helper.putgen
const valgen = helper.valgen
var status = aerospike.status
const status = aerospike.status
describe('client.batchExists()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should successfully find 10 records', function (done) {

@@ -56,3 +42,3 @@ this.timeout(3000)

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_exists/10/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_exists/10/', random: false})
var mgen = metagen.constant({ttl: 1000})

@@ -96,3 +82,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_exists/fail/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_exists/fail/', random: false})
var keys = keygen.range(kgen, nrecords)

@@ -130,3 +116,3 @@

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_exists/1000/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_exists/1000/', random: false})
var mgen = metagen.constant({ttl: 1000})

@@ -133,0 +119,0 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

@@ -17,34 +17,20 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
var putgen = require('./generators/put')
var valgen = require('./generators/value')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
const putgen = helper.putgen
const valgen = helper.valgen
var status = aerospike.status
const status = aerospike.status
describe('client.batchGet()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should successfully read 10 records', function (done) {

@@ -55,3 +41,3 @@ // number of records

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_get/' + nrecords + '/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_get/' + nrecords + '/', random: false})
var mgen = metagen.constant({ttl: 1000})

@@ -100,3 +86,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_get/fail/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_get/fail/', random: false})

@@ -137,3 +123,3 @@ // values

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_get/1000/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_get/1000/', random: false})
var mgen = metagen.constant({ttl: 1000})

@@ -140,0 +126,0 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

@@ -17,34 +17,20 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
var putgen = require('./generators/put')
var valgen = require('./generators/value')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
const putgen = helper.putgen
const valgen = helper.valgen
var status = aerospike.status
const status = aerospike.status
describe('client.batchSelect()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should successfully read bins from 10 records', function (done) {

@@ -55,3 +41,3 @@ // number of records

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_get/10/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_get/10/', random: false})
var mgen = metagen.constant({ttl: 1000})

@@ -101,3 +87,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_get/fail/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_get/fail/', random: false})

@@ -140,3 +126,3 @@ // values

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/batch_get/1000/', random: false})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/batch_get/1000/', random: false})
var mgen = metagen.constant({ttl: 1000})

@@ -143,0 +129,0 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

@@ -17,37 +17,23 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../lib/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
var status = aerospike.status
var op = aerospike.operator
const status = aerospike.status
const op = aerospike.operator
describe('client.operate()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
describe('operator.listAppend', function () {
it('should append the given item at the end of the list', function (done) {
// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/append/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/append/'})
var mgen = metagen.constant({ttl: 1000})

@@ -89,3 +75,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/append_items/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/append_items/'})
var mgen = metagen.constant({ttl: 1000})

@@ -127,3 +113,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/insert/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/insert/'})
var mgen = metagen.constant({ttl: 1000})

@@ -165,3 +151,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/insert_items/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/insert_items/'})
var mgen = metagen.constant({ttl: 1000})

@@ -203,3 +189,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/pop/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/pop/'})
var mgen = metagen.constant({ttl: 1000})

@@ -242,3 +228,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/pop_range/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/pop_range/'})
var mgen = metagen.constant({ttl: 1000})

@@ -279,3 +265,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/pop_range_from/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/pop_range_from/'})
var mgen = metagen.constant({ttl: 1000})

@@ -318,3 +304,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/remove/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/remove/'})
var mgen = metagen.constant({ttl: 1000})

@@ -356,3 +342,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/remove_range/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/remove_range/'})
var mgen = metagen.constant({ttl: 1000})

@@ -392,3 +378,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/remove_range_from/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/remove_range_from/'})
var mgen = metagen.constant({ttl: 1000})

@@ -430,3 +416,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/clear/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/clear/'})
var mgen = metagen.constant({ttl: 1000})

@@ -468,3 +454,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/set/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/set/'})
var mgen = metagen.constant({ttl: 1000})

@@ -506,3 +492,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/trim/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/trim/'})
var mgen = metagen.constant({ttl: 1000})

@@ -544,3 +530,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -576,3 +562,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/get/oob/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/get/oob/'})
var mgen = metagen.constant({ttl: 1000})

@@ -609,3 +595,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/get_range/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/get_range/'})
var mgen = metagen.constant({ttl: 1000})

@@ -641,3 +627,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/get_range_from/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/get_range_from/'})
var mgen = metagen.constant({ttl: 1000})

@@ -675,3 +661,3 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/cdt/size/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/cdt/size/'})
var mgen = metagen.constant({ttl: 1000})

@@ -678,0 +664,0 @@ var rgen = recgen.constant({list: [1, 2, 3, 4, 5]})

@@ -20,28 +20,19 @@ // *****************************************************************************

// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
const keygen = helper.keygen
var status = aerospike.status
const status = aerospike.status
describe('client.execute()', function (done) {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
client.udfRegister(__dirname + '/udf_test.lua', function (err) {
expect(err.code).to.equal(status.AEROSPIKE_OK)
done()
})
})
helper.udf.register('udf_test.lua', done)
})
after(function (done) {
client.close()
client = null
done()
helper.udf.remove('udf_test.lua', done)
})

@@ -51,3 +42,3 @@

var udfArgs = { module: 'udf_test', funcname: 'rec_create' }
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/udfExecute/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/udfExecute/'})
var key = kgen()

@@ -67,3 +58,3 @@ client.execute(key, udfArgs, function (err, res) {

var udfArgs = { module: 'udf_test', funcname: 'rec_update', args: [123, 'str'] }
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/udfExecute/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/udfExecute/'})
var key = kgen()

@@ -83,3 +74,3 @@ client.execute(key, udfArgs, function (err, res) {

var udfArgs = {module: 'udf_test', funcname: 'rec_update', args: [345, 'bar']}
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/udfExecute/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/udfExecute/'})
var key = kgen()

@@ -100,3 +91,3 @@ var applypolicy = {timeout: 1500}

var udfArgs = { module: 'udf_test', funcname: 'rec_nofunc' }
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/udfExecute/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/udfExecute/'})
var key = kgen()

@@ -103,0 +94,0 @@ client.execute(key, udfArgs, function (err, res, key) {

@@ -17,36 +17,22 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
var valgen = require('./generators/value')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
const valgen = helper.valgen
var status = aerospike.status
const status = aerospike.status
describe('client.exists()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should find the record', function (done) {
// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/exists/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/exists/'})
var mgen = metagen.constant({ttl: 1000})

@@ -76,3 +62,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/exists/fail/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/exists/fail/'})

@@ -79,0 +65,0 @@ // values

@@ -17,36 +17,22 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
var status = aerospike.status
var policy = aerospike.policy
const status = aerospike.status
const policy = aerospike.policy
describe('client.get()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should read the record', function (done) {
// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -76,3 +62,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/not_found/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/not_found/'})

@@ -96,3 +82,3 @@ // values

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -99,0 +85,0 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

@@ -17,31 +17,17 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../lib/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var status = aerospike.status
const status = aerospike.status
describe('client.index()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should create an integer index', function (done) {
var args = { ns: options.namespace,
set: options.set,
var args = { ns: helper.namespace,
set: helper.set,
bin: 'integer_bin',

@@ -55,4 +41,5 @@ index: 'integer_index' }

})
it('should create an string index', function (done) {
var args = { ns: options.namespace, set: options.set, bin: 'string_bin',
var args = { ns: helper.namespace, set: helper.set, bin: 'string_bin',
index: 'string_index' }

@@ -65,4 +52,5 @@ client.createStringIndex(args, function (err) {

})
it('should create an integer index with info policy', function (done) {
var args = { ns: options.namespace, set: options.set, bin: 'policy_bin',
var args = { ns: helper.namespace, set: helper.set, bin: 'policy_bin',
index: 'policy_index', policy: { timeout: 1000, send_as_is: true, check_bounds: false }}

@@ -75,4 +63,5 @@ client.createIntegerIndex(args, function (err) {

})
it('should drop an index', function (done) {
client.indexRemove(options.namespace, 'string_integer', function (err) {
client.indexRemove(helper.namespace, 'string_integer', function (err) {
expect(err).to.be.ok()

@@ -83,5 +72,6 @@ expect(err.code).to.equal(status.AEROSPIKE_OK)

})
it('should create an integer index and wait until index creation is done', function (done) {
var args = { ns: options.namespace,
set: options.set,
var args = { ns: helper.namespace,
set: helper.set,
bin: 'integer_done',

@@ -92,3 +82,3 @@ index: 'integer_index_done' }

expect(err.code).to.equal(status.AEROSPIKE_OK)
client.indexCreateWait(options.namespace, 'integer_index_done', 1000, function (err) {
client.indexCreateWait(helper.namespace, 'integer_index_done', 1000, function (err) {
expect(err).to.be.ok()

@@ -100,5 +90,6 @@ expect(err.code).to.equal(status.AEROSPIKE_OK)

})
it('should create a string index and wait until index creation is done', function (done) {
var args = { ns: options.namespace,
set: options.set,
var args = { ns: helper.namespace,
set: helper.set,
bin: 'string_done',

@@ -109,3 +100,3 @@ index: 'string_index_done' }

expect(err.code).to.equal(status.AEROSPIKE_OK)
client.indexCreateWait(options.namespace, 'string_index_done', 1000, function (err) {
client.indexCreateWait(helper.namespace, 'string_index_done', 1000, function (err) {
expect(err).to.be.ok()

@@ -112,0 +103,0 @@ expect(err.code).to.equal(status.AEROSPIKE_OK)

@@ -17,29 +17,16 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var status = aerospike.status
const status = aerospike.status
describe('client.info()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should get "objects" from entire cluster', function (done) {
it('should get "objects" from specific host in cluster', function (done) {
var options = helper.options
var host = {addr: options.host, port: options.port}

@@ -49,2 +36,3 @@ client.info('objects', host, function (err, response, host) {

expect(err.code).to.equal(status.AEROSPIKE_OK)
expect(response.indexOf('objects\t')).to.eql(0)
done()

@@ -51,0 +39,0 @@ })

@@ -20,14 +20,13 @@ // *****************************************************************************

// we want to test the built aerospike module
var aerospike = require('../lib/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var valgen = require('./generators/value')
const valgen = helper.valgen
var status = aerospike.status
var policy = aerospike.policy
const status = aerospike.status
const policy = aerospike.policy
describe('client.LargeList()', function (done) {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client

@@ -39,3 +38,3 @@ // A single LList is created. All LList operations are done in this single list to demonstrate the

// Get a largelist object from client.
var listkey = {ns: options.namespace, set: options.set, key: 'ldt_list_key'}
var listkey = {ns: helper.namespace, set: helper.set, key: 'ldt_list_key'}
var writepolicy = {timeout: 1000, key: policy.key.SEND, commitLevel: policy.commitLevel.ALL}

@@ -46,31 +45,15 @@ var LList = client.LargeList(listkey, 'ldt_list_bin', writepolicy)

before(function (done) {
client.connect(function (err) {
expect(err).to.be.ok()
expect(err.code).to.equal(status.AEROSPIKE_OK)
var ns = 'namespace/' + options.namespace.toString()
client.info(ns, {addr: options.host, port: options.port},
function (err, response, host) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
var nsConfig = response.split(';')
for (var i = 0; i < nsConfig.length; i++) {
if (nsConfig[i].search('ldt-enabled=false') >= 0) {
ldtEnabled = false
console.log('Skipping LDT test cases')
break
}
}
done()
})
})
ldtEnabled = helper.cluster.ldt_enabled()
done()
})
after(function (done) {
LList.destroy(function (err, val) {
if (ldtEnabled) {
if (ldtEnabled) {
LList.destroy(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
client.close()
client = null
}
done()
})
} else {
done()
})
}
})

@@ -77,0 +60,0 @@

@@ -17,63 +17,90 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../lib/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
var status = aerospike.status
var op = aerospike.operator
const status = aerospike.status
const op = aerospike.operator
describe('client.operate()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
describe('INCR operation', function () {
it('should increment bin with integer value', function (done) {
var key = keygen.string(helper.namespace, helper.set, {prefix: 'test/incr/int'})()
client.put(key, {i: 123}, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
var ops = [
op.incr('i', 432)
]
client.operate(key, ops, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
client.get(key, function (err, record2) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
expect(record2['i']).to.equal(555)
client.remove(key, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
})
})
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should increment bin with double value', function (done) {
var key = keygen.string(helper.namespace, helper.set, {prefix: 'test/incr/double'})()
it('should increment a bin', function (done) {
// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})
var rgen = recgen.constant({i: 123, s: 'abc'})
client.put(key, {f: 3.14159}, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
var ops = [
op.incr('f', 2.71828)
]
// values
var key = kgen()
var meta = mgen(key)
var record = rgen(key, meta)
client.operate(key, ops, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
// write the record then check
client.put(key, record, meta, function (err, key) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
var ops = [
op.incr('i', 432)
]
client.get(key, function (err, record2) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
expect(record2['f']).to.equal(5.85987)
client.operate(key, ops, function (err, record1, metadata1, key1) {
expect(err).to.be.ok()
expect(err.code).to.equal(status.AEROSPIKE_OK)
client.remove(key, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
})
})
})
client.get(key, function (err, record2, metadata2, key2) {
it('should increment bin with aerospike.Double() value', function (done) {
var key = keygen.string(helper.namespace, helper.set, {prefix: 'test/incr/Double'})()
client.put(key, {f: 3.14159}, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
var ops = [
op.incr('f', aerospike.Double(1.0))
]
client.operate(key, ops, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
expect(record['i'] + 432).to.equal(record2['i'])
expect(record['s']).to.equal(record2['s'])
client.remove(key2, function (err, key) {
client.get(key, function (err, record2) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
expect(record2['f']).to.equal(4.14159)
client.remove(key, function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})

@@ -87,3 +114,3 @@ })

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -124,3 +151,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -164,3 +191,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -223,3 +250,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -258,3 +285,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -294,3 +321,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -329,3 +356,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -364,3 +391,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -399,3 +426,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -434,3 +461,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -459,3 +486,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -484,3 +511,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -509,3 +536,3 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -512,0 +539,0 @@ var rgen = recgen.constant({i: 123, s: 'abc'})

@@ -17,13 +17,13 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
var valgen = require('./generators/value')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
const valgen = helper.valgen

@@ -34,18 +34,4 @@ var status = aerospike.status

describe('client.put()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should write and validate 100 records', function (done) {

@@ -57,3 +43,3 @@ // counters

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -91,3 +77,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -119,3 +105,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string()})

// generators
var kgen = keygen.integer(options.namespace, options.set)
var kgen = keygen.integer(helper.namespace, helper.set)
var mgen = metagen.constant({ttl: 1000})

@@ -147,3 +133,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string()})

// generators
var kgen = keygen.bytes(options.namespace, options.set)
var kgen = keygen.bytes(helper.namespace, helper.set)
var mgen = metagen.constant({ttl: 1000})

@@ -173,3 +159,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -202,3 +188,3 @@ var rgen = recgen.record({list: valgen.array(), map: valgen.map()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -233,3 +219,3 @@

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -262,3 +248,3 @@ var rgen = recgen.record({list_of_list: valgen.array_of_array(), map_of_list: valgen.map_of_map()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -320,3 +306,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -384,3 +370,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -428,3 +414,3 @@ var rgen = recgen.record({

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -456,3 +442,3 @@ var rgen = recgen.record({

// generators
var kgen = keygen.string(options.namespace, '', {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, '', {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -488,3 +474,3 @@ var rgen = recgen.record({

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -520,3 +506,3 @@ var rgen = recgen.record({

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/put/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})
var mgen = metagen.constant({ttl: 1000})

@@ -542,3 +528,3 @@

// values
var key = aerospike.key(options.namespace, options.set, undefined)
var key = aerospike.key(helper.namespace, helper.set, undefined)
var meta = mgen(key)

@@ -557,3 +543,3 @@ var record = { }

// generators
var kgen = keygen.integer(options.namespace, options.set)
var kgen = keygen.integer(helper.namespace, helper.set)
var mgen = metagen.constant({ttl: 1000})

@@ -560,0 +546,0 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string()})

@@ -20,81 +20,54 @@ // *****************************************************************************

// we want to test the built aerospike module
var aerospike = require('../lib/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var status = aerospike.status
var filter = aerospike.filter
const status = aerospike.status
const filter = aerospike.filter
describe('client.query()', function () {
var config = options.getConfig()
config.modlua = {}
config.modlua.userPath = __dirname
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
var indexCreationCallback = function (err) {
expect(err.code).to.equal(status.AEROSPIKE_OK)
}
// create integer and string index.
var indexObj = {
ns: options.namespace,
set: options.set,
bin: 'queryBinInt',
index: 'queryIndexInt'
}
client.createIntegerIndex(indexObj, indexCreationCallback)
if (helper.options.run_aggregation) {
helper.udf.register('aggregate.lua')
}
indexObj = {
ns: options.namespace,
set: options.set,
bin: 'queryBinString',
index: 'queryIndexString'
}
client.createStringIndex(indexObj, indexCreationCallback)
helper.index.create('queryIndexInt', 'queryBinInt', 'integer')
helper.index.create('queryIndexString', 'queryBinString', 'string')
// Register the UDFs to be used in aggregation.
// load objects - to be queried in test case.
var total = 100
var count = 0
var dir = __dirname
var filename = dir + '/aggregate.lua'
client.udfRegister(filename, function (err) {
expect(err).to.be.ok()
expect(err.code).to.equal(status.AEROSPIKE_OK)
})
function iteration (i) {
// values
var key = {ns: helper.namespace, set: helper.set, key: 'test/query' + i.toString()}
var meta = {ttl: 10000, gen: 1}
var record = {queryBinInt: i, queryBinString: 'querystringvalue'}
// load objects - to be queried in test case.
var total = 100
var count = 0
// write the record then check
client.put(key, record, meta, function (err, key) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
function iteration (i) {
// values
var key = {ns: options.namespace, set: options.set, key: 'test/query' + i.toString()}
var meta = {ttl: 10000, gen: 1}
var record = {queryBinInt: i, queryBinString: 'querystringvalue'}
// write the record then check
client.put(key, record, meta, function (err, key) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
client.get(key, function (err, _record, _metadata, _key) {
expect(err).to.be.ok()
expect(err.code).to.equal(status.AEROSPIKE_OK)
count++
if (count >= total) {
done()
}
})
client.get(key, function (err, _record, _metadata, _key) {
expect(err).to.be.ok()
expect(err.code).to.equal(status.AEROSPIKE_OK)
count++
if (count >= total) {
done()
}
})
}
})
}
for (var i = 1; i <= total; i++) {
iteration(i)
}
})
for (var i = 1; i <= total; i++) {
iteration(i)
}
})
after(function (done) {
client.close()
client = null
if (helper.options.run_aggregation) {
helper.udf.remove('aggregate.lua')
}
done()

@@ -109,3 +82,3 @@ })

var args = { filters: [filter.equal('queryBinInt', 100)] }
var query = client.query(options.namespace, options.set, args)
var query = client.query(helper.namespace, helper.set, args)

@@ -136,3 +109,3 @@ var stream = query.execute()

var args = { filters: [filter.range('queryBinInt', 1, 100)] }
var query = client.query(options.namespace, options.set, args)
var query = client.query(helper.namespace, helper.set, args)

@@ -163,3 +136,3 @@ var stream = query.execute()

var args = { filters: [filter.equal('queryBinString', 'querystringvalue')] }
var query = client.query(options.namespace, options.set, args)
var query = client.query(helper.namespace, helper.set, args)

@@ -185,59 +158,54 @@ var stream = query.execute()

it('should query on an index and apply aggregation user defined function', function (done) {
if (!options.run_aggregation) {
done()
} else {
// counters
var count = 0
var err = 0
if (!helper.options.run_aggregation) { this.skip() }
var args = { filters: [filter.equal('queryBinString', 'querystringvalue')],
aggregationUDF: {module: 'aggregate', funcname: 'sum_test_bin'}}
var query = client.query(options.namespace, options.set, args)
// counters
var count = 0
var err = 0
var stream = query.execute()
stream.on('data', function (result) {
expect(result).to.be.ok()
count++
})
stream.on('error', function (error) {
expect(error).to.be.ok()
expect(error.code).to.equal(status.AEROSPIKE_OK)
err++
})
stream.on('end', function (end) {
expect(count).to.be.equal(1)
expect(err).to.equal(0)
done()
})
}
var args = { filters: [filter.equal('queryBinString', 'querystringvalue')],
aggregationUDF: {module: 'aggregate', funcname: 'sum_test_bin'}}
var query = client.query(helper.namespace, helper.set, args)
var stream = query.execute()
stream.on('data', function (result) {
expect(result).to.be.ok()
count++
})
stream.on('error', function (error) {
expect(error).to.be.ok()
expect(error.code).to.equal(status.AEROSPIKE_OK)
err++
})
stream.on('end', function (end) {
expect(count).to.be.equal(1)
expect(err).to.equal(0)
done()
})
})
it('should scan aerospike database and apply aggregation user defined function', function (done) {
if (!options.run_aggregation) {
done()
} else {
// counters
var count = 0
var err = 0
if (!helper.options.run_aggregation) { this.skip() }
var args = {aggregationUDF: {module: 'aggregate', funcname: 'sum_test_bin'}}
var query = client.query(options.namespace, options.set, args)
// counters
var count = 0
var err = 0
var stream = query.execute()
stream.on('data', function (result) {
expect(result).to.be.ok()
count++
})
stream.on('error', function (error) {
expect(error).to.be.ok()
expect(error.code).to.equal(status.AEROSPIKE_OK)
err++
})
stream.on('end', function (end) {
expect(count).to.be.equal(1)
expect(err).to.equal(0)
done()
})
}
var args = {aggregationUDF: {module: 'aggregate', funcname: 'sum_test_bin'}}
var query = client.query(helper.namespace, helper.set, args)
var stream = query.execute()
stream.on('data', function (result) {
expect(result).to.be.ok()
count++
})
stream.on('error', function (error) {
expect(error).to.be.ok()
err++
})
stream.on('end', function (end) {
expect(count).to.be.equal(1)
expect(err).to.equal(0)
done()
})
})
})

@@ -17,36 +17,22 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
var valgen = require('./generators/value')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
const valgen = helper.valgen
var status = aerospike.status
const status = aerospike.status
describe('client.remove()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should remove a record w/ string key', function (done) {
// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -83,3 +69,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.integer(options.namespace, options.set)
var kgen = keygen.integer(helper.namespace, helper.set)
var mgen = metagen.constant({ttl: 1000})

@@ -116,3 +102,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/not_found/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/not_found/'})

@@ -119,0 +105,0 @@ // values

@@ -20,66 +20,54 @@ // *****************************************************************************

// we want to test the built aerospike module
var aerospike = require('../lib/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
var valgen = require('./generators/value')
const metagen = helper.metagen
const recgen = helper.recgen
const valgen = helper.valgen
var status = aerospike.status
const status = aerospike.status
describe('client.query() - without where clause(Scan)', function () {
var config = options.getConfig()
var client = aerospike.client(config)
const client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
helper.udf.register('scan.lua')
// counters
var total = 100
var count = 0
// counters
var total = 100
var count = 0
// generators
var mgen = metagen.constant({ttl: 1000})
var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})
// generators
var mgen = metagen.constant({ttl: 1000})
var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})
function iteration (i) {
// values
var key = {ns: options.namespace, set: options.set, key: 'test/query' + i.toString()}
var meta = mgen(key)
var record = rgen(key, meta)
function iteration (i) {
// values
var key = {ns: helper.namespace, set: helper.set, key: 'test/scan/' + i.toString()}
var meta = mgen(key)
var record = rgen(key, meta)
// register the UDF used in scan background.
var dir = __dirname
var filename = dir + '/scan.lua'
client.udfRegister(filename, function (err) {
// write the record then check
client.put(key, record, meta, function (err, key) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
client.get(key, function (err, _record, _metadata, _key) {
expect(err).to.be.ok()
expect(err.code).to.equal(status.AEROSPIKE_OK)
count++
if (count >= total) {
done()
}
})
})
}
// write the record then check
client.put(key, record, meta, function (err, key) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
client.get(key, function (err, _record, _metadata, _key) {
expect(err).to.be.ok()
expect(err.code).to.equal(status.AEROSPIKE_OK)
count++
if (count >= total) {
done()
}
})
})
}
for (var i = 0; i < total; i++) {
iteration(i)
}
})
for (var i = 0; i < total; i++) {
iteration(i)
}
})
after(function (done) {
client.close()
client = null
helper.udf.remove('scan.lua')
done()

@@ -94,3 +82,3 @@ })

var query = client.query(options.namespace, options.set)
var query = client.query(helper.namespace, helper.set)

@@ -121,3 +109,3 @@ var stream = query.execute()

var args = {nobins: true}
var query = client.query(options.namespace, options.set, args)
var query = client.query(helper.namespace, helper.set, args)

@@ -146,3 +134,3 @@ var stream = query.execute()

var args = {select: ['i', 's']}
var query = client.query(options.namespace, options.set, args)
var query = client.query(helper.namespace, helper.set, args)

@@ -166,3 +154,3 @@ var stream = query.execute()

var args = {UDF: {module: 'scan', funcname: 'updateRecord'}}
var scanBackground = client.query(options.namespace, options.set, args)
var scanBackground = client.query(helper.namespace, helper.set, args)

@@ -169,0 +157,0 @@ var err = 0

@@ -17,37 +17,23 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../build/Release/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var keygen = require('./generators/key')
var metagen = require('./generators/metadata')
var recgen = require('./generators/record')
var valgen = require('./generators/value')
const keygen = helper.keygen
const metagen = helper.metagen
const recgen = helper.recgen
const valgen = helper.valgen
var status = aerospike.status
var policy = aerospike.policy
const status = aerospike.status
const policy = aerospike.policy
describe('client.select()', function () {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should read the record', function (done) {
// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/select/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/select/'})
var mgen = metagen.constant({ttl: 1000})

@@ -85,3 +71,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/select/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/select/'})
var mgen = metagen.constant({ttl: 1000})

@@ -99,3 +85,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
var select_key = {ns: options.namespace, set: options.set}
var select_key = {ns: helper.namespace, set: helper.set}

@@ -116,3 +102,3 @@ client.select(select_key, bins, function (err, _record, metadata, key1) {

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/not_found/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/not_found/'})
var mgen = metagen.constant({ttl: 1000})

@@ -137,3 +123,3 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

// generators
var kgen = keygen.string(options.namespace, options.set, {prefix: 'test/get/'})
var kgen = keygen.string(helper.namespace, helper.set, {prefix: 'test/get/'})
var mgen = metagen.constant({ttl: 1000})

@@ -140,0 +126,0 @@ var rgen = recgen.record({i: valgen.integer(), s: valgen.string(), b: valgen.bytes()})

@@ -17,29 +17,15 @@ // *****************************************************************************

/* global describe, it, before, after */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../lib/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var status = aerospike.status
var language = aerospike.language
const status = aerospike.status
const language = aerospike.language
describe('client.udfRegister()', function (done) {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
after(function (done) {
client.close()
client = null
done()
})
it('should register an UDF file to aerospike cluster', function (done) {

@@ -46,0 +32,0 @@ var dir = __dirname

@@ -17,22 +17,14 @@ // *****************************************************************************

/* global describe, it, before */
/* global describe, it */
// we want to test the built aerospike module
var aerospike = require('../build/Release/aerospike')
var options = require('./util/options')
var expect = require('expect.js')
const aerospike = require('../build/Release/aerospike')
const helper = require('./test_helper')
const expect = require('expect.js')
var status = aerospike.status
const status = aerospike.status
describe('client.udfRemove()', function (done) {
var config = options.getConfig()
var client = aerospike.client(config)
var client = helper.client
before(function (done) {
client.connect(function (err) {
if (err && err.code !== status.AEROSPIKE_OK) { throw new Error(err.message) }
done()
})
})
it('should remove an UDF module with a info policy from aerospike cluster', function (done) {

@@ -39,0 +31,0 @@ var dir = __dirname

@@ -17,5 +17,5 @@ // *****************************************************************************

var aerospike = require('../../build/Release/aerospike')
var yargs = require('yargs')
var fs = require('fs')
const aerospike = require('../../lib/aerospike')
const yargs = require('yargs')
const fs = require('fs')

@@ -45,3 +45,3 @@ // *****************************************************************************

alias: 't',
default: 100,
default: 1000,
describe: 'Timeout in milliseconds.'

@@ -88,7 +88,8 @@ },

options.getConfig = function () {
var config = {}
config = {
var test_dir = __dirname.split('/').slice(0, -1).join('/')
var config = {
hosts: [{addr: options.host, port: options.port}],
log: {level: options.log, file: options.log_file},
policies: {timeout: options.timeout}
policies: {timeout: options.timeout},
modlua: {userPath: test_dir}
}

@@ -95,0 +96,0 @@ if (options.user !== null) {

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