Add two tests to assess worker options. (#260)
[poolifier.git] / docs / interfaces / ipool.html
CommitLineData
5ea22628
JB
1<!doctype html>
2<html class="default no-js">
3<head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <title>IPool | poolifier</title>
7 <meta name="description" content="Documentation for poolifier">
8 <meta name="viewport" content="width=device-width, initial-scale=1">
9 <link rel="stylesheet" href="../assets/css/main.css">
10 <script async src="../assets/js/search.js" id="search-script"></script>
11</head>
12<body>
13<header>
14 <div class="tsd-page-toolbar">
15 <div class="container">
16 <div class="table-wrap">
17 <div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
18 <div class="field">
19 <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
20 <input id="tsd-search-field" type="text" />
21 </div>
22 <ul class="results">
23 <li class="state loading">Preparing search index...</li>
24 <li class="state failure">The search index is not available</li>
25 </ul>
26 <a href="../index.html" class="title">poolifier</a>
27 </div>
28 <div class="table-cell" id="tsd-widgets">
29 <div id="tsd-filter">
30 <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
31 <div class="tsd-filter-group">
32 <div class="tsd-select" id="tsd-filter-visibility">
33 <span class="tsd-select-label">All</span>
34 <ul class="tsd-select-list">
35 <li data-value="public">Public</li>
36 <li data-value="protected">Public/Protected</li>
37 <li data-value="private" class="selected">All</li>
38 </ul>
39 </div>
40 <input type="checkbox" id="tsd-filter-inherited" checked />
41 <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
42 <input type="checkbox" id="tsd-filter-externals" checked />
43 <label class="tsd-widget" for="tsd-filter-externals">Externals</label>
44 </div>
45 </div>
46 <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
47 </div>
48 </div>
49 </div>
50 </div>
51 <div class="tsd-page-title">
52 <div class="container">
53 <ul class="tsd-breadcrumb">
54 <li>
55 <a href="../index.html">poolifier</a>
56 </li>
57 <li>
58 <a href="ipool.html">IPool</a>
59 </li>
60 </ul>
61 <h1>Interface IPool&lt;Data, Response&gt;</h1>
62 </div>
63 </div>
64</header>
65<div class="container container-main">
66 <div class="row">
67 <div class="col-8 col-content">
68 <section class="tsd-panel tsd-comment">
69 <div class="tsd-comment tsd-typography">
70 <div class="lead">
71 <p>Contract definition for a poolifier pool.</p>
72 </div>
73 </div>
74 </section>
75 <section class="tsd-panel tsd-type-parameters">
76 <h3>Type parameters</h3>
77 <ul class="tsd-type-parameters">
78 <li>
79 <h4>Data = <span class="tsd-signature-type">unknown</span></h4>
80 <div class="tsd-comment tsd-typography">
81 <div class="lead">
82 <p>Type of data sent to the worker. This can only be serializable data.</p>
83 </div>
84 </div>
85 </li>
86 <li>
87 <h4>Response = <span class="tsd-signature-type">unknown</span></h4>
88 <div class="tsd-comment tsd-typography">
89 <div class="lead">
90 <p>Type of response of execution. This can only be serializable data.</p>
91 </div>
92 </div>
93 </li>
94 </ul>
95 </section>
96 <section class="tsd-panel tsd-hierarchy">
97 <h3>Hierarchy</h3>
98 <ul class="tsd-hierarchy">
99 <li>
100 <span class="target">IPool</span>
101 </li>
102 </ul>
103 </section>
104 <section class="tsd-panel-group tsd-index-group">
105 <h2>Index</h2>
106 <section class="tsd-panel tsd-index-panel">
107 <div class="tsd-index-content">
108 <section class="tsd-index-section ">
109 <h3>Methods</h3>
110 <ul class="tsd-index-list">
111 <li class="tsd-kind-method tsd-parent-kind-interface"><a href="ipool.html#destroy" class="tsd-kind-icon">destroy</a></li>
112 <li class="tsd-kind-method tsd-parent-kind-interface"><a href="ipool.html#execute" class="tsd-kind-icon">execute</a></li>
113 <li class="tsd-kind-method tsd-parent-kind-interface"><a href="ipool.html#setworkerchoicestrategy" class="tsd-kind-icon">set<wbr>Worker<wbr>Choice<wbr>Strategy</a></li>
114 </ul>
115 </section>
116 </div>
117 </section>
118 </section>
119 <section class="tsd-panel-group tsd-member-group ">
120 <h2>Methods</h2>
121 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
122 <a name="destroy" class="tsd-anchor"></a>
123 <h3>destroy</h3>
124 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
125 <li class="tsd-signature tsd-kind-icon">destroy<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li>
126 </ul>
127 <ul class="tsd-descriptions">
128 <li class="tsd-description">
129 <aside class="tsd-sources">
130 <ul>
7c0ba920 131 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/pool.ts#L20">src/pools/pool.ts:20</a></li>
5ea22628
JB
132 </ul>
133 </aside>
134 <div class="tsd-comment tsd-typography">
135 <div class="lead">
136 <p>Shut down every current worker in this pool.</p>
137 </div>
138 </div>
139 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
140 </li>
141 </ul>
142 </section>
143 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
144 <a name="execute" class="tsd-anchor"></a>
145 <h3>execute</h3>
146 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
147 <li class="tsd-signature tsd-kind-icon">execute<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Data</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">&gt;</span></li>
148 </ul>
149 <ul class="tsd-descriptions">
150 <li class="tsd-description">
151 <aside class="tsd-sources">
152 <ul>
7c0ba920 153 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/pool.ts#L16">src/pools/pool.ts:16</a></li>
5ea22628
JB
154 </ul>
155 </aside>
156 <div class="tsd-comment tsd-typography">
157 <div class="lead">
158 <p>Perform the task specified in the constructor with the data parameter.</p>
159 </div>
160 </div>
161 <h4 class="tsd-parameters-title">Parameters</h4>
162 <ul class="tsd-parameters">
163 <li>
164 <h5>data: <span class="tsd-signature-type">Data</span></h5>
165 <div class="tsd-comment tsd-typography">
166 <p>The input for the specified task. This can only be serializable data.</p>
167 </div>
168 </li>
169 </ul>
170 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">&gt;</span></h4>
171 <p>Promise that will be resolved when the task is successfully completed.</p>
172 </li>
173 </ul>
174 </section>
175 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
176 <a name="setworkerchoicestrategy" class="tsd-anchor"></a>
177 <h3>set<wbr>Worker<wbr>Choice<wbr>Strategy</h3>
178 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
179 <li class="tsd-signature tsd-kind-icon">set<wbr>Worker<wbr>Choice<wbr>Strategy<span class="tsd-signature-symbol">(</span>workerChoiceStrategy<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;ROUND_ROBIN&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;LESS_RECENTLY_USED&quot;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
180 </ul>
181 <ul class="tsd-descriptions">
182 <li class="tsd-description">
183 <aside class="tsd-sources">
184 <ul>
7c0ba920 185 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/pool.ts#L26">src/pools/pool.ts:26</a></li>
5ea22628
JB
186 </ul>
187 </aside>
188 <div class="tsd-comment tsd-typography">
189 <div class="lead">
190 <p>Set the worker choice strategy in this pool.</p>
191 </div>
192 </div>
193 <h4 class="tsd-parameters-title">Parameters</h4>
194 <ul class="tsd-parameters">
195 <li>
196 <h5>workerChoiceStrategy: <span class="tsd-signature-type">&quot;ROUND_ROBIN&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;LESS_RECENTLY_USED&quot;</span></h5>
197 <div class="tsd-comment tsd-typography">
198 <p>The worker choice strategy.</p>
199 </div>
200 </li>
201 </ul>
202 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
203 </li>
204 </ul>
205 </section>
206 </section>
207 </div>
208 <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
209 <nav class="tsd-navigation primary">
210 <ul>
211 <li class=" ">
212 <a href="../index.html">Exports</a>
213 </li>
214 </ul>
215 </nav>
216 <nav class="tsd-navigation secondary menu-sticky">
217 <ul class="before-current">
218 <li class=" tsd-kind-class tsd-has-type-parameter">
219 <a href="../classes/abstractworker.html" class="tsd-kind-icon">Abstract<wbr>Worker</a>
220 </li>
221 <li class=" tsd-kind-class tsd-has-type-parameter">
222 <a href="../classes/clusterworker.html" class="tsd-kind-icon">Cluster<wbr>Worker</a>
223 </li>
224 <li class=" tsd-kind-class tsd-has-type-parameter">
225 <a href="../classes/dynamicclusterpool.html" class="tsd-kind-icon">Dynamic<wbr>Cluster<wbr>Pool</a>
226 </li>
227 <li class=" tsd-kind-class tsd-has-type-parameter">
228 <a href="../classes/dynamicthreadpool.html" class="tsd-kind-icon">Dynamic<wbr>Thread<wbr>Pool</a>
229 </li>
230 <li class=" tsd-kind-class tsd-has-type-parameter">
231 <a href="../classes/fixedclusterpool.html" class="tsd-kind-icon">Fixed<wbr>Cluster<wbr>Pool</a>
232 </li>
233 <li class=" tsd-kind-class tsd-has-type-parameter">
234 <a href="../classes/fixedthreadpool.html" class="tsd-kind-icon">Fixed<wbr>Thread<wbr>Pool</a>
235 </li>
236 <li class=" tsd-kind-class tsd-has-type-parameter">
237 <a href="../classes/threadworker.html" class="tsd-kind-icon">Thread<wbr>Worker</a>
238 </li>
239 <li class=" tsd-kind-interface">
240 <a href="clusterpooloptions.html" class="tsd-kind-icon">Cluster<wbr>Pool<wbr>Options</a>
241 </li>
242 </ul>
243 <ul class="current">
244 <li class="current tsd-kind-interface tsd-has-type-parameter">
245 <a href="ipool.html" class="tsd-kind-icon">IPool</a>
246 <ul>
247 <li class=" tsd-kind-method tsd-parent-kind-interface">
248 <a href="ipool.html#destroy" class="tsd-kind-icon">destroy</a>
249 </li>
250 <li class=" tsd-kind-method tsd-parent-kind-interface">
251 <a href="ipool.html#execute" class="tsd-kind-icon">execute</a>
252 </li>
253 <li class=" tsd-kind-method tsd-parent-kind-interface">
254 <a href="ipool.html#setworkerchoicestrategy" class="tsd-kind-icon">set<wbr>Worker<wbr>Choice<wbr>Strategy</a>
255 </li>
256 </ul>
257 </li>
258 </ul>
259 <ul class="after-current">
260 <li class=" tsd-kind-interface">
261 <a href="iworker.html" class="tsd-kind-icon">IWorker</a>
262 </li>
263 <li class=" tsd-kind-interface tsd-has-type-parameter">
264 <a href="pooloptions.html" class="tsd-kind-icon">Pool<wbr>Options</a>
265 </li>
266 <li class=" tsd-kind-interface">
267 <a href="workeroptions.html" class="tsd-kind-icon">Worker<wbr>Options</a>
268 </li>
269 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
270 <a href="../index.html#errorhandler" class="tsd-kind-icon">Error<wbr>Handler</a>
271 </li>
272 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
273 <a href="../index.html#exithandler" class="tsd-kind-icon">Exit<wbr>Handler</a>
274 </li>
275 <li class=" tsd-kind-type-alias">
276 <a href="../index.html#killbehavior" class="tsd-kind-icon">Kill<wbr>Behavior</a>
277 </li>
278 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
279 <a href="../index.html#onlinehandler" class="tsd-kind-icon">Online<wbr>Handler</a>
280 </li>
281 <li class=" tsd-kind-type-alias">
282 <a href="../index.html#threadworkerwithmessagechannel" class="tsd-kind-icon">Thread<wbr>Worker<wbr>With<wbr>Message<wbr>Channel</a>
283 </li>
284 <li class=" tsd-kind-type-alias">
285 <a href="../index.html#workerchoicestrategy" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategy</a>
286 </li>
287 <li class=" tsd-kind-variable">
288 <a href="../index.html#killbehaviors" class="tsd-kind-icon">Kill<wbr>Behaviors</a>
289 </li>
290 <li class=" tsd-kind-variable">
291 <a href="../index.html#workerchoicestrategies" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategies</a>
292 </li>
293 </ul>
294 </nav>
295 </div>
296 </div>
297</div>
298<footer class="with-border-bottom">
299 <div class="container">
300 <h2>Legend</h2>
301 <div class="tsd-legend-group">
302 <ul class="tsd-legend">
303 <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
304 <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
305 </ul>
306 <ul class="tsd-legend">
307 <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
308 <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
309 </ul>
310 <ul class="tsd-legend">
311 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
312 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
313 </ul>
314 <ul class="tsd-legend">
315 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
316 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
317 </ul>
318 <ul class="tsd-legend">
319 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
320 </ul>
321 </div>
322 </div>
323</footer>
324<div class="container tsd-generator">
325 <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
326</div>
327<div class="overlay"></div>
328<script src="../assets/js/main.js"></script>
329</body>
330</html>