Home Manual Reference Source Test
import {Pool} from 'influx'
public class | source

Pool

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

Constructor Summary

Public Constructor
public

Creates a new Pool instance.

Method Summary

Public Methods
public

addHost(url: *, options: {}): *

Inserts a new host to the pool.

public

disableHost(host: *)

Disables the provided host, removing it from the query pool.

public

discard(options: *): *

Makes a request and discards any response body it receives.

public

enableHost(host: Host)

Re-enables the provided host, returning it to the pool to query.

public

getHost(): Host

Returns the next available host for querying.

public

getHostsAvailable(): Host[]

Returns a list of currently active hosts.

public

getHostsDisabled(): Host[]

Returns a list of hosts that are currently disabled due to network errors.

public

Returns true if there's any host available to by queried.

public

json(options: *): *

Makes a request and calls back with the response, parsed as JSON.

public

ping(timeout: *, path: string): *

Ping sends out a request to all available Influx servers, reporting on their response time and version number.

public

stream(options: *, callback: *): *

Makes a request and calls back with the IncomingMessage stream, if possible.

public

text(options: *): *

Makes a request and resolves with the plain text response, if possible.

Public Constructors

public constructor(options: IPoolOptions) source

Creates a new Pool instance.

Params:

NameTypeAttributeDescription
options IPoolOptions

Public Methods

public addHost(url: *, options: {}): * source

Inserts a new host to the pool.

Params:

NameTypeAttributeDescription
url *
options {}
  • optional
  • default: {}

Return:

*

public disableHost(host: *) source

Disables the provided host, removing it from the query pool. It will be re-enabled after a backoff interval

Params:

NameTypeAttributeDescription
host *

public discard(options: *): * source

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

Params:

NameTypeAttributeDescription
options *

Return:

*

public enableHost(host: Host) source

Re-enables the provided host, returning it to the pool to query.

Params:

NameTypeAttributeDescription
host Host

public getHost(): Host source

Returns the next available host for querying.

Return:

Host

public getHostsAvailable(): Host[] source

Returns a list of currently active hosts.

Return:

Host[]

public getHostsDisabled(): Host[] source

Returns a list of hosts that are currently disabled due to network errors.

Return:

Host[]

public hostIsAvailable(): Boolean source

Returns true if there's any host available to by queried.

Return:

Boolean

public json(options: *): * source

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.

Params:

NameTypeAttributeDescription
options *

Return:

*

public ping(timeout: *, path: string): * source

Ping sends out a request to all available Influx servers, reporting on their response time and version number.

Params:

NameTypeAttributeDescription
timeout *
path string
  • optional
  • default: /ping

Return:

*

public stream(options: *, callback: *): * source

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

Params:

NameTypeAttributeDescription
options *
callback *

Return:

*

public text(options: *): * source

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

Params:

NameTypeAttributeDescription
options *

Return:

*