etcd3 API - v2.0.0
    Preparing search index...

    Class Namespace

    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.

    Hierarchy (View Summary)

    Index
    • Creates a new Election instead. See more information on the Election class documentation.

      Parameters

      • name: string

        Name of the election in the etcd instance.

      • Optionalttl: number

        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.

      Returns Election

    • if() starts a new etcd transaction, which allows you to execute complex statements atomically. See documentation on the ComparatorBuilder for more information.

      Parameters

      • key: string | Buffer<ArrayBufferLike>
      • column: "Lease" | "Version" | "Create" | "Mod" | "Value"
      • cmp: "==" | "===" | ">" | "<" | "!=" | "!=="
      • value: string | number | Buffer<ArrayBufferLike>

      Returns ComparatorBuilder

    • 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.

      Parameters

      Returns Lease

    • lock() is a helper to provide distributed locking capability. See the documentation on the Lock class for more information and examples.

      Parameters

      • key: string | Buffer<ArrayBufferLike>

      Returns Lock

    • 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.

      Parameters

      • prefix: string | Buffer<ArrayBufferLike>

      Returns Namespace

    • .put() starts making a put request against etcd.

      Parameters

      • key: string | Buffer<ArrayBufferLike>

      Returns PutBuilder

    • Creates a structure representing an etcd range. Used in permission grants and queries. This is a convenience method for Etcd3.Range.from(...).

      Parameters

      Returns Range