UNPKG

803 BTypeScriptView Raw
1/// <reference types="node" />
2import { RequestOptions } from "https";
3import * as urlModule from "url";
4import { IBackoffStrategy } from "./backoff/backoff";
5export declare class Host {
6 private backoff;
7 readonly options: RequestOptions;
8 readonly url: urlModule.Url;
9 /**
10 * Creates a new Host instance.
11 * @param url
12 * @param backoff
13 */
14 constructor(url: string, backoff: IBackoffStrategy, options: RequestOptions);
15 /**
16 * Marks a failure on the host and returns the length of time it
17 * should be removed from the pool
18 * @return removal time in milliseconds
19 */
20 fail(): number;
21 /**
22 * Should be called when a successful operation is run against the host.
23 * It resets the host's backoff strategy.
24 */
25 success(): void;
26}