Comparing version 4.4.0 to 4.4.1
@@ -1,2 +0,14 @@ | ||
#### v 4.3.0 (2019-07-30) #### | ||
#### v 4.4.1 (2019-08-22) | ||
* fix: include ZooKeeper source code, instead of downloading on install, pull request [219](https://github.com/yfinkelstein/node-zookeeper/pull/219) | ||
* feat: Integration tests in Docker, pull request [218](https://github.com/yfinkelstein/node-zookeeper/pull/218) by @jbienkowski | ||
* feat: less verbose Windows builds, pull request [217](https://github.com/yfinkelstein/node-zookeeper/pull/217) | ||
* fix: GCC build errors, pull request [215](https://github.com/yfinkelstein/node-zookeeper/pull/215) | ||
* feat: move constants to a separate file, pull request [212](https://github.com/yfinkelstein/node-zookeeper/pull/212) by @jbienkowski | ||
#### v 4.4.0 (2019-08-11) | ||
* fix: typos in the code documentation for async `get_children`. | ||
* fix: retry download the ZooKeeper C Client if failed during `npm install`. | ||
* feature: use v3.5.5 of the ZooKeeper C Client. | ||
#### v 4.3.0 (2019-07-30) | ||
* Refactor all JavaScript code to ECMAScript 2017 and native Promises: pull request [185](https://github.com/yfinkelstein/node-zookeeper/pull/185) by @jbienkowski311 | ||
@@ -9,3 +21,3 @@ * Copy instead of symlink in build process (Windows users can install without admin access): pull request [190](https://github.com/yfinkelstein/node-zookeeper/pull/190) | ||
#### v 4.2.0 (2019-07-16) #### | ||
#### v 4.2.0 (2019-07-16) | ||
* fix: Node.js 12 support | ||
@@ -18,3 +30,3 @@ * fix: V8 and Nan deprecation warnings | ||
#### v 4.1.1 (2019-06-18) #### | ||
#### v 4.1.1 (2019-06-18) | ||
* feat: handle ZNOTHING return code from the ZooKeeper C library | ||
@@ -31,3 +43,3 @@ * fix: README typos | ||
#### v 4.0.3 (2019-04-25) #### | ||
#### v 4.0.3 (2019-04-25) | ||
* chore: added unit tests, mostly asserting the public API. | ||
@@ -37,10 +49,10 @@ * chore: added ESLint and the Airbnb JavaScript style guide. | ||
#### v 4.0.2 (2019-04-13) #### | ||
#### v 4.0.2 (2019-04-13) | ||
* fixed: Windows 7 support (Pull Request by https://github.com/ndxbn) | ||
#### v 4.0.1 (2019-03-10) #### | ||
#### v 4.0.1 (2019-03-10) | ||
* Added docs: changelog, contributing to the project, fixed typos and missing info in the readme file. | ||
#### v 4.0.0 (2019-03-02) #### | ||
#### v 4.0.0 (2019-03-02) | ||
* Added Windows support! A long awaited issue finally solved. | ||
@@ -52,5 +64,5 @@ * __BREAKING__: dropped support for Node.js versions older than version 8. | ||
#### v 3.4.9-4 (2019-01-16) #### | ||
#### v 3.4.9-4 (2019-01-16) | ||
* Fixed npm install fails when using Node version 10. | ||
Details about the release here: [Node.js 10 support](https://github.com/yfinkelstein/node-zookeeper/pull/142) |
/* eslint-disable no-bitwise,no-console */ | ||
const ZooKeeper = require('./lib/zookeeper'); | ||
const { constants, ZooKeeper } = require('./lib/index'); | ||
@@ -22,3 +22,3 @@ function onCreate(client, rc, error, path) { | ||
console.log(`zk session established, id=${client.client_id}`); | ||
client.a_create('/node.js1', 'some value', ZooKeeper.ZOO_SEQUENCE | ZooKeeper.ZOO_EPHEMERAL, onCreate.bind(null, client)); | ||
client.a_create('/node.js1', 'some value', constants.ZOO_SEQUENCE | constants.ZOO_EPHEMERAL, onCreate.bind(null, client)); | ||
} | ||
@@ -29,3 +29,3 @@ | ||
timeout: 200000, | ||
debug_level: ZooKeeper.ZOO_LOG_LEVEL_DEBUG, | ||
debug_level: constants.ZOO_LOG_LEVEL_DEBUG, | ||
host_order_deterministic: false, | ||
@@ -32,0 +32,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
const { createClient, ZooKeeper } = require('./wrapper.js'); | ||
const { constants, createClient } = require('./wrapper.js'); | ||
const notifier = require('./notifier.js'); | ||
@@ -7,3 +7,3 @@ const { createNode, persistentNode } = require('./createnode.js'); | ||
// eslint-disable-next-line no-bitwise | ||
const message = await createNode(client, '/tasks/task-', persistentNode | ZooKeeper.ZOO_SEQUENCE, data); | ||
const message = await createNode(client, '/tasks/task-', persistentNode | constants.ZOO_SEQUENCE, data); | ||
notifier.emit('addTask', message); | ||
@@ -10,0 +10,0 @@ } |
@@ -1,2 +0,2 @@ | ||
const { createClient, ZooKeeper } = require('./wrapper.js'); | ||
const { constants, createClient } = require('./wrapper.js'); | ||
const notifier = require('./notifier.js'); | ||
@@ -13,3 +13,3 @@ const logger = require('./logger.js'); | ||
// eslint-disable-next-line no-bitwise | ||
const createdPath = await client.create(path, '', ZooKeeper.ZOO_EPHEMERAL | ZooKeeper.ZOO_SEQUENCE); | ||
const createdPath = await client.create(path, '', constants.ZOO_EPHEMERAL | constants.ZOO_SEQUENCE); | ||
emit(client, createdPath); | ||
@@ -16,0 +16,0 @@ } catch (error) { |
@@ -1,2 +0,2 @@ | ||
const { createClient, ZooKeeper } = require('./wrapper.js'); | ||
const { constants, createClient } = require('./wrapper.js'); | ||
const notifier = require('./notifier.js'); | ||
@@ -41,3 +41,3 @@ const logger = require('./logger.js'); | ||
try { | ||
await client.create(path, `${clientId}`, ZooKeeper.ZOO_EPHEMERAL); | ||
await client.create(path, `${clientId}`, constants.ZOO_EPHEMERAL); | ||
emit(client, path); | ||
@@ -44,0 +44,0 @@ } catch (error) { |
@@ -1,2 +0,2 @@ | ||
const ZooKeeper = require('../lib/index.js').Promise; | ||
const { constants, Promise: ZooKeeper } = require('../lib/index'); | ||
@@ -13,3 +13,3 @@ const host = process.argv[2] || '127.0.0.1:2181'; | ||
timeout: timeoutMs, | ||
debug_level: ZooKeeper.ZOO_LOG_LEVEL_WARN, | ||
debug_level: constants.ZOO_LOG_LEVEL_WARN, | ||
host_order_deterministic: false, | ||
@@ -22,4 +22,5 @@ }; | ||
module.exports = { | ||
constants, | ||
createClient, | ||
ZooKeeper, | ||
}; |
module.exports = require('./zookeeper'); | ||
module.exports.constants = require('./constants'); | ||
/** @deprecated */ | ||
@@ -4,0 +6,0 @@ module.exports.ZooKeeper = module.exports; |
@@ -424,3 +424,3 @@ // needed to not break the interface | ||
/** @returns {number} 1 */ | ||
/** @deprecated @returns {number} 1 */ | ||
static get ZOO_PERM_READ() { | ||
@@ -430,3 +430,3 @@ return NativeZk.ZOO_PERM_READ; | ||
/** @returns {number} 2 */ | ||
/** @deprecated @returns {number} 2 */ | ||
static get ZOO_PERM_WRITE() { | ||
@@ -436,3 +436,3 @@ return NativeZk.ZOO_PERM_WRITE; | ||
/** @returns {number} 4 */ | ||
/** @deprecated @returns {number} 4 */ | ||
static get ZOO_PERM_CREATE() { | ||
@@ -442,3 +442,3 @@ return NativeZk.ZOO_PERM_CREATE; | ||
/** @returns {number} 8 */ | ||
/** @deprecated @returns {number} 8 */ | ||
static get ZOO_PERM_DELETE() { | ||
@@ -448,3 +448,3 @@ return NativeZk.ZOO_PERM_DELETE; | ||
/** @returns {number} 16 */ | ||
/** @deprecated @returns {number} 16 */ | ||
static get ZOO_PERM_ADMIN() { | ||
@@ -454,3 +454,3 @@ return NativeZk.ZOO_PERM_ADMIN; | ||
/** @returns {number} 31 */ | ||
/** @deprecated @returns {number} 31 */ | ||
static get ZOO_PERM_ALL() { | ||
@@ -460,3 +460,3 @@ return NativeZk.ZOO_PERM_ALL; | ||
/** @returns {number} -112 */ | ||
/** @deprecated @returns {number} -112 */ | ||
static get ZOO_EXPIRED_SESSION_STATE() { | ||
@@ -466,3 +466,3 @@ return NativeZk.ZOO_EXPIRED_SESSION_STATE; | ||
/** @returns {number} -113 */ | ||
/** @deprecated @returns {number} -113 */ | ||
static get ZOO_AUTH_FAILED_STATE() { | ||
@@ -472,3 +472,3 @@ return NativeZk.ZOO_AUTH_FAILED_STATE; | ||
/** @returns {number} 1 */ | ||
/** @deprecated @returns {number} 1 */ | ||
static get ZOO_CONNECTING_STATE() { | ||
@@ -478,3 +478,3 @@ return NativeZk.ZOO_CONNECTING_STATE; | ||
/** @returns {number} 2 */ | ||
/** @deprecated @returns {number} 2 */ | ||
static get ZOO_ASSOCIATING_STATE() { | ||
@@ -484,3 +484,3 @@ return NativeZk.ZOO_ASSOCIATING_STATE; | ||
/** @returns {number} 3 */ | ||
/** @deprecated @returns {number} 3 */ | ||
static get ZOO_CONNECTED_STATE() { | ||
@@ -490,3 +490,3 @@ return NativeZk.ZOO_CONNECTED_STATE; | ||
/** @returns {number} 1 */ | ||
/** @deprecated @returns {number} 1 */ | ||
static get ZOO_LOG_LEVEL_ERROR() { | ||
@@ -496,3 +496,3 @@ return NativeZk.ZOO_LOG_LEVEL_ERROR; | ||
/** @returns {number} 2 */ | ||
/** @deprecated @returns {number} 2 */ | ||
static get ZOO_LOG_LEVEL_WARN() { | ||
@@ -502,3 +502,3 @@ return NativeZk.ZOO_LOG_LEVEL_WARN; | ||
/** @returns {number} 3 */ | ||
/** @deprecated @returns {number} 3 */ | ||
static get ZOO_LOG_LEVEL_INFO() { | ||
@@ -508,3 +508,3 @@ return NativeZk.ZOO_LOG_LEVEL_INFO; | ||
/** @returns {number} 4 */ | ||
/** @deprecated @returns {number} 4 */ | ||
static get ZOO_LOG_LEVEL_DEBUG() { | ||
@@ -514,3 +514,3 @@ return NativeZk.ZOO_LOG_LEVEL_DEBUG; | ||
/** @returns {number} 1 */ | ||
/** @deprecated @returns {number} 1 */ | ||
static get ZOO_EPHEMERAL() { | ||
@@ -520,3 +520,3 @@ return NativeZk.ZOO_EPHEMERAL; | ||
/** @returns {number} 2 */ | ||
/** @deprecated @returns {number} 2 */ | ||
static get ZOO_SEQUENCE() { | ||
@@ -526,3 +526,3 @@ return NativeZk.ZOO_SEQUENCE; | ||
/** @returns {number} 0 */ | ||
/** @deprecated @returns {number} 0 */ | ||
static get ZOK() { | ||
@@ -532,3 +532,3 @@ return NativeZk.ZOK; | ||
/** @returns {number} -1 */ | ||
/** @deprecated @returns {number} -1 */ | ||
static get ZSYSTEMERROR() { | ||
@@ -538,3 +538,3 @@ return NativeZk.ZSYSTEMERROR; | ||
/** @returns {number} -2 */ | ||
/** @deprecated @returns {number} -2 */ | ||
static get ZRUNTIMEINCONSISTENCY() { | ||
@@ -544,3 +544,3 @@ return NativeZk.ZRUNTIMEINCONSISTENCY; | ||
/** @returns {number} -3 */ | ||
/** @deprecated @returns {number} -3 */ | ||
static get ZDATAINCONSISTENCY() { | ||
@@ -550,3 +550,3 @@ return NativeZk.ZDATAINCONSISTENCY; | ||
/** @returns {number} -4 */ | ||
/** @deprecated @returns {number} -4 */ | ||
static get ZCONNECTIONLOSS() { | ||
@@ -556,3 +556,3 @@ return NativeZk.ZCONNECTIONLOSS; | ||
/** @returns {number} -5 */ | ||
/** @deprecated @returns {number} -5 */ | ||
static get ZMARSHALLINGERROR() { | ||
@@ -562,3 +562,3 @@ return NativeZk.ZMARSHALLINGERROR; | ||
/** @returns {number} -6 */ | ||
/** @deprecated @returns {number} -6 */ | ||
static get ZUNIMPLEMENTED() { | ||
@@ -568,3 +568,3 @@ return NativeZk.ZUNIMPLEMENTED; | ||
/** @returns {number} -7 */ | ||
/** @deprecated @returns {number} -7 */ | ||
static get ZOPERATIONTIMEOUT() { | ||
@@ -574,3 +574,3 @@ return NativeZk.ZOPERATIONTIMEOUT; | ||
/** @returns {number} -8 */ | ||
/** @deprecated @returns {number} -8 */ | ||
static get ZBADARGUMENTS() { | ||
@@ -580,3 +580,3 @@ return NativeZk.ZBADARGUMENTS; | ||
/** @returns {number} -9 */ | ||
/** @deprecated @returns {number} -9 */ | ||
static get ZINVALIDSTATE() { | ||
@@ -586,3 +586,3 @@ return NativeZk.ZINVALIDSTATE; | ||
/** @returns {number} -100 */ | ||
/** @deprecated @returns {number} -100 */ | ||
static get ZAPIERROR() { | ||
@@ -592,3 +592,3 @@ return NativeZk.ZAPIERROR; | ||
/** @returns {number} -101 */ | ||
/** @deprecated @returns {number} -101 */ | ||
static get ZNONODE() { | ||
@@ -598,3 +598,3 @@ return NativeZk.ZNONODE; | ||
/** @returns {number} -102 */ | ||
/** @deprecated @returns {number} -102 */ | ||
static get ZNOAUTH() { | ||
@@ -604,3 +604,3 @@ return NativeZk.ZNOAUTH; | ||
/** @returns {number} -103 */ | ||
/** @deprecated @returns {number} -103 */ | ||
static get ZBADVERSION() { | ||
@@ -610,3 +610,3 @@ return NativeZk.ZBADVERSION; | ||
/** @returns {number} -108 */ | ||
/** @deprecated @returns {number} -108 */ | ||
static get ZNOCHILDRENFOREPHEMERALS() { | ||
@@ -616,3 +616,3 @@ return NativeZk.ZNOCHILDRENFOREPHEMERALS; | ||
/** @returns {number} -110 */ | ||
/** @deprecated @returns {number} -110 */ | ||
static get ZNODEEXISTS() { | ||
@@ -622,3 +622,3 @@ return NativeZk.ZNODEEXISTS; | ||
/** @returns {number} -111 */ | ||
/** @deprecated @returns {number} -111 */ | ||
static get ZNOTEMPTY() { | ||
@@ -628,3 +628,3 @@ return NativeZk.ZNOTEMPTY; | ||
/** @returns {number} -112 */ | ||
/** @deprecated @returns {number} -112 */ | ||
static get ZSESSIONEXPIRED() { | ||
@@ -634,3 +634,3 @@ return NativeZk.ZSESSIONEXPIRED; | ||
/** @returns {number} -113 */ | ||
/** @deprecated @returns {number} -113 */ | ||
static get ZINVALIDCALLBACK() { | ||
@@ -640,3 +640,3 @@ return NativeZk.ZINVALIDCALLBACK; | ||
/** @returns {number} -114 */ | ||
/** @deprecated @returns {number} -114 */ | ||
static get ZINVALIDACL() { | ||
@@ -646,3 +646,3 @@ return NativeZk.ZINVALIDACL; | ||
/** @returns {number} -115 */ | ||
/** @deprecated @returns {number} -115 */ | ||
static get ZAUTHFAILED() { | ||
@@ -652,3 +652,3 @@ return NativeZk.ZAUTHFAILED; | ||
/** @returns {number} -116 */ | ||
/** @deprecated @returns {number} -116 */ | ||
static get ZCLOSING() { | ||
@@ -658,3 +658,3 @@ return NativeZk.ZCLOSING; | ||
/** @returns {number} -117 */ | ||
/** @deprecated @returns {number} -117 */ | ||
static get ZNOTHING() { | ||
@@ -664,3 +664,3 @@ return NativeZk.ZNOTHING; | ||
/** @returns {number} -118 */ | ||
/** @deprecated @returns {number} -118 */ | ||
static get ZSESSIONMOVED() { | ||
@@ -670,3 +670,3 @@ return NativeZk.ZSESSIONMOVED; | ||
/** @returns {{perms:number, scheme:string, auth:string}} */ | ||
/** @deprecated @returns {{perms:number, scheme:string, auth:string}} */ | ||
static get ZOO_OPEN_ACL_UNSAFE() { | ||
@@ -676,3 +676,3 @@ return NativeZk.ZOO_OPEN_ACL_UNSAFE; | ||
/** @returns {{perms:number, scheme:string, auth:string}} */ | ||
/** @deprecated @returns {{perms:number, scheme:string, auth:string}} */ | ||
static get ZOO_READ_ACL_UNSAFE() { | ||
@@ -682,3 +682,3 @@ return NativeZk.ZOO_READ_ACL_UNSAFE; | ||
/** @returns {{perms:number, scheme:string, auth:string}} */ | ||
/** @deprecated @returns {{perms:number, scheme:string, auth:string}} */ | ||
static get ZOO_CREATOR_ALL_ACL() { | ||
@@ -688,3 +688,3 @@ return NativeZk.ZOO_CREATOR_ALL_ACL; | ||
/** @returns {number} 1 */ | ||
/** @deprecated @returns {number} 1 */ | ||
static get ZOO_CREATED_EVENT() { | ||
@@ -694,3 +694,3 @@ return NativeZk.ZOO_CREATED_EVENT; | ||
/** @returns {number} 2 */ | ||
/** @deprecated @returns {number} 2 */ | ||
static get ZOO_DELETED_EVENT() { | ||
@@ -700,3 +700,3 @@ return NativeZk.ZOO_DELETED_EVENT; | ||
/** @returns {number} 3 */ | ||
/** @deprecated @returns {number} 3 */ | ||
static get ZOO_CHANGED_EVENT() { | ||
@@ -706,3 +706,3 @@ return NativeZk.ZOO_CHANGED_EVENT; | ||
/** @returns {number} 4 */ | ||
/** @deprecated @returns {number} 4 */ | ||
static get ZOO_CHILD_EVENT() { | ||
@@ -712,3 +712,3 @@ return NativeZk.ZOO_CHILD_EVENT; | ||
/** @returns {number} -1 */ | ||
/** @deprecated @returns {number} -1 */ | ||
static get ZOO_SESSION_EVENT() { | ||
@@ -718,3 +718,3 @@ return NativeZk.ZOO_SESSION_EVENT; | ||
/** @returns {number} -2 */ | ||
/** @deprecated @returns {number} -2 */ | ||
static get ZOO_NOTWATCHING_EVENT() { | ||
@@ -724,3 +724,3 @@ return NativeZk.ZOO_NOTWATCHING_EVENT; | ||
/** @returns {number} 1 */ | ||
/** @deprecated @returns {number} 1 */ | ||
static get ZOOKEEPER_WRITE() { | ||
@@ -730,3 +730,3 @@ return NativeZk.ZOOKEEPER_WRITE; | ||
/** @returns {number} 2 */ | ||
/** @deprecated @returns {number} 2 */ | ||
static get ZOOKEEPER_READ() { | ||
@@ -733,0 +733,0 @@ return NativeZk.ZOOKEEPER_READ; |
{ | ||
"name": "zookeeper", | ||
"description": "apache zookeeper client (zookeeper async API v3.4.x - v3.5.x)", | ||
"version": "4.4.0", | ||
"version": "4.4.1", | ||
"author": "Yuri Finkelstein <yurif2003@yahoo.com>", | ||
@@ -17,3 +17,4 @@ "license": "MIT", | ||
"Roy Cheng <roy.b.cheng@newegg.com>", | ||
"David Vujic (https://github.com/DavidVujic)" | ||
"David Vujic (https://github.com/DavidVujic)", | ||
"Jakub Bienkowski (https://github.com/jbienkowski311)" | ||
], | ||
@@ -51,8 +52,8 @@ "repository": { | ||
"build": "node-gyp configure build", | ||
"build-components": "node-gyp configure build --directory=tests_components", | ||
"build-components": "node-gyp configure build --directory=tests/components", | ||
"install": "node ./scripts/prepublish.js && npm run build", | ||
"lint": "eslint .", | ||
"integrationtest": "/usr/bin/env bash -c 'pushd tests_integration; source ./test; popd'", | ||
"test": "npm run lint && tape ./tests/**/*.js | tap-spec", | ||
"test-components": "npm run build-components && tape ./tests_components/**/*.js | tap-spec" | ||
"test": "npm run lint && tape ./tests/unit/**/*.js | tap-spec", | ||
"test-components": "npm run build-components && tape ./tests/components/**/*.js | tap-spec", | ||
"test-integration": "node ./tests/integration/index" | ||
}, | ||
@@ -59,0 +60,0 @@ "engines": { |
197
README.md
@@ -1,3 +0,5 @@ | ||
# Overview | ||
# node-zookeeper | ||
## Overview | ||
_node-zookeeper - A Node.js client for Apache Zookeeper._ | ||
@@ -9,4 +11,6 @@ | ||
## Installation ## | ||
## Installation | ||
(note the name `zookeeper` in lowercase) | ||
```bash | ||
@@ -16,18 +20,24 @@ npm install zookeeper | ||
# Examples # | ||
## Examples | ||
Use the `async/await` enabled client: | ||
```javascript | ||
const ZooKeeper = require('zookeeper').Promise; | ||
``` | ||
Note: checkout the API for the [async/await enabled client here](#methods-asyncawait-enabled-client) | ||
There is also a callbacks based client: | ||
```javascript | ||
const ZooKeeper = require('zookeeper'); | ||
``` | ||
Note: checkout the API for the [callback based client here](#methods-callbacks-based-client) | ||
#### Example: create a client #### | ||
### Example: create a client | ||
Create an instance of the ZooKeeper client using `async/await`: | ||
```javascript | ||
@@ -47,3 +57,5 @@ function createClient(timeoutMs = 5000) { | ||
``` | ||
The client is ready when connected to a ZooKeeper server: | ||
```javascript | ||
@@ -57,4 +69,6 @@ client.on('connect', () => { | ||
#### Example: create a node #### | ||
### Example: create a node | ||
Using the API of the `async/await` enabled client. | ||
```javascript | ||
@@ -70,9 +84,10 @@ const path = '/myPath'; | ||
## More examples ## | ||
Check out the code in the [examples](./examples) folder: master,workers, tasks and listeners scenarios. | ||
### More examples | ||
# API Reference # | ||
Check out the code in the [examples](./examples) folder: master,workers, tasks and listeners scenarios. | ||
### Methods: async/await enabled client ### | ||
## API Reference | ||
### Methods: async/await enabled client | ||
* `init(options)` | ||
@@ -93,3 +108,3 @@ * `connect(options, connect_cb)` | ||
* `delete_ (path, version)` | ||
* (note the trailing `_`) | ||
* (note the trailing `_`) | ||
* `set_acl(path, version, acl)` | ||
@@ -109,3 +124,3 @@ * `acl = await get_acl(path)` | ||
### Methods: callbacks based client ### | ||
### Methods: callbacks based client | ||
@@ -124,3 +139,3 @@ * `init(options)` | ||
* `a_delete_ (path, version, void_cb)` | ||
* (note the trailing `_`) | ||
* (note the trailing `_`) | ||
* `a_set_acl(path, version, acl, void_cb)` | ||
@@ -130,3 +145,2 @@ * `a_get_acl(path, acl_cb)` | ||
*The watcher methods are forward-looking subscriptions that can recieve multiple callbacks whenever a matching event occurs.* | ||
@@ -139,59 +153,60 @@ | ||
### Callback Signatures ### | ||
### Callback Signatures | ||
* path_cb : function(rc, error, path) | ||
* stat_cb : function(rc, error, stat) | ||
* data_cb : function(rc, error, stat, data) | ||
* child_cb : function(rc, error, children) | ||
* child2_cb : function(rc, error, children, stat) | ||
* value_cb : function(rc, error, value) | ||
* void_cb : function(rc, error) | ||
* watch_cb : function(type, state, path) | ||
* acl_cb : function(rc, error, acl, stat) | ||
* connect_cb: function(err, zookeeper) | ||
* path_cb : function(rc, error, path) | ||
* stat_cb : function(rc, error, stat) | ||
* data_cb : function(rc, error, stat, data) | ||
* child_cb : function(rc, error, children) | ||
* child2_cb : function(rc, error, children, stat) | ||
* value_cb : function(rc, error, value) | ||
* void_cb : function(rc, error) | ||
* watch_cb : function(type, state, path) | ||
* acl_cb : function(rc, error, acl, stat) | ||
* connect_cb: function(err, zookeeper) | ||
### Input Parameters ### | ||
### Input Parameters | ||
* options : object. valid keys: { connect, timeout, debug_level, host_order_deterministic, data_as_buffer} | ||
* path : string | ||
* data : string or Buffer | ||
* flags : int32 | ||
* version : int32 | ||
* watch : boolean | ||
* scheme : authorisation scheme (digest, auth) | ||
* auth : authorisation credentials (username:password) | ||
* acl : acls list (same as output parameter, look below) - read only | ||
* options : object. valid keys: { connect, timeout, debug_level, host_order_deterministic, data_as_buffer} | ||
* path : string | ||
* data : string or Buffer | ||
* flags : int32 | ||
* version : int32 | ||
* watch : boolean | ||
* scheme : authorisation scheme (digest, auth) | ||
* auth : authorisation credentials (username:password) | ||
* acl : acls list (same as output parameter, look below) - read only | ||
### Output Parameters ### | ||
### Output Parameters | ||
* path is a string | ||
* data is either a Buffer (default), or a string (this is controlled by data_as_buffer = true/false) | ||
* children is an array of strings | ||
* rc is an int (error codes from zk api) | ||
* error is a string (error string from zk api) | ||
* type is an int event type (from zk api) | ||
* state is an int (state when the watcher fired from zk api) | ||
* stat is an object with the following attributes: | ||
* long czxid // created zxid | ||
* long mzxid // last modified zxid | ||
* long ctime // created | ||
* long mtime // last modified | ||
* int version // version | ||
* int cversion // child version | ||
* int aversion // acl version | ||
* string ephemeralOwner // owner session id if ephemeral, 0 otw | ||
* int dataLength // length of the data in the node | ||
* int numChildren // number of children of this node | ||
* long pzxid // last modified children | ||
* acl is an array of acls objects, single acl object has following key | ||
* int perms // permisions | ||
* string scheme // authorisation scheme (digest, auth) | ||
* string auth // authorisation credentials (username:hashed_password) | ||
* zookeeper is the ZooKeeper instance on which connect was called | ||
* path is a string | ||
* data is either a Buffer (default), or a string (this is controlled by data_as_buffer = true/false) | ||
* children is an array of strings | ||
* rc is an int (error codes from zk api) | ||
* error is a string (error string from zk api) | ||
* type is an int event type (from zk api) | ||
* state is an int (state when the watcher fired from zk api) | ||
* stat is an object with the following attributes: | ||
* long czxid // created zxid | ||
* long mzxid // last modified zxid | ||
* long ctime // created | ||
* long mtime // last modified | ||
* int version // version | ||
* int cversion // child version | ||
* int aversion // acl version | ||
* string ephemeralOwner // owner session id if ephemeral, 0 otw | ||
* int dataLength // length of the data in the node | ||
* int numChildren // number of children of this node | ||
* long pzxid // last modified children | ||
* acl is an array of acls objects, single acl object has following key | ||
* int perms // permisions | ||
* string scheme // authorisation scheme (digest, auth) | ||
* string auth // authorisation credentials (username:hashed_password) | ||
* zookeeper is the ZooKeeper instance on which connect was called | ||
Session state machine is well described in the [Zookeeper docs](http://zookeeper.apache.org/doc/r3.5.5/zookeeperProgrammers.html#ch_zkSessions) | ||
Session state machine is well described in the [Zookeeper docs](http://zookeeper.apache.org/doc/r3.4.14/zookeeperProgrammers.html#ch_zkSessions) | ||
### ACL and authorisation | ||
### ACL and authorisation ### | ||
The library comes with 3 default ACL levels defined (comes from ZK): | ||
* ZooKeeper.ZOO_OPEN_ACL_UNSAFE - anyone can do anything | ||
@@ -202,2 +217,3 @@ * ZooKeeper.ZOO_READ_ACL_UNSAFE - anyone can read | ||
If you don't want to use predefined ACLs you can define your own (the ACL object is described above), for limiting permisions you can use: | ||
* ZooKeeper.ZOO_PERM_READ - read permission | ||
@@ -212,5 +228,6 @@ * ZooKeeper.ZOO_PERM_WRITE - write permission | ||
# Windows support # | ||
Install `CMake` to build a ZooKeeper client on Windows. `Python 2.7.x` is currently required by the tool `node-gyp` to build the ZooKeeper client as a native Node.js Addon. | ||
## Windows support | ||
Install `CMake` to build a ZooKeeper client on Windows. `Python 2.7.x` is currently required by the tool `node-gyp` to build the ZooKeeper client as a native Node.js Addon. | ||
Also, run `npm install` in a Powershell window. For further instructions visit [node-gyp documentation](https://github.com/nodejs/node-gyp/#on-windows). | ||
@@ -220,3 +237,3 @@ | ||
# Development # | ||
## Development | ||
@@ -227,8 +244,11 @@ To run full output during the module build one has to use `ZK_INSTALL_VERBOSE` flag. | ||
##### For Windows (PowerShell): verbose build ##### | ||
### For Windows (PowerShell): verbose build | ||
```bash | ||
$env:ZK_INSTALL_VERBOSE=1 | ||
$env:ZK_INSTALL_VERBOSE=1 | ||
npm install | ||
``` | ||
This PowerShell command will remove the environment variable: | ||
```bash | ||
@@ -238,3 +258,4 @@ Remove-Item Env:\ZK_INSTALL_VERBOSE | ||
# Implementation Notes # | ||
## Implementation Notes | ||
* Zookeeper C API library comes in 2 flavours: single-threaded and multi-threaded. For node.js, single-threaded library provides the most sense since all events coming from ZK responses have to be dispatched to the main JS thread. | ||
@@ -246,23 +267,26 @@ * The C++ code uses the same logging facility that ZK C API uses internally. Hence zk_log.h file checked into this project. The file is considered ZK internal and is not installed into /usr/local/include | ||
# Known Bugs & Issues # | ||
- The lib will segfault if you try to use a ZooKeeper intance after the on_closed event is delivered (possibly as a result of session timeout etc.) YOU MAY NOT re-use the closed ZooKeeper instance. You should allocate a new one and initialize it as a completely new client. Any and all watchers from your first instance are lost, though they may fire (before the on_close) see below. | ||
- Any established watches may/will be fired once each when/if your client is expired by the ZK server, the input arguments are observed to be: type=-1, state=1, path="". Care should be taken to handle this differently than a "real" watch event if that matters to your application. | ||
## Known Bugs & Issues | ||
# Contribute to the project # | ||
* The lib will segfault if you try to use a ZooKeeper intance after the on_closed event is delivered (possibly as a result of session timeout etc.) YOU MAY NOT re-use the closed ZooKeeper instance. You should allocate a new one and initialize it as a completely new client. Any and all watchers from your first instance are lost, though they may fire (before the on_close) see below. | ||
* Any established watches may/will be fired once each when/if your client is expired by the ZK server, the input arguments are observed to be: type=-1, state=1, path="". Care should be taken to handle this differently than a "real" watch event if that matters to your application. | ||
## Contribute to the project | ||
Check out the issues tab and grab one! Read the [contributing](./CONTRIBUTING.md) document. | ||
# See Also # | ||
## See Also | ||
- [http://zookeeper.apache.org/releases.html](http://zookeeper.apache.org/releases.html) | ||
- [http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ZooKeeper+C+client+API](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ZooKeeper+C+client+API) | ||
* [http://zookeeper.apache.org/releases.html](http://zookeeper.apache.org/releases.html) | ||
* [http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ZooKeeper+C+client+API](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ZooKeeper+C+client+API) | ||
# Acknowledgments # | ||
## Acknowledgments | ||
- **[node-webworker](http://github.com/pgriess/node-webworker "node-webworker") by pgriess** is used to spawn multiple ZK workers in one of the tests. | ||
* [Apache ZooKeeper ™](http://zookeeper.apache.org/) source code is included in this repository. An open source volunteer project under the Apache Software Foundation. | ||
* **[node-webworker](http://github.com/pgriess/node-webworker "node-webworker") by pgriess** is used to spawn multiple ZK workers in one of the tests. | ||
# LICENSE # | ||
## LICENSE | ||
See [LICENSE-MIT.txt](./LICENSE-MIT.txt) file in the top level folder. | ||
# ORIGINAL AUTHOR # | ||
## ORIGINAL AUTHOR | ||
@@ -273,9 +297,10 @@ Yuri Finkelstein (yurif2003 at yahoo dot com) | ||
- Woody Anderson (Woodya) | ||
- Dave Dopson (ddopson) | ||
- Ryan Phillips (rphillips) | ||
- David Trejo (DTrejo) | ||
- Mark Cavage (mcavage) | ||
- Jakub Lekstan (kuebk) | ||
- Matt Lavin (mdlavin) | ||
- David Vujic (davidvujic) | ||
* Woody Anderson (Woodya) | ||
* Dave Dopson (ddopson) | ||
* Ryan Phillips (rphillips) | ||
* David Trejo (DTrejo) | ||
* Mark Cavage (mcavage) | ||
* Jakub Lekstan (kuebk) | ||
* Matt Lavin (mdlavin) | ||
* David Vujic (davidvujic) | ||
* Jakub Bieńkowski (jbienkowski311) |
@@ -29,3 +29,5 @@ const shell = require('shelljs'); | ||
shell.config.fatal = true; | ||
shell.config.verbose = true; | ||
if (env.isVerbose) { | ||
shell.config.verbose = true; | ||
} | ||
@@ -35,8 +37,16 @@ shell.cd(`${env.sourceFolder}`); | ||
if (env.isWindows) { | ||
exec(`cmake -DWANT_SYNCAPI=OFF -DCMAKE_GENERATOR_PLATFORM=${process.arch} .`); | ||
exec('cmake --build .'); | ||
let flags = '-DWANT_SYNCAPI=OFF '; | ||
let output = ''; | ||
if (!env.isVerbose) { | ||
flags = ''; | ||
output = ' > NUL'; | ||
} | ||
exec(`cmake ${flags}-DCMAKE_GENERATOR_PLATFORM=${process.arch} .${output}`); | ||
exec(`cmake --build .${output}`); | ||
} else { | ||
let configureCmd = './configure --without-syncapi --disable-shared --with-pic --without-cppunit'; | ||
const flags = '-w'; | ||
let configureCmd = `./configure CFLAGS='${flags}' --without-syncapi --disable-shared --with-pic --without-cppunit`; | ||
let makeCmd = 'make'; | ||
if (!process.env.ZK_INSTALL_VERBOSE) { | ||
if (!env.isVerbose) { | ||
configureCmd += ' --enable-silent-rules --quiet'; | ||
@@ -43,0 +53,0 @@ makeCmd += ' --no-print-directory --quiet'; |
@@ -31,3 +31,3 @@ const fs = require('fs'); | ||
if (fs.existsSync(destination)) { | ||
shell.echo(`${destination} already exists. Skipping download.`); | ||
shell.echo(`${destination} exists.`); | ||
@@ -34,0 +34,0 @@ return Promise.resolve(); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4106139
83
2916
290
3
9