πŸ”– Node.js client for etcd3
ΠŸΠ΅Ρ€Π΅ΠΉΡ‚ΠΈ ΠΊ Ρ„Π°ΠΉΠ»Ρƒ
Artur Malchanau eb99050058
fix: a race condition in Host.resetAllServices (#182)
Fix a race condition in Host.resetAllServices() caused by calling
channel.close() as a callback of grpc.Client.waitForReady().

The root cause is gRPC subchannel pool state could become into
invalid state when global subchannel pool state is used, and there are
multiple channels used the same subchannel from the pool.

Closing the channel inside of waitForReady callback prevent all the
remaining callbacks for the subchannel from the correct state transition
handling.

Closing the channel inside of waitForReady callback prevents
the subchannel's remaining callbacks from the correct state transition handling.

The fix is to use setImmediate to allow the remaining callbacks for the
subchannel to process the state transition.
2023-07-28 10:12:09 -07:00
.github/workflows bump min node versions 2023-07-28 10:11:10 -07:00
.vscode feat: allow passing a set of default CallOptions in new Etcd3() 2020-09-19 12:38:13 -07:00
bin feat: allow passing a set of default CallOptions in new Etcd3() 2020-09-19 12:38:13 -07:00
docs docs: elections 2020-11-28 20:10:17 -08:00
proto feat: apply update grpc module 2020-06-15 22:22:12 -07:00
src fix: a race condition in Host.resetAllServices (#182) 2023-07-28 10:12:09 -07:00
.eslintrc.js fix: don't include the deadline in inherited lease call options 2020-09-18 20:46:53 -07:00
.gitignore chore: update dependencies, modernize build, drop node 8 support 2020-06-15 21:38:24 -07:00
.mocharc.js chore: use github actions for ts rather than travis 2020-06-15 21:59:21 -07:00
.npmignore fix: proto files not included in npm package 2020-06-21 16:45:07 -07:00
LICENSE Initial working version of password auth 2017-06-02 08:49:38 -07:00
SECURITY.md Microsoft mandatory file (#170) 2022-08-31 08:46:55 -07:00
changelog.md chore: update dependencies 2023-07-28 10:07:55 -07:00
package-lock.json 1.1.1 2023-07-28 10:08:00 -07:00
package.json bump min node versions 2023-07-28 10:11:10 -07:00
readme.md typo 2021-04-11 09:19:24 -07:00
tsconfig.json chore: update dependencies, modernize build, drop node 8 support 2020-06-15 21:38:24 -07:00

readme.md

etcd3 Run Tests

etcd3 is a high-quality, production-ready client for the Protocol Buffer-based etcd v3 API. It includes:

and is type-safe for TypeScript consumers.

Quickstart

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();
})();

API Documentation

Our TypeDoc docs are available here.

Our test cases are also readable.

Running tests

$ npm install
$ cd src/test/containers/3.2 && docker-compose up # in a separate shell
$ npm test
$ docker-compose down

Contributing

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.