influx 5.0.6 → 5.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/src/doc.d.ts CHANGED
@@ -1,315 +1,315 @@
1
- import { Tags } from './results';
2
- /**
3
- * Pool options can be passed into the database to configure the behaviour
4
- * of the connection pool.
5
- * @typedef {Object} IPoolOptions
6
- * @property {Number} [maxRetries=2] Number of times we should retry running
7
- * a query before calling back with an error.
8
- * @property {Number} [requestTimeout=30000] The length of time after which
9
- * HTTP requests will error if they do not receive a response.
10
- * @property {IBackoffStrategy} [backoff] The backoff strategy to use for
11
- * unhealthy connections. Defaults to an exponential backoff with an
12
- * initial delay of 300ms and a maximum delay of 10 seconds.
13
- */
14
- /**
15
- * A ISingleHostConfig can be provided into `new InfluxDB(config)` when you
16
- * have a single Influx address to connect to.
17
- *
18
- * @public
19
- * @typedef {Object} ISingleHostConfig
20
- * @property {String} [username='root'] Username for connecting to the database.
21
- * @property {String} [password='root'] Password for connecting to the database.
22
- * @property {String} [database] Default database to operate on. Providing this
23
- * will let you omit database names in most operations, and is convenient
24
- * if your app is primarily dealing with a single database.
25
- * @property {String} [host='127.0.0.1'] Influx host to connect to.
26
- * @property {Number} [port=8086] Influx port to connect to.
27
- * @property {String} [protocol='http'] Protocol to connect over, either
28
- * 'http' or 'https'.
29
- * @property {https.RequestOptions} [options={}] Option overrides to use in
30
- * passing to http.request or https.request.
31
- * @property {IPoolOptions} [pool] Options for the connection pool.
32
- * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.
33
- *
34
- * @example
35
- * import { InfluxDB } from 'influx'; // or const InfluxDB = require('influx').InfluxDB
36
- *
37
- * // Connect to a single host with a full set of config details and
38
- * // a custom schema
39
- * const client = new InfluxDB({
40
- * database: 'my_db',
41
- * host: 'localhost',
42
- * port: 8086,
43
- * username: 'connor',
44
- * password: 'pa$$w0rd',
45
- * schema: [{
46
- * measurement: 'perf',
47
- * tags: ['hostname'],
48
- * fields: {
49
- * memory_usage: FieldType.INTEGER,
50
- * cpu_usage: FieldType.FLOAT,
51
- * is_online: FieldType.BOOLEAN,
52
- * }
53
- * }]
54
- * })
55
- */
56
- /**
57
- * A IClusterConfig can be provided into `new InfluxDB(config)` when you
58
- * have a multiple Influx nodes to connect to.
59
- *
60
- * @typedef {Object} IClusterConfig
61
- * @property {String} [username='root'] Username for connecting to the database.
62
- * @property {String} [password='root'] Password for connecting to the database.
63
- * @property {String} [database] Default database to operate on. Providing this
64
- * will let you omit database names in most operations, and is convenient
65
- * if your app is primarily dealing with a single database.
66
- * @property {Array} hosts A list of Influx hosts to connect to.
67
- * @property {String} [hosts.host='127.0.0.1'] Influx host to connect to.
68
- * @property {Number} [hosts.port=8086] Influx port to connect to.
69
- * @property {String} [hosts.protocol='http'] Protocol to connect over, either
70
- * 'http' or 'https'.
71
- * @property {https.RequestOptions} [hosts.options={}] Option overrides to
72
- * use in passing to http.request or https.request.
73
- * @property {IPoolOptions} [pool] Options for the connection pool.
74
- * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.
75
- *
76
- * @example
77
- * import { InfluxDB } from 'influx'; // or const InfluxDB = require('influx').InfluxDB
78
- *
79
- * // Connect to a single host with a full set of config details and
80
- * // a custom schema
81
- * const client = new InfluxDB({
82
- * database: 'my_db',
83
- * username: 'connor',
84
- * password: 'pa$$w0rd',
85
- * hosts: [
86
- * { host: 'db1.example.com' },
87
- * { host: 'db2.example.com' },
88
- * ]
89
- * schema: [{
90
- * measurement: 'perf',
91
- * tags: ['hostname'],
92
- * fields: {
93
- * memory_usage: FieldType.INTEGER,
94
- * cpu_usage: FieldType.FLOAT,
95
- * is_online: FieldType.BOOLEAN,
96
- * }
97
- * }]
98
- * })
99
- */
100
- /**
101
- * Schema options can be passed into the `new InfluxDB()` constructor to
102
- * help define the shape of your data. Each schema config corresponds to
103
- * a measurement in Influx
104
- *
105
- * It's recommended, but not required, that you make use of schema; internally
106
- * we use them to be smarter about coercing your data, and providing immediate
107
- * error feedback if you try to write data which doesn't fit in your schema:
108
- * either if you include tags of fields which are not present in your schema,
109
- * or you enter the wrong datatype for one of your schema fields.
110
- *
111
- * @typedef {Object} ISchemaOptions
112
- * @property {String} [database] The database where the measurement lives. This
113
- * is required if you don't provide a default database in Influx.
114
- * @property {String} measurement The measurement name in Influx this refers to
115
- * @property {Object.<String, FieldType>} fields A mapping of fields names to
116
- * their data types. It's assumed that this is a comprehensive mapping of
117
- * every field you might write.
118
- * @property {String[]} tags A list of tag names in this measurement. It's
119
- * assumed that this is a comprehensive list of every tag you might write.
120
- *
121
- * @example
122
- * {
123
- * measurement: 'perf',
124
- * tags: ['hostname'],
125
- * fields: {
126
- * memory_usage: FieldType.INTEGER,
127
- * cpu_usage: FieldType.FLOAT,
128
- * is_online: FieldType.BOOLEAN,
129
- * }
130
- * }
131
- */
132
- /**
133
- * IResults are returned from the {@link InfluxDB#query} method. It marshals the raw Influx
134
- * results into a more palatable, JavaScript-y structure. All query results
135
- * are marshalled into a single, flat array, and methods are provided to
136
- * examine grouped results as necessary. The `time` column, if included, is
137
- * converted into a {@link INanoDate}. If `.query()` was called on an array of strings,
138
- * it will return an array of IResults, one result per query string.
139
- *
140
- * @interface
141
- * @example
142
- * influx.query('select host, cpu, mem from perf').then(results => {
143
- * expect(results).to.deep.equal([
144
- * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
145
- * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
146
- * // ...
147
- * ])
148
- * })
149
- */
150
- export declare class IResults<T> extends Array {
151
- /**
152
- * Looks for and returns the first group in the results
153
- * that matches the provided tags.
154
- *
155
- * If you've used lodash or underscore, we do something quite similar to
156
- * their object matching: for every row in the results, if it contains tag
157
- * values matching the requested object, we return it.
158
- *
159
- * @param {Object.<String, String>} matcher
160
- * @return {T[]}
161
- * @example
162
- * // Matching tags sets in queries:
163
- * influx.query('select * from perf group by host').then(results => {
164
- * expect(results.group({ host: 'ares.peet.io'})).to.deep.equal([
165
- * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
166
- * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
167
- * // ...
168
- * ])
169
- *
170
- * expect(results.group({ host: 'box1.example.com'})).to.deep.equal([
171
- * { host: 'box1.example.com', cpu: 0.54, mem: 8420 },
172
- * // ...
173
- * ])
174
- * })
175
- */
176
- group(matcher: Tags): T[];
177
- /**
178
- * Returns the data grouped into nested arrays, similarly to how it was
179
- * returned from Influx originally.
180
- *
181
- * @returns {Array<{ name: String, tags: Object.<String, String>, rows: T[] }>}
182
- * @example
183
- * influx.query('select * from perf group by host').then(results => {
184
- * expect(results.groups()).to.deep.equal([
185
- * {
186
- * name: 'perf',
187
- * tags: { host: 'ares.peet.io' },
188
- * rows: [
189
- * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
190
- * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
191
- * // ...
192
- * ]
193
- * }
194
- * {
195
- * name: 'perf',
196
- * tags: { host: 'box1.example.com' },
197
- * rows: [
198
- * { host: 'box1.example.com', cpu: 0.54, mem: 8420 },
199
- * // ...
200
- * ]
201
- * }
202
- * ])
203
- * })
204
- */
205
- groups(): {
206
- name: string;
207
- tags: Tags;
208
- rows: T[];
209
- }[];
210
- }
211
- /**
212
- * IPoint is passed to the client's write methods to store a point in InfluxDB.
213
- *
214
- * @typedef {Object} IPoint
215
- * @property {String} measurement Measurement is the Influx measurement name.
216
- * @property {Object.<String, String>} [tags] Tags is the list of tag
217
- * values to insert.
218
- * @property {Object.<String, *>} [fields] Fields is the list of
219
- * field values to insert.
220
- * @property {Date|string|number} [timestamp] Specifies a timestamp for this
221
- * point. This can be a Date object, in which case we'll adjust it to the
222
- * desired precision, or a numeric string or number, in which case
223
- * it gets passed directly to Influx.
224
- */
225
- /**
226
- * IWriteOptions configure how points are written in the database.
227
- *
228
- * @typedef {Object} IWriteOptions
229
- * @property {TimePrecision} [precision] Precision at which the points are
230
- * written, defaults to milliseconds 'ms'. Influx recommends that you use
231
- * the coarsest precision possible in order to maximize efficiency.
232
- * @property {String} [retentionPolicy] The retention policy to insert
233
- * the points under, uses the DEFAULT policy if not provided.
234
- * @property {String} [database] The database to insert the points in, uses the
235
- * adapter's default database if not provided.
236
- */
237
- /**
238
- * The IQueryOptions allow you to configure how queries are run against Influx.
239
- *
240
- * @typedef {Object} IQueryOptions
241
- * @property {TimePrecision} [precision] Defines the precision at which
242
- * to query points. Defaults to querying in nanosecond precision.
243
- * @property {String} [retentionPolicy] Retention policy to query from,
244
- * defaults to the DEFAULT retention policy.
245
- * @property {String} [database] Database under which to query the points.
246
- * This is required if a database is not provided in Influx client.
247
- */
248
- /**
249
- * IPingStats is returned from {@link InfluxDB#ping}.
250
- *
251
- * @typedef {Object} IPingStats
252
- * @property {Url} url URL is the host's URL
253
- * @property {Boolean} online Whether the request was completed successfully.
254
- * @property {http.ServerResponse} res The raw response from the server, may be
255
- * null on a timeout or HTTP error.
256
- * @property {Number} rtt Total time the server took to respond, in milliseconds
257
- * @property {String} version Version number the server reports to run
258
- */
259
- /**
260
- * The IBackoffStrategy dictates behaviour to use when hosts in the connection
261
- * pool start failing. We remove them from the pool for a duration of time
262
- * specified by the backoff strategy.
263
- *
264
- * The strategy itself is immutable, and each method call should return a new
265
- * strategy without modifying the original one.
266
- *
267
- * @interface
268
- * @example
269
- * let backoff = new MyBackoffStrategy();
270
- * console.log(backoff.getDelay()); // => 10
271
- * backoff = backoff.next();
272
- * console.log(backoff.getDelay()); // => 20
273
- * backoff = backoff.reset();
274
- * console.log(backoff.getDelay()); // => 10
275
- */
276
- export declare class IBackoffStrategy {
277
- /**
278
- * getDelay returns the amount of delay of the current backoff.
279
- * @return {Number}
280
- */
281
- getDelay(): number;
282
- /**
283
- * Next is called when a failure occurs on a host to
284
- * return the next backoff amount.
285
- * @return {IBackoffStrategy}
286
- */
287
- next(): IBackoffStrategy;
288
- /**
289
- * Returns a strategy with a reset backoff counter.
290
- * @return {IBackoffStrategy}
291
- */
292
- reset(): IBackoffStrategy;
293
- }
294
- /**
295
- * An INanoDate is a type of Date that holds a nanosecond-precision unix
296
- * timestamp. It's the default date type parsed in {@link IResults} and
297
- * can be created manually using {@link toNanoDate}.
298
- * @interface
299
- */
300
- export declare class INanoDate extends Date {
301
- /**
302
- * Returns the unix nanoseconds timestamp as a string.
303
- * @example
304
- * const date = toNanoDate('1475985480231035677')
305
- * expect(date.getNanoTime()).to.equal('1475985480231035677')
306
- */
307
- getNanoTime(): string;
308
- /**
309
- * Formats the date as an ISO RFC3339 timestamp with nanosecond precision.
310
- * @example
311
- * const date = toNanoDate('1475985480231035677')
312
- * expect(date.toNanoISOString()).to.equal('2016-10-09T03:58:00.231035677Z')
313
- */
314
- toNanoISOString(): string;
315
- }
1
+ import { Tags } from './results';
2
+ /**
3
+ * Pool options can be passed into the database to configure the behaviour
4
+ * of the connection pool.
5
+ * @typedef {Object} IPoolOptions
6
+ * @property {Number} [maxRetries=2] Number of times we should retry running
7
+ * a query before calling back with an error.
8
+ * @property {Number} [requestTimeout=30000] The length of time after which
9
+ * HTTP requests will error if they do not receive a response.
10
+ * @property {IBackoffStrategy} [backoff] The backoff strategy to use for
11
+ * unhealthy connections. Defaults to an exponential backoff with an
12
+ * initial delay of 300ms and a maximum delay of 10 seconds.
13
+ */
14
+ /**
15
+ * A ISingleHostConfig can be provided into `new InfluxDB(config)` when you
16
+ * have a single Influx address to connect to.
17
+ *
18
+ * @public
19
+ * @typedef {Object} ISingleHostConfig
20
+ * @property {String} [username='root'] Username for connecting to the database.
21
+ * @property {String} [password='root'] Password for connecting to the database.
22
+ * @property {String} [database] Default database to operate on. Providing this
23
+ * will let you omit database names in most operations, and is convenient
24
+ * if your app is primarily dealing with a single database.
25
+ * @property {String} [host='127.0.0.1'] Influx host to connect to.
26
+ * @property {Number} [port=8086] Influx port to connect to.
27
+ * @property {String} [protocol='http'] Protocol to connect over, either
28
+ * 'http' or 'https'.
29
+ * @property {https.RequestOptions} [options={}] Option overrides to use in
30
+ * passing to http.request or https.request.
31
+ * @property {IPoolOptions} [pool] Options for the connection pool.
32
+ * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.
33
+ *
34
+ * @example
35
+ * import { InfluxDB } from 'influx'; // or const InfluxDB = require('influx').InfluxDB
36
+ *
37
+ * // Connect to a single host with a full set of config details and
38
+ * // a custom schema
39
+ * const client = new InfluxDB({
40
+ * database: 'my_db',
41
+ * host: 'localhost',
42
+ * port: 8086,
43
+ * username: 'connor',
44
+ * password: 'pa$$w0rd',
45
+ * schema: [{
46
+ * measurement: 'perf',
47
+ * tags: ['hostname'],
48
+ * fields: {
49
+ * memory_usage: FieldType.INTEGER,
50
+ * cpu_usage: FieldType.FLOAT,
51
+ * is_online: FieldType.BOOLEAN,
52
+ * }
53
+ * }]
54
+ * })
55
+ */
56
+ /**
57
+ * A IClusterConfig can be provided into `new InfluxDB(config)` when you
58
+ * have a multiple Influx nodes to connect to.
59
+ *
60
+ * @typedef {Object} IClusterConfig
61
+ * @property {String} [username='root'] Username for connecting to the database.
62
+ * @property {String} [password='root'] Password for connecting to the database.
63
+ * @property {String} [database] Default database to operate on. Providing this
64
+ * will let you omit database names in most operations, and is convenient
65
+ * if your app is primarily dealing with a single database.
66
+ * @property {Array} hosts A list of Influx hosts to connect to.
67
+ * @property {String} [hosts.host='127.0.0.1'] Influx host to connect to.
68
+ * @property {Number} [hosts.port=8086] Influx port to connect to.
69
+ * @property {String} [hosts.protocol='http'] Protocol to connect over, either
70
+ * 'http' or 'https'.
71
+ * @property {https.RequestOptions} [hosts.options={}] Option overrides to
72
+ * use in passing to http.request or https.request.
73
+ * @property {IPoolOptions} [pool] Options for the connection pool.
74
+ * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.
75
+ *
76
+ * @example
77
+ * import { InfluxDB } from 'influx'; // or const InfluxDB = require('influx').InfluxDB
78
+ *
79
+ * // Connect to a single host with a full set of config details and
80
+ * // a custom schema
81
+ * const client = new InfluxDB({
82
+ * database: 'my_db',
83
+ * username: 'connor',
84
+ * password: 'pa$$w0rd',
85
+ * hosts: [
86
+ * { host: 'db1.example.com' },
87
+ * { host: 'db2.example.com' },
88
+ * ]
89
+ * schema: [{
90
+ * measurement: 'perf',
91
+ * tags: ['hostname'],
92
+ * fields: {
93
+ * memory_usage: FieldType.INTEGER,
94
+ * cpu_usage: FieldType.FLOAT,
95
+ * is_online: FieldType.BOOLEAN,
96
+ * }
97
+ * }]
98
+ * })
99
+ */
100
+ /**
101
+ * Schema options can be passed into the `new InfluxDB()` constructor to
102
+ * help define the shape of your data. Each schema config corresponds to
103
+ * a measurement in Influx
104
+ *
105
+ * It's recommended, but not required, that you make use of schema; internally
106
+ * we use them to be smarter about coercing your data, and providing immediate
107
+ * error feedback if you try to write data which doesn't fit in your schema:
108
+ * either if you include tags of fields which are not present in your schema,
109
+ * or you enter the wrong datatype for one of your schema fields.
110
+ *
111
+ * @typedef {Object} ISchemaOptions
112
+ * @property {String} [database] The database where the measurement lives. This
113
+ * is required if you don't provide a default database in Influx.
114
+ * @property {String} measurement The measurement name in Influx this refers to
115
+ * @property {Object.<String, FieldType>} fields A mapping of fields names to
116
+ * their data types. It's assumed that this is a comprehensive mapping of
117
+ * every field you might write.
118
+ * @property {String[]} tags A list of tag names in this measurement. It's
119
+ * assumed that this is a comprehensive list of every tag you might write.
120
+ *
121
+ * @example
122
+ * {
123
+ * measurement: 'perf',
124
+ * tags: ['hostname'],
125
+ * fields: {
126
+ * memory_usage: FieldType.INTEGER,
127
+ * cpu_usage: FieldType.FLOAT,
128
+ * is_online: FieldType.BOOLEAN,
129
+ * }
130
+ * }
131
+ */
132
+ /**
133
+ * IResults are returned from the {@link InfluxDB#query} method. It marshals the raw Influx
134
+ * results into a more palatable, JavaScript-y structure. All query results
135
+ * are marshalled into a single, flat array, and methods are provided to
136
+ * examine grouped results as necessary. The `time` column, if included, is
137
+ * converted into a {@link INanoDate}. If `.query()` was called on an array of strings,
138
+ * it will return an array of IResults, one result per query string.
139
+ *
140
+ * @interface
141
+ * @example
142
+ * influx.query('select host, cpu, mem from perf').then(results => {
143
+ * expect(results).to.deep.equal([
144
+ * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
145
+ * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
146
+ * // ...
147
+ * ])
148
+ * })
149
+ */
150
+ export declare class IResults<T> extends Array {
151
+ /**
152
+ * Looks for and returns the first group in the results
153
+ * that matches the provided tags.
154
+ *
155
+ * If you've used lodash or underscore, we do something quite similar to
156
+ * their object matching: for every row in the results, if it contains tag
157
+ * values matching the requested object, we return it.
158
+ *
159
+ * @param {Object.<String, String>} matcher
160
+ * @return {T[]}
161
+ * @example
162
+ * // Matching tags sets in queries:
163
+ * influx.query('select * from perf group by host').then(results => {
164
+ * expect(results.group({ host: 'ares.peet.io'})).to.deep.equal([
165
+ * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
166
+ * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
167
+ * // ...
168
+ * ])
169
+ *
170
+ * expect(results.group({ host: 'box1.example.com'})).to.deep.equal([
171
+ * { host: 'box1.example.com', cpu: 0.54, mem: 8420 },
172
+ * // ...
173
+ * ])
174
+ * })
175
+ */
176
+ group(matcher: Tags): T[];
177
+ /**
178
+ * Returns the data grouped into nested arrays, similarly to how it was
179
+ * returned from Influx originally.
180
+ *
181
+ * @returns {Array<{ name: String, tags: Object.<String, String>, rows: T[] }>}
182
+ * @example
183
+ * influx.query('select * from perf group by host').then(results => {
184
+ * expect(results.groups()).to.deep.equal([
185
+ * {
186
+ * name: 'perf',
187
+ * tags: { host: 'ares.peet.io' },
188
+ * rows: [
189
+ * { host: 'ares.peet.io', cpu: 0.12, mem: 2435 },
190
+ * { host: 'ares.peet.io', cpu: 0.10, mem: 2451 },
191
+ * // ...
192
+ * ]
193
+ * }
194
+ * {
195
+ * name: 'perf',
196
+ * tags: { host: 'box1.example.com' },
197
+ * rows: [
198
+ * { host: 'box1.example.com', cpu: 0.54, mem: 8420 },
199
+ * // ...
200
+ * ]
201
+ * }
202
+ * ])
203
+ * })
204
+ */
205
+ groups(): {
206
+ name: string;
207
+ tags: Tags;
208
+ rows: T[];
209
+ }[];
210
+ }
211
+ /**
212
+ * IPoint is passed to the client's write methods to store a point in InfluxDB.
213
+ *
214
+ * @typedef {Object} IPoint
215
+ * @property {String} measurement Measurement is the Influx measurement name.
216
+ * @property {Object.<String, String>} [tags] Tags is the list of tag
217
+ * values to insert.
218
+ * @property {Object.<String, *>} [fields] Fields is the list of
219
+ * field values to insert.
220
+ * @property {Date|string|number} [timestamp] Specifies a timestamp for this
221
+ * point. This can be a Date object, in which case we'll adjust it to the
222
+ * desired precision, or a numeric string or number, in which case
223
+ * it gets passed directly to Influx.
224
+ */
225
+ /**
226
+ * IWriteOptions configure how points are written in the database.
227
+ *
228
+ * @typedef {Object} IWriteOptions
229
+ * @property {TimePrecision} [precision] Precision at which the points are
230
+ * written, defaults to milliseconds 'ms'. Influx recommends that you use
231
+ * the coarsest precision possible in order to maximize efficiency.
232
+ * @property {String} [retentionPolicy] The retention policy to insert
233
+ * the points under, uses the DEFAULT policy if not provided.
234
+ * @property {String} [database] The database to insert the points in, uses the
235
+ * adapter's default database if not provided.
236
+ */
237
+ /**
238
+ * The IQueryOptions allow you to configure how queries are run against Influx.
239
+ *
240
+ * @typedef {Object} IQueryOptions
241
+ * @property {TimePrecision} [precision] Defines the precision at which
242
+ * to query points. Defaults to querying in nanosecond precision.
243
+ * @property {String} [retentionPolicy] Retention policy to query from,
244
+ * defaults to the DEFAULT retention policy.
245
+ * @property {String} [database] Database under which to query the points.
246
+ * This is required if a database is not provided in Influx client.
247
+ */
248
+ /**
249
+ * IPingStats is returned from {@link InfluxDB#ping}.
250
+ *
251
+ * @typedef {Object} IPingStats
252
+ * @property {Url} url URL is the host's URL
253
+ * @property {Boolean} online Whether the request was completed successfully.
254
+ * @property {http.ServerResponse} res The raw response from the server, may be
255
+ * null on a timeout or HTTP error.
256
+ * @property {Number} rtt Total time the server took to respond, in milliseconds
257
+ * @property {String} version Version number the server reports to run
258
+ */
259
+ /**
260
+ * The IBackoffStrategy dictates behaviour to use when hosts in the connection
261
+ * pool start failing. We remove them from the pool for a duration of time
262
+ * specified by the backoff strategy.
263
+ *
264
+ * The strategy itself is immutable, and each method call should return a new
265
+ * strategy without modifying the original one.
266
+ *
267
+ * @interface
268
+ * @example
269
+ * let backoff = new MyBackoffStrategy();
270
+ * console.log(backoff.getDelay()); // => 10
271
+ * backoff = backoff.next();
272
+ * console.log(backoff.getDelay()); // => 20
273
+ * backoff = backoff.reset();
274
+ * console.log(backoff.getDelay()); // => 10
275
+ */
276
+ export declare class IBackoffStrategy {
277
+ /**
278
+ * getDelay returns the amount of delay of the current backoff.
279
+ * @return {Number}
280
+ */
281
+ getDelay(): number;
282
+ /**
283
+ * Next is called when a failure occurs on a host to
284
+ * return the next backoff amount.
285
+ * @return {IBackoffStrategy}
286
+ */
287
+ next(): IBackoffStrategy;
288
+ /**
289
+ * Returns a strategy with a reset backoff counter.
290
+ * @return {IBackoffStrategy}
291
+ */
292
+ reset(): IBackoffStrategy;
293
+ }
294
+ /**
295
+ * An INanoDate is a type of Date that holds a nanosecond-precision unix
296
+ * timestamp. It's the default date type parsed in {@link IResults} and
297
+ * can be created manually using {@link toNanoDate}.
298
+ * @interface
299
+ */
300
+ export declare class INanoDate extends Date {
301
+ /**
302
+ * Returns the unix nanoseconds timestamp as a string.
303
+ * @example
304
+ * const date = toNanoDate('1475985480231035677')
305
+ * expect(date.getNanoTime()).to.equal('1475985480231035677')
306
+ */
307
+ getNanoTime(): string;
308
+ /**
309
+ * Formats the date as an ISO RFC3339 timestamp with nanosecond precision.
310
+ * @example
311
+ * const date = toNanoDate('1475985480231035677')
312
+ * expect(date.toNanoISOString()).to.equal('2016-10-09T03:58:00.231035677Z')
313
+ */
314
+ toNanoISOString(): string;
315
+ }