Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
etcd3 aims is a high-quality, production-ready client for the Protocol Buffer-based etcdv3 API. It includes:
and is type-safe for TypeScript consumers.
Install via:
npm install --save etcd3
Start building!
const { Etcd3 } = require('etcd3');
const client = new Etcd3();
(async () => {
await client.put('foo').value('bar');
const fooValue = await client.get('foo').string();
console.log('foo was:', fooValue);
const allFValues = await client.getAll().prefix('f').keys();
console.log('all our keys starting with "f":', allFValues);
await client.delete().all();
})();
Our TypeDoc docs are available here.
Our test cases are also readable.
$ npm install
$ cd src/test/containers/3.2 && docker-compose up # in a separate shell
$ npm test
$ docker-compose down
Running tests for this module requires running an etcd3 server locally. The tests try to use the default port initially, and you can configure this by setting the ETCD_ADDR
environment variable, like export ETCD_ADDR=localhost:12345
.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
1.1.0 2020-11-28
feat: implement elections
Implementation of elections, as seen in etcd's Go client. Elections are most commonly used if you need a single server in charge of a certain task; you run an election on every server where your program is running, and among them they will choose one "leader".
There are two main entrypoints: campaigning via Election.campaign, and observing the leader via Election.observe.
const os = require('os');
const client = new Etcd3();
const election = client.election('singleton-job');
function runCampaign() {
const campaign = election.campaign(os.hostname());
campaign.on('elected', () => {
// This server is now the leader! Let's start doing work
doSomeWork();
});
campaign.on('error', error => {
// An error happened that caused our campaign to fail. If we were the
// leader, make sure to stop doing work (another server is the leader
// now) and create a new campaign.
console.error(error);
stopDoingWork();
setTimeout(runCampaign, 5000);
});
}
async function observeLeader() {
const observer = await election.observe();
console.log('The current leader is', observer.leader());
observer.on('change', leader => console.log('The new leader is', leader));
observer.on('error', () => {
// Something happened that fatally interrupted observation.
setTimeout(observeLeader, 5000);
});
}
Thanks to @yujuiting for their help with the initial implementation. (see #66, #85).
fix: deprecation: watcherBuilder.ignore()
was available for "ignoring" types of events, but it actually did the opposite: it was an include-list, rather than a deny-list. It's deprecated in favor of watchBuilder.only()
fix: buffers not allowed in typings Namespace.get(<key>)
fix: prevent user errors in watcher event listeners from causing backoffs in the underlying stream
FAQs
Node client for etcd3
The npm package etcd3 receives a total of 8,148 weekly downloads. As such, etcd3 popularity was classified as popular.
We found that etcd3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.