Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
node-zookeeper - A Node.js client for Apache Zookeeper.
This module is implemented on top of the ZooKeeper C API; consult the ZK Reference for further details on behavior.
Latest changes are described in the changelog
(note the name zookeeper
in lowercase)
npm install zookeeper
Use the async/await
enabled client:
const ZooKeeper = require('zookeeper').Promise;
Note: checkout the API for the async/await enabled client here
There is also a callbacks based client:
const ZooKeeper = require('zookeeper');
Note: checkout the API for the callback based client here
Create an instance of the ZooKeeper client using async/await
:
function createClient(timeoutMs = 5000) {
const config = {
connect: host,
timeout: timeoutMs,
debug_level: ZooKeeper.ZOO_LOG_LEVEL_WARN,
host_order_deterministic: false,
};
return new ZooKeeper(config);
}
const client = createClient();
The client is ready when connected to a ZooKeeper server:
client.on('connect', () => {
// start using the client
});
client.init(config);
Using the API of the async/await
enabled client.
const path = '/myPath';
try {
const createdPath = await client.create(path, data, ZooKeeper.ZOO_EPHEMERAL);
console.log(`(created: ${createdPath})`);
} catch (error) {
console.log(`${path} already exists`);
}
Check out the code in the examples folder: master,workers, tasks and listeners scenarios.
init(options)
connect(options, connect_cb)
close()
path = await create(path, data, flags)
mkdirp(path, callback(Error))
stat = await exists(path, watch)
data = await get(path, watch)
children = await get_children(path, watch)
[children, stat] = await get_children2( path, watch)
stat = await set(path, data, version)
val = await sync(path)
delete_ (path, version)
_
)set_acl(path, version, acl)
acl = await get_acl(path)
add_auth(scheme, auth)
The watcher methods are forward-looking subscriptions that can recieve multiple callbacks whenever a matching event occurs.
stat = await w_exists(path, watch_cb)
data = await w_get(path, watch_cb)
children = await w_get_children(path, watch_cb)
[children, stat] = await w_get_children2 (path, watch_cb)
init(options)
connect(options, connect_cb)
close()
a_create(path, data, flags, path_cb)
mkdirp(path, callback(Error))
a_exists(path, watch, stat_cb)
a_get(path, watch, data_cb)
a_get_children(path, watch, child_cb)
a_get_children2(path, watch, child2_cb)
a_set(path, data, version, stat_cb)
a_sync(path, value_cb)
a_delete_ (path, version, void_cb)
_
)a_set_acl(path, version, acl, void_cb)
a_get_acl(path, acl_cb)
add_auth(scheme, auth)
The watcher methods are forward-looking subscriptions that can recieve multiple callbacks whenever a matching event occurs.
aw_exists(path, watch_cb, stat_cb)
aw_get(path, watch_cb, data_cb)
aw_get_children(path, watch_cb, child_cb)
aw_get_children2(path, watch_cb, child2_cb)
Session state machine is well described in the Zookeeper docs
The library comes with 3 default ACL levels defined (comes from ZK):
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:
For more details please refer to ZooKeeper docs.
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.
Windows support has been enabled mainly for supporting development, not for production.
To run full output during the module build one has to use ZK_INSTALL_VERBOSE
flag.
ZK_INSTALL_VERBOSE=1 npm install
$env:ZK_INSTALL_VERBOSE=1
npm install
This PowerShell command will remove the environment variable:
Remove-Item Env:\ZK_INSTALL_VERBOSE
Check out the issues tab and grab one! Read the contributing document.
See LICENSE-MIT.txt file in the top level folder.
Yuri Finkelstein (yurif2003 at yahoo dot com)
with awesome contributions from:
v 4.4.0 (2019-08-11)
get_children
.npm install
.FAQs
apache zookeeper client (zookeeper async API v3.5.x - v3.8.x)
The npm package zookeeper receives a total of 3,972 weekly downloads. As such, zookeeper popularity was classified as popular.
We found that zookeeper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.