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

    Class Watcher

    The Watcher is an event emitter that handles watching on a key or set of keys. See WatchBuilder for a usage example.

    Hierarchy

    • EventEmitter
      • Watcher
    Index
    id: string | null = null

    id is the watcher's ID in etcd. This is null initially and during reconnections, only populated while the watcher is idle.

    • Cancels the watcher.

      Returns Promise<void>

    • lastRevision returns the lossless bigint latest/resume revision for this watcher. After observing a cluster header at revision N, this is N + 1. This will be null until the watcher has a resume revision.

      Returns bigint | null

    • connecting is fired when we send a request to etcd to queue this watcher.

      Parameters

      Returns this

    • connected is fired after etcd acknowledges the watcher is connected. When this event is fired, id will already be populated.

      Parameters

      Returns this

    • data is fired when etcd reports an update on one of the keys being watched.

      Parameters

      Returns this

    • put is fired, in addition to data, when a key is created or updated in etcd.

      Parameters

      Returns this

    • delete is fired, in addition to data, when a key is deleted from etcd.

      Parameters

      Returns this

    • end is fired after the watcher is closed normally. Like Node.js streams, end is NOT fired if error is fired.

      Parameters

      • event: "end"
      • handler: () => void

      Returns this

    • disconnected is fired if the watcher is disconnected from etcd. The watcher will automatically attempt to reconnect when this occurs. When this event is fired, id will still be populated if it was previously.

      Parameters

      • event: "disconnected"
      • handler: (res: EtcdError) => void

      Returns this

    • error is fired if a non-recoverable error occurs that prevents the watcher from functioning. This generally occurs if etcd unexpectedly canceled our lease, which can occur if (for example) we don't have permission to read the watched key or range. When this event is fired, id will still be populated if it was previously.

      Parameters

      • event: "error"
      • handler: (err: EtcdError) => void

      Returns this