Options
All
  • Public
  • Public/Protected
  • All
Menu

WatchBuilder is used for creating etcd watchers. The created watchers are resilient against disconnections, automatically resubscribing and replaying changes when reconnecting.

const client = new Etcd3();

client.watch()
  .key('foo')
  .create()
  .then(watcher => {
    watcher
      .on('disconnected', () => console.log('disconnected...'))
      .on('connected', () => console.log('successfully reconnected!'))
      .on('put', res => console.log('foo got set to:', res.value.toString()));
  });

Hierarchy

  • WatchBuilder

Index

Constructors

constructor

Methods

create

  • Resolves the watch request into a Watcher, and fires off to etcd.

    Returns Promise<Watcher>

ignore

  • deprecated

    this does the opposite of what it says -- use only instead

    Parameters

    Returns this

inRange

  • inRange instructs the builder to watch keys in the specified byte range.

    Parameters

    Returns this

key

  • key(key: string | Buffer): this
  • Sets a single key to be watched.

    Parameters

    • key: string | Buffer

    Returns this

only

  • Requests only changes for the given kinds of operations.

    Parameters

    Returns this

prefix

  • prefix(value: string | Buffer): this
  • Prefix instructs the watcher to watch all keys with the given prefix.

    Parameters

    • value: string | Buffer

    Returns this

startRevision

  • startRevision(revision: string): this
  • Watch starting from a specific revision.

    Parameters

    • revision: string

    Returns this

withPreviousKV

  • withPreviousKV(): this
  • Instructs the watcher to return the previous key/value pair in updates.

    Returns this

Legend

  • Constructor
  • Method
  • Inherited method

Generated using TypeDoc