Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Pool

The Pool maintains a list available Kapacitor hosts and dispatches requests to them. If there are errors connecting to hosts, it will disable that host for a period of time.

Hierarchy

  • Pool

Index

Constructors

constructor

Methods

addHost

  • addHost(url: string, options?: RequestOptions): Host
  • Inserts a new host to the pool.

    Parameters

    • url: string
    • Default value options: RequestOptions = {}

    Returns Host

discard

  • Makes a request and discards any response body it receives. An error is returned on a non-2xx status code.

    Parameters

    Returns Promise<void>

getHostsAvailable

  • getHostsAvailable(): Host[]

getHostsDisabled

  • getHostsDisabled(): Host[]
  • Returns a list of hosts that are currently disabled due to network errors.

    Returns Host[]

hostIsAvailable

  • hostIsAvailable(): boolean
  • Returns true if there's any host available to by queried.

    Returns boolean

json

  • Makes a request and calls back with the response, parsed as JSON. An error is returned on a non-2xx status code or on a parsing exception.

    Parameters

    Returns Promise<any>

ping

  • ping(timeout: number, path?: string): Promise<IPingStats[]>
  • Ping sends out a request to all available Kapacitor servers, reporting on their response time and version number.

    Parameters

    • timeout: number
    • Default value path: string = "/kapacitor/v1/ping"

    Returns Promise<IPingStats[]>

stream

  • Makes a request and calls back with the IncomingMessage stream, if possible. An error is returned on a non-2xx status code.

    Parameters

    • options: IPoolRequestOptions
    • callback: function
        • (err: Error | undefined, res: IncomingMessage | null): void
        • Parameters

          • err: Error | undefined
          • res: IncomingMessage | null

          Returns void

    Returns void

text

  • Makes a request and resolves with the plain text response, if possible. An error is raised on a non-2xx status code.

    Parameters

    Returns Promise<string>

Generated using TypeDoc