.delete()
starts making a delete request against etcd.
Creates a new Election instead. See more information on the Election class documentation.
Name of the election in the etcd instance.
Lease TTL used in the election. This is the maximum time that a node which goes down can remain the leader before being automatically evicted.
.get()
starts a query to look up a single key from etcd.
.getAll()
starts a query to look up multiple keys from etcd.
if()
starts a new etcd transaction, which allows you to execute complex
statements atomically. See documentation on the ComparatorBuilder for
more information.
lease()
grants and returns a new Lease instance. The Lease is
automatically kept alive for you until it is revoked. See the
documentation on the Lease class for some examples.
lock()
is a helper to provide distributed locking capability. See
the documentation on the Lock class for more information and examples.
namespace adds a prefix and returns a new Namespace, which is used for
operating on keys in a prefixed domain. For example, if the current
namespace is the default "" and you call namespace('user1/'), all
operations on that new namespace will be automatically prefixed
with user1/
. See the Namespace class for more details.
.put()
starts making a put request against etcd.
stm()
creates a new software transaction, see more details about how
this works and why you might find this useful
on the SoftwareTransaction class.
.watch()
creates a new watch builder. See the documentation on the
WatchBuilder for usage examples.
Generated using TypeDoc
Namespace is the class on which CRUD operations can be invoked. The default namespace is the empty string, "". You can create nested namespaces by calling the
namespace(prefix)
method.For example, if the current namespace is the default "" and you call namespace('user1/'), all operations on that new namespace will be automatically prefixed with
user1/
:const client = new Etcd3(); const ns = client.namespace('user1/'); await ns.put('foo').value('bar'); // sets the key `user1/foo` to `bar` await ns.delete().all(); // deletes all keys with the prefix `user1/`
Namespacing is particularly useful to avoid clashing between multiple applications and when using Etcd's access control.