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

aerospike - npm Package Compare versions

Comparing version 3.10.0 to 3.11.0

src/main/commands/info_any.cc

12

CHANGELOG.md

@@ -7,2 +7,12 @@ # Changelog

## [3.11.0] - 2019-05-22
* **New Features**
* TLS support - Linux only, macOS & Windows not supported for now. [#298](https://github.com/aerospike/aerospike-client-nodejs/pull/298)
* Add new infoNode & getNodes functions. [#196](https://github.com/aerospike/aerospike-client-nodejs/pull/196)
* Support for Node.js 12 [#295](https://github.com/aerospike/aerospike-client-nodejs/pull/295)
* **Updates**
* Update C client library to [v4.6.3](http://www.aerospike.com/download/client/c/notes.html#4.6.3). [#297](https://github.com/aerospike/aerospike-client-nodejs/pull/297)
## [3.10.0] - 2019-04-08

@@ -17,3 +27,3 @@

* Update C client library to [v4.6.1](http://www.aerospike.com/download/client/c/notes.html#4.6.1).
* Update nan to [v2.12.1](https://github.com/nodejs/nan/blob/master/CHANGELOG.md).
* Update nan to [v2.13.2](https://github.com/nodejs/nan/blob/master/CHANGELOG.md).
* Update mocha, codecov & other dev dependencies to latest version.

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

9

lib/aerospike.js

@@ -229,6 +229,11 @@ // *****************************************************************************

* default.
* @property {number} EXTERNAL - Use external authentication (like LDAP).
* Specific external authentication is configured on server. If TLS is enabled,
* send clear password on node login via TLS. Throws exception, if TLS is not
* enabled.
* @property {number} EXTERNAL_INSECURE - Use external authentication (like
* LDAP). Specific external authentication is configured on server. Send
* clear password on node login whether or not TLS is defined. This mode
* should only be used for testing purposes because it is not secure.
* clear password on node login whether or not TLS is enabled. This mode
* should only be used for testing purposes because it is not secure
* authentication.
*

@@ -235,0 +240,0 @@ * @example <caption>Using external authentication mode, e.g. to use LDAP authentication</caption>

@@ -180,2 +180,26 @@ // *****************************************************************************

/**
* @function Client#getNodes
*
* @summary Returns a list of all cluster nodes known to the client.
*
* @return {Array.<{name: string, address: string}>} List of node objects
*
* @since v2.6.0
*
* @example
*
* const Aerospike = require('aerospike')
* Aerospike.connect((error, client) => {
* if (err) throw err
* console.log(client.getNodes()) // [ { name: 'BB9EB63B2005452', address: '127.0.0.1:3000' },
* // { name: 'C1DEB63B2005452', address: '127.0.0.1:3100' } ]
* client.close()
* })
*
*/
Client.prototype.getNodes = function () {
return this.as_client.getNodes()
}
/**
* @function Client#addSeedHost

@@ -982,2 +1006,4 @@ *

*
* @deprecated since v3.11.0 - use {@link Client#infoNode} or {@link Client#infoAny} instead.
*
* @example <caption>Sending a 'statistics' info query to a single host</caption>

@@ -1003,3 +1029,3 @@ *

let cmd = new Commands.Info(this, [request, host, policy], callback)
let cmd = new Commands.InfoHost(this, [request, host, policy], callback)
return cmd.execute()

@@ -1019,4 +1045,5 @@ }

* @param {InfoPolicy} [policy] - The Info Policy to use for this operation.
* @param {infoCallback} callback - The function to call when an info
* response from a cluster host is received.
* @param {infoCallback} [callback] - The function to call once the node
* returns the response to the info command; if no callback function is
* provided, the method returns a <code>Promise<code> instead.
*

@@ -1047,3 +1074,3 @@ * @see <a href="http://www.aerospike.com/docs/reference/info" title="Info Command Reference">&uArr;Info Command Reference</a>

let cmd = new Commands.Info(this, [request, null, policy], callback)
let cmd = new Commands.InfoAny(this, [request, policy], callback)
return cmd.execute()

@@ -1064,4 +1091,5 @@ }

* @param {InfoPolicy} [policy] - The Info Policy to use for this operation.
* @param {infoAllCallback} callback - The function to call when an info
* response from all cluster hosts is received.
* @param {infoCallback} [callback] - The function to call once all nodes have
* returned a response to the info command; if no callback function is
* provided, the method returns a <code>Promise<code> instead.
*

@@ -1099,2 +1127,40 @@ * @see <a href="http://www.aerospike.com/docs/reference/info" title="Info Command Reference">&uArr;Info Command Reference</a>

/**
* @function Client#infoNode
*
* @summary Sends an info query to a single node in the cluster.
*
* @description The <code>request</code> parameter is a string representing an
* info request. If it is not specified, the cluster host(s) will send all
* available info.
*
* @param {?string} request - The info request to send.
* @param {object} node - The node to send the request to.
* @param {string} node.name - The node name.
* @param {InfoPolicy} [policy] - The Info Policy to use for this operation.
* @param {infoCallback} [callback] - The function to call once the node
* returns the response to the info command; if no callback function is
* provided, the method returns a <code>Promise<code> instead.
*
* @see <a href="http://www.aerospike.com/docs/reference/info" title="Info Command Reference">&uArr;Info Command Reference</a>
*
* @since v3.11.0
*
* @example <caption>Sending 'statistics' info command to specific cluster node</caption>
*
* const node = client.getNodes().pop()
* client.infoNode('statistics', node).then(info => {
* // process info
* })
*/
Client.prototype.infoNode = function (request, node, policy, callback) {
if (typeof policy === 'function') {
callback = policy
policy = null
}
let cmd = new Commands.InfoNode(this, [request, node.name, policy], callback)
return cmd.execute()
}
/**
* @function Client#isConnected

@@ -1101,0 +1167,0 @@ *

@@ -38,4 +38,6 @@ // *****************************************************************************

IndexRemove: class IndexRemoveCommand extends Command('indexRemove') { },
Info: class InfoCommand extends Command('info') { },
InfoAny: class InfoAnyCommand extends Command('infoAny') { },
InfoForeach: class InfoForeachCommand extends Command('infoForeach') { },
InfoHost: class InfoHostCommand extends Command('infoHost') { },
InfoNode: class InfoNodeCommand extends Command('infoNode') { },
JobInfo: class JobInfoCommand extends Command('jobInfo') { },

@@ -42,0 +44,0 @@ Operate: class OperateCommand extends ReadRecordCommand('operateAsync') { },

@@ -126,2 +126,61 @@ // *****************************************************************************

/**
* @name Config#tls
* @summary Configure Transport Layer Security (TLS) parameters for secure
* connections to the database cluster. TLS connections are not supported as
* of Aerospike Server v3.9 and depend on a future server release.
* @type {Object}
* @since v2.4
*
* @property {boolean} [enable=true] - Enable TLS for socket connections to
* cluster nodes. By default TLS is enabled only if the client configuration
* includes a <code>tls</code> section.
* @property {string} [cafile] - Path to a trusted CA certificate file. By
* default TLS will use system standard trusted CA certificates.
* @property {string} [capath] - Path to a directory of trusted certificates.
* See the OpenSSL SSL_CTX_load_verify_locations manual page for more
* information about the format of the directory.
* @property {string} [protocols] - Specifies enabled protocols. The format is
* the same as Apache's SSLProtocol documented at
* https://httpd.apache.org/docs/current/mod/mod_ssl.html#sslprotocol. If not
* specified, the client will use "-all +TLSv1.2". If you are not sure what
* protocols to select this option is best left unspecified.
* @property {string} [cipherSuite] - Specifies enabled cipher suites. The
* format is the same as OpenSSL's Cipher List Format documented at
* https://www.openssl.org/docs/manmaster/apps/ciphers.html. If not specified
* the OpenSSL default cipher suite described in the ciphers documentation
* will be used. If you are not sure what cipher suite to select this option
* is best left unspecified.
* @property {string} [certBlacklist] - Path to a certificate blacklist file.
* The file should contain one line for each blacklisted certificate. Each
* line starts with the certificate serial number expressed in hex. Each
* entry may optionally specify the issuer name of the certificate. (Serial
* numbers are only required to be unique per issuer.) Example records:
* <code><br>867EC87482B2 /C=US/ST=CA/O=Acme/OU=Engineering/CN=Test Chain CA<br>
* E2D4B0E570F9EF8E885C065899886461</code>
* @property {string} [keyfile] - Path to the client's key for mutual
* authentication. By default, mutual authentication is disabled.
* @property {string} [keyfilePassword] - Decryption password for the
* client's key for mutual authentication. By default, the key is assumed
* not to be encrypted.
* @property {string} [certfile] - Path to the client's certificate chain
* file for mutual authentication. By default, mutual authentication is
* disabled.
* @property {boolean} [crlCheck=false] - Enable CRL checking for the
* certificate chain leaf certificate. An error occurs if a suitable CRL
* cannot be found. By default CRL checking is disabled.
* @property {boolean} [crlCheckAll=false] - Enable CRL checking for the
* entire certificate chain. An error occurs if a suitable CRL cannot be
* found. By default CRL checking is disabled.
* @property {boolean} [logSessionInfo=false] - Log session information for
* each connection.
* @property {boolean} [forLoginOnly=false] - Use TLS connections only for login
* authentication. All other communication with the server will be done
* with non-TLS connections. Default: false (Use TLS connections for all
* communication with the server.)
*/
if (typeof config.tls === 'object') {
this.tls = config.tls
}
/**
* @summary List of hosts with which the client should attempt to connect.

@@ -128,0 +187,0 @@ * @description If not specified, the client attempts to read the host list

{
"name": "aerospike",
"version": "3.10.0",
"version": "3.11.0",
"description": "Aerospike Client Library",

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

"minimatch": "^3.0.4",
"nan": "^2.12.1"
"nan": "^2.13.2"
},

@@ -55,3 +55,3 @@ "devDependencies": {

"jsdoc": "^3.5.5",
"mocha": "^6.1.1",
"mocha": "^6.1.4",
"mocha-clean": "^1.0.0",

@@ -62,7 +62,8 @@ "nyc": "^13.3.0",

"tmp": "^0.1",
"yargs": "^1.3.3"
"yargs": "^13.2.2"
},
"standard": {
"ignore": [
"apidocs"
"apidocs",
"tmp-*.js"
]

@@ -69,0 +70,0 @@ },

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

This module is compatible with Node.js v6.x (LTS), v8.x (LTS) and
v10.x (LTS). It supports the following operating systems: CentOS/RHEL 6/7, Debian
This module is compatible with Node.js v6.x, v8.x (LTS), v10.x (LTS), and v12.x
(LTS). It supports the following operating systems: CentOS/RHEL 6/7, Debian
7/8/9, Ubuntu 14.04/16.04/18.04, as well as many Linux destributions compatible

@@ -18,0 +18,0 @@ with one of these OS releases. macOS and Windows are also supported.

@@ -121,2 +121,17 @@ // *****************************************************************************

describe('Client#getNodes', function () {
var client = helper.client
it('returns a list of cluster nodes', function () {
var nodes = client.getNodes()
expect(nodes).to.be.an('array')
expect(nodes.length).to.be.greaterThan(0)
nodes.forEach(function (node) {
expect(node.name).to.match(/^[0-9A-F]{15}$/)
expect(node.address).to.be.a('string')
})
})
})
context('cluster name', function () {

@@ -123,0 +138,0 @@ it('should fail to connect to the cluster if the cluster name does not match', function (done) {

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

let test = function (Aerospike, config, done) {
config = Object.assign(config, { log: { level: Aerospike.log.OFF } })
Aerospike.setupGlobalCommandQueue({ maxCommandsInProcess: 5, maxCommandsInQueue: 5 })

@@ -62,2 +63,3 @@ Aerospike.connect(config)

let test = function (Aerospike, config, done) {
config = Object.assign(config, { log: { level: Aerospike.log.OFF } })
Aerospike.connect(config)

@@ -64,0 +66,0 @@ .then(client => {

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

modlua: { userPath: '/user/path' },
tls: { enable: true, encryptOnly: true },
port: 3333,

@@ -82,2 +83,3 @@ rackAware: true,

expect(config).to.have.property('modlua')
expect(config).to.have.property('tls')
expect(config).to.have.property('port')

@@ -84,0 +86,0 @@ expect(config).to.have.property('policies')

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

const helper = require('./test_helper')
const utils = require('../lib/utils')

@@ -32,6 +33,9 @@ const AerospikeError = Aerospike.AerospikeError

describe('Client#info()', function () {
let node = null
let host = null
before(() => helper.cluster.randomNode()
.then(randomHost => { host = randomHost }))
before(() => {
node = helper.cluster.randomNode()
host = utils.parseHostString(node.address)
})

@@ -47,4 +51,3 @@ it('sends status query to a specific cluster node', function (done) {

it('accepts a string with the host address', function (done) {
let hostAddress = host.addr + ':' + host.port
client.info('status', hostAddress, (error, response) => {
client.info('status', node.address, (error, response) => {
if (error) throw error

@@ -73,2 +76,30 @@ expect(response).to.equal('status\tok\n')

describe('Client#infoNode()', function () {
let node = null
before(() => {
node = helper.cluster.randomNode()
})
it('sends status query to a specific cluster node', function () {
return client.infoNode('status', node)
.then(response => expect(response).to.equal('status\tok\n'))
})
it('fetches all info if no request is passed', function () {
return client.infoNode(null, node)
.then(response => {
expect(response).to.contain('\nversion\t')
expect(response).to.contain('\nedition\t')
})
})
it('should return a client error if the client is not connected', function (done) {
Aerospike.client(helper.config).infoNode('status', node, error => {
expect(error).to.be.instanceof(AerospikeError).with.property('code', Aerospike.status.ERR_CLIENT)
done()
})
})
})
describe('Client#infoAny()', function () {

@@ -75,0 +106,0 @@ it('executes the info command on a single cluster node', function (done) {

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

const Info = require('../lib/info')
const utils = require('../lib/utils')
const options = require('./util/options')

@@ -154,11 +153,5 @@ const semver = require('semver')

ServerInfoHelper.prototype.randomNode = function () {
return client.infoAny('service')
.then(response => {
let service = Info.parse(response).service
if (Array.isArray(service)) {
service = service.pop()
}
let host = utils.parseHostString(service)
return host
})
const nodes = client.getNodes()
const i = Math.floor(Math.random() * nodes.length)
return nodes[i]
}

@@ -165,0 +158,0 @@

@@ -28,3 +28,3 @@ // *****************************************************************************

var parser = yargs
const parser = yargs
.usage('$0 [options]')

@@ -80,7 +80,33 @@ .options({

describe: 'Password to connect to a secure cluster'
},
clusterName: {
describe: 'Name of the cluster to join'
},
cafile: {
describe: 'Path to a trusted CA certificate file'
},
keyfile: {
describe: 'Path to the client\'s key for mutual auth'
},
keyfilePassword: {
describe: 'Decryption password for the client\'s key file'
},
certfile: {
describe: 'Path to the client\'s certificate chain file for mutual auth'
}
})
var options = process.env['OPTIONS'] ? parser.parse(process.env['OPTIONS'].trim().split(' ')) : parser.argv
let options
if (process.env['OPTIONS']) {
options = process.env['OPTIONS'].trim().split(' ')
options = parser.parse(options)
} else {
options = parser.argv
}
if (options.help === true) {
parser.showHelp()
process.exit(0)
}
// enable debug stacktraces

@@ -94,6 +120,6 @@ process.env['AEROSPIKE_DEBUG_STACKTRACES'] = process.env['AEROSPIKE_DEBUG_STACKTRACES'] || true

options.getConfig = function () {
let defaultPolicy = {
const defaultPolicy = {
totalTimeout: options.timeout
}
let config = {
const config = {
log: {

@@ -118,7 +144,13 @@ level: options.log,

}
if (options.host !== null) {
config.hosts = [{ addr: options.host, port: options.port || 3000 }]
const host = {
addr: options.host,
port: options.port || 3000
}
config.hosts = [host]
} else if (process.env['AEROSPIKE_HOSTS']) {
config.hosts = process.env['AEROSPIKE_HOSTS']
}
if (options.user !== null) {

@@ -130,9 +162,20 @@ config.user = options.user

}
if (options.clusterName) {
config.clusterName = options.clusterName
}
if (options.cafile) {
config.tls = {
enable: true,
cafile: options.cafile,
certfile: options.certfile,
keyfile: options.keyfile,
keyfilePassword: options.keyfilePassword
}
}
return config
}
if (options.help === true) {
parser.showHelp()
process.exit(0)
}
module.exports = options

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc