aerospike
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,9 @@ | ||
v3.0.1 / 2017-10-06 | ||
=================== | ||
* **Bug Fixes** | ||
* Fixed typo: Aerospike.ttl.DONT_UPDDATE [#222](https://github.com/aerospike/aerospike-client-nodejs/issues/222) | ||
* Return parameter error if ttl or gen meta-data values are invalid [#223](https://github.com/aerospike/aerospike-client-nodejs/issues/223) | ||
* Call Client#connect callback asynchronously [#224](https://github.com/aerospike/aerospike-client-nodejs/issues/224) | ||
v3.0.0 / 2017-10-03 | ||
@@ -147,3 +155,3 @@ =================== | ||
* Support new peers info protocol; requires Aerospike Server v3.10 or later. | ||
* Support TLS 1.2 secure socket protocol; requires future Aerospike Server release. | ||
* ~~Support TLS 1.2 secure socket protocol; requires future Aerospike Server release.~~ | ||
* New [Client#infoAny](http://www.aerospike.com/apidocs/nodejs/Client.html#infoAny) | ||
@@ -150,0 +158,0 @@ command to send info request to single cluster node. |
@@ -496,3 +496,3 @@ // ***************************************************************************** | ||
} | ||
callback(err, this) | ||
process.nextTick(callback, err, this) | ||
}) | ||
@@ -499,0 +499,0 @@ } else { |
{ | ||
"name": "aerospike", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Aerospike Client Library", | ||
"tags": [ | ||
"keywords": [ | ||
"aerospike", | ||
@@ -7,0 +7,0 @@ "database", |
@@ -35,12 +35,7 @@ # Aerospike Node.js Client [![travis][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] | ||
The following is very simple example of how to write and read a record from Aerospike. | ||
The following is very simple example how to create, update, read and remove a | ||
record using the Aerospike database. | ||
```js | ||
const Aerospike = require('aerospike') | ||
const op = Aerospike.operations | ||
const lists = Aerospike.lists | ||
const maps = Aerospike.maps | ||
const Key = Aerospike.Key | ||
const Double = Aerospike.Double | ||
const GeoJSON = Aerospike.GeoJSON | ||
@@ -50,3 +45,3 @@ let config = { | ||
} | ||
let key = new Key('test', 'demo', 'demo') | ||
let key = new Aerospike.Key('test', 'demo', 'demo') | ||
@@ -59,4 +54,4 @@ Aerospike.connect(config) | ||
b: Buffer.from('world'), | ||
d: new Double(3.1415), | ||
g: new GeoJSON({type: 'Point', coordinates: [103.913, 1.308]}), | ||
d: new Aerospike.Double(3.1415), | ||
g: new Aerospike.GeoJSON({type: 'Point', coordinates: [103.913, 1.308]}), | ||
l: [1, 'a', {x: 'y'}], | ||
@@ -73,6 +68,6 @@ m: {foo: 4, bar: 7} | ||
let ops = [ | ||
op.incr('i', 1), | ||
op.read('i'), | ||
lists.append('l', 'z'), | ||
maps.removeByKey('m', 'bar') | ||
Aerospike.operations.incr('i', 1), | ||
Aerospike.operations.read('i'), | ||
Aerospike.lists.append('l', 'z'), | ||
Aerospike.maps.removeByKey('m', 'bar') | ||
] | ||
@@ -95,7 +90,7 @@ | ||
// m: { foo: 4 } } | ||
client.close() | ||
}) | ||
.then(() => client.close()) | ||
.catch(error => { | ||
console.error(error) | ||
client.close() | ||
return Promise.reject(error) | ||
}) | ||
@@ -102,0 +97,0 @@ }) |
@@ -27,3 +27,33 @@ // ***************************************************************************** | ||
describe('Client', function () { | ||
describe('Client#isConnected', function () { | ||
describe('#connect', function () { | ||
it('return self', function () { | ||
const client = new Client(helper.config) | ||
return client.connect() | ||
.then(client2 => { | ||
expect(client2).to.equal(client) | ||
client.close() | ||
}) | ||
}) | ||
it('should call the callback asynchronously', function (done) { | ||
const client = new Client(helper.config) | ||
let async = false | ||
client.connect(error => { | ||
if (error) throw error | ||
expect(async).to.equal(true) | ||
client.close(false) | ||
done() | ||
}) | ||
async = true | ||
}) | ||
it('should return a Promise if callback without callback', function () { | ||
const client = new Client(helper.config) | ||
const promise = client.connect() | ||
expect(promise).to.be.a(Promise) | ||
return promise.then(() => client.close(false)) | ||
}) | ||
}) | ||
describe('#isConnected', function () { | ||
context('without tender health check', function () { | ||
@@ -85,9 +115,2 @@ it('returns false if the client is not connected', function () { | ||
context('callbacks', function () { | ||
it.skip('should raise an error when calling a command without passing a callback function', function () { | ||
expect(function () { helper.client.truncate('foo', 'bar') }).to.throwException(function (e) { | ||
expect(e).to.be.a(TypeError) | ||
expect(e.message).to.be('"callback" argument must be a function') | ||
}) | ||
}) | ||
// Execute a client command on a client instance that has been setup to | ||
@@ -139,3 +162,3 @@ // trigger an error; check that the error callback occurs asynchronously, | ||
describe('Client#captureStackTraces', function () { | ||
describe('#captureStackTraces', function () { | ||
it('should capture stack traces that show the command being called', function (done) { | ||
@@ -142,0 +165,0 @@ var client = helper.client |
@@ -361,2 +361,28 @@ // ***************************************************************************** | ||
it('should fail with a parameter error if gen is invalid', function (done) { | ||
const key = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})() | ||
const bins = recgen.record({i: valgen.integer(), s: valgen.string()})() | ||
const meta = { | ||
gen: 'generation1' | ||
} | ||
client.put(key, bins, meta, error => { | ||
expect(error.code).to.equal(Aerospike.status.ERR_PARAM) | ||
done() | ||
}) | ||
}) | ||
it('should fail with a parameter error if ttl is invalid', function (done) { | ||
const key = keygen.string(helper.namespace, helper.set, {prefix: 'test/put/'})() | ||
const bins = recgen.record({i: valgen.integer(), s: valgen.string()})() | ||
const meta = { | ||
ttl: 'time-to-live' | ||
} | ||
client.put(key, bins, meta, error => { | ||
expect(error.code).to.equal(Aerospike.status.ERR_PARAM) | ||
done() | ||
}) | ||
}) | ||
it('should write null for bins with empty list and map', function (done) { | ||
@@ -363,0 +389,0 @@ // generators |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1118632
206
19568
386