Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • EventEmitter
    • ElectionObserver

Index

Constructors

Accessors

Methods

Constructors

constructor

Accessors

hasLeader

  • get hasLeader(): boolean

Methods

cancel

  • cancel(): Promise<void>

leader

  • leader(encoding?: BufferEncoding): string | undefined
  • leader(encoding: "buffer"): Buffer | undefined
  • Returns the currently-elected leader value (passed to campaign() or proclaim()), or undefined if there's no elected leader.

    Parameters

    • Optional encoding: 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 | undefined

on

  • on(event: "change", handler: (value: string | undefined) => void): this
  • on(event: "disconnected", handler: (value: Error) => void): this
  • on(event: "error", handler: (value: Error) => void): this
  • 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
        • (value: string | undefined): void
        • Parameters

          • value: string | undefined

          Returns 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
        • Parameters

          Returns void

    Returns this

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

    Parameters

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

          Returns void

    Returns this

Legend

  • Constructor
  • Method
  • Inherited method

Generated using TypeDoc