source: node_modules/undici/docs/api/BalancedPool.md@ 65b6638

main
Last change on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 2.8 KB
Line 
1# Class: BalancedPool
2
3Extends: `undici.Dispatcher`
4
5A pool of [Pool](Pool.md) instances connected to multiple upstreams.
6
7Requests are not guaranteed to be dispatched in order of invocation.
8
9## `new BalancedPool(upstreams [, options])`
10
11Arguments:
12
13* **upstreams** `URL | string | string[]` - It should only include the **protocol, hostname, and port**.
14* **options** `BalancedPoolOptions` (optional)
15
16### Parameter: `BalancedPoolOptions`
17
18Extends: [`PoolOptions`](Pool.md#parameter-pooloptions)
19
20* **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Pool(origin, opts)`
21
22The `PoolOptions` are passed to each of the `Pool` instances being created.
23## Instance Properties
24
25### `BalancedPool.upstreams`
26
27Returns an array of upstreams that were previously added.
28
29### `BalancedPool.closed`
30
31Implements [Client.closed](Client.md#clientclosed)
32
33### `BalancedPool.destroyed`
34
35Implements [Client.destroyed](Client.md#clientdestroyed)
36
37### `Pool.stats`
38
39Returns [`PoolStats`](PoolStats.md) instance for this pool.
40
41## Instance Methods
42
43### `BalancedPool.addUpstream(upstream)`
44
45Add an upstream.
46
47Arguments:
48
49* **upstream** `string` - It should only include the **protocol, hostname, and port**.
50
51### `BalancedPool.removeUpstream(upstream)`
52
53Removes an upstream that was previously addded.
54
55### `BalancedPool.close([callback])`
56
57Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise).
58
59### `BalancedPool.destroy([error, callback])`
60
61Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise).
62
63### `BalancedPool.connect(options[, callback])`
64
65See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback).
66
67### `BalancedPool.dispatch(options, handlers)`
68
69Implements [`Dispatcher.dispatch(options, handlers)`](Dispatcher.md#dispatcherdispatchoptions-handler).
70
71### `BalancedPool.pipeline(options, handler)`
72
73See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler).
74
75### `BalancedPool.request(options[, callback])`
76
77See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback).
78
79### `BalancedPool.stream(options, factory[, callback])`
80
81See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback).
82
83### `BalancedPool.upgrade(options[, callback])`
84
85See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback).
86
87## Instance Events
88
89### Event: `'connect'`
90
91See [Dispatcher Event: `'connect'`](Dispatcher.md#event-connect).
92
93### Event: `'disconnect'`
94
95See [Dispatcher Event: `'disconnect'`](Dispatcher.md#event-disconnect).
96
97### Event: `'drain'`
98
99See [Dispatcher Event: `'drain'`](Dispatcher.md#event-drain).
Note: See TracBrowser for help on using the repository browser.