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

    Class ElectionObserver

    Object returned from election.observer() that exposes information about the current election.

    Hierarchy

    • EventEmitter
      • ElectionObserver
    Index
    • get hasLeader(): boolean

      Gets whether the election has any leader.

      Returns boolean

    • Closes the election observer.

      Returns Promise<void>

    • Returns the currently-elected leader value (passed to campaign() or proclaim()), or undefined if there's no elected leader.

      Parameters

      • Optionalencoding: BufferEncoding

      Returns string | undefined

    • Returns the currently-elected leader value (passed to campaign() or proclaim()), or undefined if there's no elected leader.

      Parameters

      • encoding: "buffer"

      Returns Buffer<ArrayBufferLike> | undefined

    • change is fired when the elected value changes. It can be fired with undefined if there's no longer a leader.

      Parameters

      • event: "change"
      • handler: (value: string | undefined) => void

      Returns this

    • disconnected is fired when the underlying watcher is disconnected. Etcd3 will automatically attempt to reconnect in the background. This has the same semantics as the disconnected event on the Watcher.

      Parameters

      • event: "disconnected"
      • handler: (value: Error) => void

      Returns this

    • error is fired if the underlying election watcher experiences an unrecoverable error.

      Parameters

      • event: "error"
      • handler: (value: Error) => void

      Returns this